summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kak/kakrc33
1 files changed, 19 insertions, 14 deletions
diff --git a/kak/kakrc b/kak/kakrc
index 8ed04a7..ea20142 100644
--- a/kak/kakrc
+++ b/kak/kakrc
@@ -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 '