diff options
| author | Jake Koroman <jake@jakekoroman.com> | 2026-06-08 20:16:31 -0400 |
|---|---|---|
| committer | Jake Koroman <jake@jakekoroman.com> | 2026-06-08 20:16:31 -0400 |
| commit | 66ac92718c80dfce62bac23e93e5576711bd8318 (patch) | |
| tree | 1edc792172ffc29cbda6e2a9360acb2a6a580c77 | |
| parent | bbdecd8491acb3db7b0f48e09888d7d266b485a0 (diff) | |
kakoune hacking.
| -rw-r--r-- | kak/kakrc | 33 |
1 files changed, 19 insertions, 14 deletions
@@ -29,32 +29,37 @@ hook global ModuleLoaded wayland %{ hook global ModuleLoaded tmux %{ set global windowing_placement 'horizontal' + evaluate-commands %sh{ + copy_cmd="wl-copy" + paste_cmd="wl-paste" + if [ -z "$WAYLAND_DISPLAY" ]; then + copy_cmd="xclip -selection clipboard" + paste_cmd="xclip -selection clipboard -o" + fi + printf "map -docstring 'yank to system clipboard' global user y '<a-|>%s<ret>'\n" "$copy_cmd" + printf "map -docstring 'paste from system clipboard' global user p '<!>%s<ret>'\n" "$paste_cmd" + } } hook global BufWritePre .* %{ jrk-trim-trailing-whitespace } -define-command testcmd %{ - prompt -file-completion 'What is your name? ' %{ - evaluate-commands %sh{ - echo "Hello, $kak_text!" > /tmp/vars - env >> /tmp/vars - title=$(dmenu -p 'say something: ') - printf "info '%s' -title '%s'" "wrote to file /tmp/vars" "$title" - } - } -} - define-command jrk-set-makecmd-and-make %{ - prompt 'makecmd: ' %{ + prompt -file-completion 'makecmd: ' %{ evaluate-commands %{ set-option global makecmd %val{text} - make + jrk-save-and-make } } } +define-command jrk-save-and-make %{ + evaluate-commands %sh{ + [ "$kak_bufname" != "*make*" ] && printf "evaluate-commands %%{ write\nmake }\n" + } +} + define-command jrk-trim-trailing-whitespace %{ try %{ execute-keys -draft "%%s\h+$<ret>d" } } @@ -62,7 +67,7 @@ define-command jrk-trim-trailing-whitespace %{ map -docstring 'goto next make error' global user [ '<:>make-next-error<ret>' map -docstring 'goto previous make error' global user ] '<:>make-previous-error<ret>' -map -docstring 'save file and run make' global user q '<:>w<ret><:>make<ret>' +map -docstring 'save file and run make' global user q '<:>jrk-save-and-make<ret>' map -docstring 'set makecmd and make' global user Q '<:>jrk-set-makecmd-and-make<ret>' map -docstring 'edit file' global user . '<:>edit ' |
