From 07d1f48e9482eb52d9f104a9dced1e8fa28ab72e Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Mon, 5 Jun 2023 08:05:02 +0200 Subject: [PATCH] kak: add config --- .gitmodules | 30 +++++++++ kak/kakrc | 67 ++++++++++++++++++- .../.build/kakoune-smooth-scroll/config | 30 +++++++++ kak/plugins/.build/smarttab.kak/config | 21 ++++++ kak/plugins/connect.kak | 1 + kak/plugins/kakoune-sudo-write | 1 + kak/plugins/prelude.kak | 1 + kak/plugins/smarttab.kak | 1 + 8 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 100644 kak/plugins/.build/kakoune-smooth-scroll/config create mode 100644 kak/plugins/.build/smarttab.kak/config create mode 160000 kak/plugins/connect.kak create mode 160000 kak/plugins/kakoune-sudo-write create mode 160000 kak/plugins/prelude.kak create mode 160000 kak/plugins/smarttab.kak diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..22725d52 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,30 @@ +[submodule "kak/plugins/powerline.kak"] + path = kak/plugins/powerline.kak + url = https://github.com/andreyorst/powerline.kak +[submodule "kak/plugins/plug.kak"] + path = kak/plugins/plug.kak + url = https://github.com/andreyorst/plug.kak +[submodule "kak/plugins/bookmarks.kak"] + path = kak/plugins/bookmarks.kak + url = https://github.com/Ersikan/bookmarks.kak +[submodule "kak/plugins/shellcheck.kak"] + path = kak/plugins/shellcheck.kak + url = https://github.com/whereswaldon/shellcheck.kak +[submodule "kak/plugins/prelude.kak"] + path = kak/plugins/prelude.kak + url = https://github.com/kakounedotcom/prelude.kak +[submodule "kak/plugins/connect.kak"] + path = kak/plugins/connect.kak + url = https://github.com/kakounedotcom/connect.kak +[submodule "kak/plugins/kakoune-sudo-write.kak"] + path = kak/plugins/kakoune-sudo-write.kak + url = https://github.com/occivink/kakoune-sudo-write +[submodule "kak/plugins/kakoune-smooth-scroll"] + path = kak/plugins/kakoune-smooth-scroll + url = https://github.com/caksoylar/kakoune-smooth-scroll +[submodule "kak/plugins/kakoune-sudo-write"] + path = kak/plugins/kakoune-sudo-write + url = https://github.com/occivink/kakoune-sudo-write +[submodule "kak/plugins/smarttab.kak"] + path = kak/plugins/smarttab.kak + url = https://github.com/andreyorst/smarttab.kak diff --git a/kak/kakrc b/kak/kakrc index 02058100..48318129 100644 --- a/kak/kakrc +++ b/kak/kakrc @@ -1,9 +1,48 @@ +# System integration +hook global RegisterModified '"' %{ nop %sh{ + printf %s "$kak_main_reg_dquote" | xsel --input --clipboard +}} + # Look and Feel # ───────────── add-highlighter global/trailing-whitespace regex '\h+$' 0:Error # trailing whitespaces in red add-highlighter global/todos regex '(//|#|/\*)\h*(TODO|WARNING|FIXME)[:]?[^\n]*' 2:+bu # highlight comment tags add-highlighter global/ show-matching # show matching brackets +add-highlighter global/ number-lines -min-digits 3 # absolute line nums everywhere colorscheme default +set-option global tabstop 4 +set-option global indentwidth 4 +set-option global scrolloff 10,10 + +# Different Cursor color in insert mode +# ───────────────────────────────────── +# Shades of blue/cyan for normal mode +set-face global PrimarySelection white,blue+F +set-face global SecondarySelection black,blue+F +set-face global PrimaryCursor black,bright-cyan+F +set-face global SecondaryCursor black,bright-blue+F +set-face global PrimaryCursorEol black,bright-cyan +set-face global SecondaryCursorEol black,bright-blue + +# Shades of green/yellow for insert mode. +hook global ModeChange (push|pop):.*:insert %{ + set-face window PrimarySelection white,green+F + set-face window SecondarySelection black,green+F + set-face window PrimaryCursor black,bright-yellow+F + set-face window SecondaryCursor black,bright-green+F + set-face window PrimaryCursorEol black,bright-yellow + set-face window SecondaryCursorEol black,bright-green +} + +# Undo colour changes when we leave insert mode. +hook global ModeChange (push|pop):insert:.* %{ + unset-face window PrimarySelection + unset-face window SecondarySelection + unset-face window PrimaryCursor + unset-face window SecondaryCursor + unset-face window PrimaryCursorEol + unset-face window SecondaryCursorEol +} # Enable editor config # ──────────────────── @@ -65,7 +104,12 @@ map global user -docstring 'clean tabs and trailing whitespace in selections' c map global user -docstring 'clean tabs and trailing whitespace in the buffer' C ': clean-buffer' map global user -docstring 'next buffer' n ': buffer-next' map global user -docstring 'previous buffer' p ': buffer-previous' -map global user -docstring 'lint-buffer' l ': buffer *lint-output*' +map global user -docstring 'comment-line' l ': comment-line' +map global user -docstring 'lint-buffer' L ': buffer *lint-output*' +map global user -docstring 'relative line numbers enable' r ': add-highlighter window/nl number-lines -relative -hlcursor' +map global user -docstring 'relative line numbers disable' R ': remove-highlighter window/nl' +map global user -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap' +map global user -docstring 'wrap disable' W ': remove-highlighter buffer/bw' # Enable PLUGin manager # ───────────────────── @@ -82,7 +126,26 @@ plug "andreyorst/plug.kak" noload hook global WinCreate .* bookmarks-enable } - plug "whereswaldon/shellcheck.kak" + plug "andreyorst/smarttab.kak" defer smarttab %{ + # when 'backspace' is pressed, 4 spaces are deleted at once + set-option global softtabstop 4 + } config %{ + hook global WinSetOption filetype=(rust|markdown|kak|lisp|scheme|py|sh|perl) expandtab + hook global WinSetOption filetype=(makefile|gas) noexpandtab + hook global WinSetOption filetype=(c|cpp) smarttab + } + plug "whereswaldon/shellcheck.kak" + plug "kakounedotcom/prelude.kak" + plug "kakounedotcom/connect.kak" + plug "occivink/kakoune-sudo-write" + # PLUGin ends +# set up plugins +# ───────────────────── + +# for connect.kak +require-module prelude +require-module connect +require-module connect-dolphin diff --git a/kak/plugins/.build/kakoune-smooth-scroll/config b/kak/plugins/.build/kakoune-smooth-scroll/config new file mode 100644 index 00000000..1f93d39b --- /dev/null +++ b/kak/plugins/.build/kakoune-smooth-scroll/config @@ -0,0 +1,30 @@ +try %{ + + # configuration here + # hook global WinCreate [^*].* %{ + # hook -once window WinDisplay .* %{ + # smooth-scroll-enable + # } + hook -group smooth-scroll window User ScrollBegin %{ + add-highlighter -override window/nl number-lines + } + hook -group smooth-scroll window User ScrollEnd %{ + add-highlighter -override window/nl number-lines -relative -hlcursor + } + } + } catch %{ + echo -debug "Error while evaluating 'kakoune-smooth-scroll' configuration: %val{error}" + + set-option -add current plug_conf_errors "Error while evaluating 'kakoune-smooth-scroll' configuration:" + set-option -add current plug_conf_errors %sh{ printf "\n " } + set-option -add current plug_conf_errors %val{error} + set-option -add current plug_conf_errors %sh{ printf "\n\n" } + + hook -once -group plug-conf-err global WinDisplay .* %{ + info -style modal -title "plug.kak error" "%opt{plug_conf_errors}" + on-key %{ + info -style modal + execute-keys -with-maps -with-hooks %val{key} + } + } +} diff --git a/kak/plugins/.build/smarttab.kak/config b/kak/plugins/.build/smarttab.kak/config new file mode 100644 index 00000000..c43b50f2 --- /dev/null +++ b/kak/plugins/.build/smarttab.kak/config @@ -0,0 +1,21 @@ +try %{ + + hook global WinSetOption filetype=(rust|markdown|kak|lisp|scheme|py|sh|perl) expandtab + hook global WinSetOption filetype=(makefile|gas) noexpandtab + hook global WinSetOption filetype=(c|cpp) smarttab + } catch %{ + echo -debug "Error while evaluating 'smarttab.kak' configuration: %val{error}" + + set-option -add current plug_conf_errors "Error while evaluating 'smarttab.kak' configuration:" + set-option -add current plug_conf_errors %sh{ printf "\n " } + set-option -add current plug_conf_errors %val{error} + set-option -add current plug_conf_errors %sh{ printf "\n\n" } + + hook -once -group plug-conf-err global WinDisplay .* %{ + info -style modal -title "plug.kak error" "%opt{plug_conf_errors}" + on-key %{ + info -style modal + execute-keys -with-maps -with-hooks %val{key} + } + } +} diff --git a/kak/plugins/connect.kak b/kak/plugins/connect.kak new file mode 160000 index 00000000..a536605a --- /dev/null +++ b/kak/plugins/connect.kak @@ -0,0 +1 @@ +Subproject commit a536605a208149eed58986bda54f3dda215dfe61 diff --git a/kak/plugins/kakoune-sudo-write b/kak/plugins/kakoune-sudo-write new file mode 160000 index 00000000..ec0d6d26 --- /dev/null +++ b/kak/plugins/kakoune-sudo-write @@ -0,0 +1 @@ +Subproject commit ec0d6d26ceaadd93d6824630ba587b31e442214d diff --git a/kak/plugins/prelude.kak b/kak/plugins/prelude.kak new file mode 160000 index 00000000..5dbdc020 --- /dev/null +++ b/kak/plugins/prelude.kak @@ -0,0 +1 @@ +Subproject commit 5dbdc020c546032885c1fdb463e366cc89fc15ad diff --git a/kak/plugins/smarttab.kak b/kak/plugins/smarttab.kak new file mode 160000 index 00000000..86ac6599 --- /dev/null +++ b/kak/plugins/smarttab.kak @@ -0,0 +1 @@ +Subproject commit 86ac6599b13617ff938905ba4cdd8225d7eb6a2e -- 2.51.2