Modularize grep.kak, make.kak and jump.kak

This commit is contained in:
Maxime Coste 2024-03-11 20:51:27 +11:00
parent 2b9b74091d
commit 9cc2f47e31
3 changed files with 20 additions and 6 deletions

View File

@ -1,8 +1,10 @@
# require-module jump
declare-option -docstring "shell command run to search for subtext in a file/directory" \ declare-option -docstring "shell command run to search for subtext in a file/directory" \
str grepcmd 'grep -RHn' str grepcmd 'grep -RHn'
provide-module grep %{
require-module jump
define-command -params .. -docstring %{ define-command -params .. -docstring %{
grep [<arguments>]: grep utility wrapper grep [<arguments>]: grep utility wrapper
All optional arguments are forwarded to the grep utility All optional arguments are forwarded to the grep utility
@ -58,3 +60,7 @@ define-command grep-next-match -docstring %{alias for "jump-next *grep*"} %{
define-command grep-previous-match -docstring %{alias for "jump-previous *grep*"} %{ define-command grep-previous-match -docstring %{alias for "jump-previous *grep*"} %{
jump-previous *grep* jump-previous *grep*
} }
}
hook -once global KakBegin .* %{ require-module grep }

View File

@ -1,10 +1,10 @@
provide-module jump %§§
declare-option -docstring "name of the client in which all source code jumps will be executed" \ declare-option -docstring "name of the client in which all source code jumps will be executed" \
str jumpclient str jumpclient
declare-option -docstring "name of the client in which utilities display information" \ declare-option -docstring "name of the client in which utilities display information" \
str toolsclient str toolsclient
provide-module jump %{
declare-option -hidden int jump_current_line 0 declare-option -hidden int jump_current_line 0
define-command -hidden jump %{ define-command -hidden jump %{
@ -64,3 +64,7 @@ define-command -hidden jump-select-previous %{
# See comment in jump-select-next # See comment in jump-select-next
execute-keys ge %opt{jump_current_line}g<a-h> <a-/>^[^:\n]+:\d+:<ret> execute-keys ge %opt{jump_current_line}g<a-h> <a-/>^[^:\n]+:\d+:<ret>
} }
}
hook -once global KakBegin .* %{ require-module jump }

View File

@ -1,11 +1,11 @@
# require-module jump
declare-option -docstring "shell command run to build the project" \ declare-option -docstring "shell command run to build the project" \
str makecmd make str makecmd make
declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command. Capture groups must be: 1: filename 2: line number 3: optional column 4: optional error description" \ declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command. Capture groups must be: 1: filename 2: line number 3: optional column 4: optional error description" \
regex make_error_pattern "^([^:\n]+):(\d+):(?:(\d+):)? (?:fatal )?error:([^\n]+)?" regex make_error_pattern "^([^:\n]+):(\d+):(?:(\d+):)? (?:fatal )?error:([^\n]+)?"
provide-module make %{
require-module jump
define-command -params .. \ define-command -params .. \
-docstring %{ -docstring %{
@ -86,3 +86,7 @@ define-command make-next-error -docstring %{alias for "jump-next *make*"} %{
define-command make-previous-error -docstring %{alias for "jump-previous *make*"} %{ define-command make-previous-error -docstring %{alias for "jump-previous *make*"} %{
jump-previous *make* jump-previous *make*
} }
}
hook -once global KakBegin .* %{ require-module make }