summaryrefslogtreecommitdiff
path: root/kak/kakrc
diff options
context:
space:
mode:
authorJake Koroman <jake@jakekoroman.com>2026-04-10 22:50:12 -0400
committerJake Koroman <jake@jakekoroman.com>2026-04-10 22:50:12 -0400
commitbfd7be19d28cdbe32c81b47f64c88dbe6a2d713a (patch)
tree66d83342aeaca4ed89c8c4899ee9377ee3f76c1b /kak/kakrc
parent6e92faf0073c749a6a24a46d4d784c8a4db0b661 (diff)
kak: trim trailing whitespace before save.
Diffstat (limited to 'kak/kakrc')
-rw-r--r--kak/kakrc8
1 files changed, 8 insertions, 0 deletions
diff --git a/kak/kakrc b/kak/kakrc
index d9e2968..83cf09e 100644
--- a/kak/kakrc
+++ b/kak/kakrc
@@ -19,6 +19,10 @@ hook global ModuleLoaded x11 %{
set global termcmd 'st -e sh -c'
}
+hook global BufWritePre .* %{
+ jrk-trim-trailing-whitespace
+}
+
define-command testcmd %{
prompt -file-completion 'What is your name? ' %{
evaluate-commands %sh{
@@ -39,6 +43,10 @@ define-command jrk-set-makecmd-and-make %{
}
}
+define-command jrk-trim-trailing-whitespace %{
+ try %{ execute-keys -draft "%%s\h+$<ret>d" }
+}
+
map -docstring 'yank to system clipboard' global user y '<a-|>xclip -selection clipboard<ret>'
map -docstring 'paste from system clipboard' global user p '<!>xclip -selection clipboard -o<ret>'