From 51790fd6487b6ca61042325fb4c755351d19e32f Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Thu, 11 May 2023 02:35:36 +0200 Subject: [PATCH 1/1] kakoune initial config --- kak/colors/base16.kak | 76 +++++++++++++++++++++ kak/kakrc | 88 +++++++++++++++++++++++++ kak/plugins/.build/bookmarks.kak/config | 19 ++++++ kak/plugins/.build/powerline.kak/config | 19 ++++++ kak/plugins/bookmarks.kak | 1 + kak/plugins/plug.kak | 1 + kak/plugins/powerline.kak | 1 + kak/plugins/shellcheck.kak | 1 + 8 files changed, 206 insertions(+) create mode 100644 kak/colors/base16.kak create mode 100644 kak/kakrc create mode 100644 kak/plugins/.build/bookmarks.kak/config create mode 100644 kak/plugins/.build/powerline.kak/config create mode 160000 kak/plugins/bookmarks.kak create mode 160000 kak/plugins/plug.kak create mode 160000 kak/plugins/powerline.kak create mode 160000 kak/plugins/shellcheck.kak diff --git a/kak/colors/base16.kak b/kak/colors/base16.kak new file mode 100644 index 00000000..0ae479e0 --- /dev/null +++ b/kak/colors/base16.kak @@ -0,0 +1,76 @@ +## +## base16.kak by lenormf +## + +evaluate-commands %sh{ + black_lighterer='rgb:383838' + black_lighter='rgb:2D2D2D' + black_light='rgb:1C1C1C' + cyan_light='rgb:7CB0FF' + green_dark='rgb:A1B56C' + grey_dark='rgb:585858' + grey_medium='rgb:989898' + grey_light='rgb:D8D8D8' + magenta_dark='rgb:AB4642' + magenta_light='rgb:AB4434' + orange_dark='rgb:DC9656' + orange_light='rgb:F7CA88' + purple_dark='rgb:BA8BAF' + + ## code + echo " + face global value ${orange_dark}+b + face global type ${orange_light} + face global variable ${magenta_dark} + face global module ${green_dark} + face global function ${cyan_light} + face global string ${green_dark} + face global keyword ${purple_dark}+b + face global operator ${cyan_light} + face global attribute ${orange_dark} + face global comment ${grey_medium} + face global documentation comment + face global meta ${orange_light} + face global builtin default+b + " + + ## markup + echo " + face global title blue + face global header ${cyan_light} + face global mono ${green_dark} + face global block ${orange_dark} + face global link blue + face global bullet ${magenta_light} + face global list ${magenta_dark} + " + + ## builtin + echo " + face global Default ${grey_light},${black_light} + face global PrimarySelection white,blue+fg + face global SecondarySelection black,blue+fg + face global PrimaryCursor black,white+fg + face global SecondaryCursor black,white+fg + face global PrimaryCursorEol black,${cyan_light}+fg + face global SecondaryCursorEol black,${cyan_light}+fg + face global LineNumbers ${grey_light},${black_lighter} + face global LineNumberCursor ${grey_light},rgb:282828+b + face global MenuForeground ${grey_light},blue + face global MenuBackground blue,${grey_light} + face global MenuInfo ${cyan_light} + face global Information ${black_light},${cyan_light} + face global Error ${grey_light},${magenta_light} + face global DiagnosticError ${magenta_light} + face global DiagnosticWarning ${cyan_light} + face global StatusLine ${grey_light},${black_lighterer} + face global StatusLineMode ${orange_dark} + face global StatusLineInfo ${cyan_light} + face global StatusLineValue ${green_dark} + face global StatusCursor ${black_lighterer},${cyan_light} + face global Prompt ${black_light},${cyan_light} + face global MatchingChar ${cyan_light},${black_light}+b + face global BufferPadding ${cyan_light},${black_lighter} + face global Whitespace ${grey_dark}+f + " +} diff --git a/kak/kakrc b/kak/kakrc new file mode 100644 index 00000000..02058100 --- /dev/null +++ b/kak/kakrc @@ -0,0 +1,88 @@ +# 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 +colorscheme default + +# Enable editor config +# ──────────────────── +hook global WinCreate ^[^*]+$ %{ editorconfig-load } + +# Extra editor commands +# ───────────────────── +# tab replacement +define-command clean-selections -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ + execute-keys -draft @s\h+$d +} } +define-command clean-buffer -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ + execute-keys -draft \%@s\h+$d +} } +# Bring back and from Vim to increment/decrement the number under the cursor +define-command -hidden -params 2 inc %{ try %{ + evaluate-commands %sh{ + [ "$1" = 0 ] && count=1 || count="$1" + printf '%s%s' 'exec h"_/\dna' "$2($count)|{catecho}|bc" + } +} catch %{ + execute-keys l +}} + +# File management +# ─────────────── +# nnn +declare-option str kak_open "%val{config}/kak_open" +define-command nnn -docstring "open nnn" -params .. %{ + terminal sh -c "NNN_OPENER=%opt{kak_open} KAK_SESSION=%val{session} KAK_CLIENT=%val{client} nnn %arg{@}" +} +complete-command nnn file +# broot +define-command broot -docstring "open broot" -params .. %{ + terminal sh -c "EDITOR=%opt{kak_open} KAK_SESSION=%val{session} KAK_CLIENT=%val{client} broot %arg{@}" +} +complete-command broot file +# fuzzy finders +define-command find -docstring "find files" -params 1 %{ edit %arg{1} } +complete-command find shell-script-candidates %{ find . -type f } +alias global f find + +# Various mappings +# ──────────────── +map global normal '#' :comment-line -docstring 'comment line' +map global normal '' :comment-block -docstring 'comment block' +map global goto m 'm;' -docstring 'matching char' +map -docstring 'select lines downwards' global normal X TLx +# see #inc +map global normal ': inc %val{count} +' +map global normal ': inc %val{count} -' + +# User modes +# # ────────── +map global user -docstring 'enable autocomplete' a ': set-option -add buffer autocomplete insert' +map global user -docstring 'disable autocomplete' A ': set-option -remove buffer autocomplete insert' +map global user -docstring 'edit kakrc' e ': e ~/.config/kak/kakrc' +map global user -docstring 'clean tabs and trailing whitespace in selections' c ': clean-selections' +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*' + +# Enable PLUGin manager +# ───────────────────── +source "%val{config}/plugins/plug.kak/rc/plug.kak" +plug "andreyorst/plug.kak" noload + + plug "andreyorst/powerline.kak" defer powerline_base16 %{ + powerline-theme base16 + } config %{ + powerline-start + } + + plug "Ersikan/bookmarks.kak" %{ + hook global WinCreate .* bookmarks-enable + } + + plug "whereswaldon/shellcheck.kak" +# PLUGin ends + + diff --git a/kak/plugins/.build/bookmarks.kak/config b/kak/plugins/.build/bookmarks.kak/config new file mode 100644 index 00000000..d88dc49d --- /dev/null +++ b/kak/plugins/.build/bookmarks.kak/config @@ -0,0 +1,19 @@ +try %{ + + hook global WinCreate .* bookmarks-enable + } catch %{ + echo -debug "Error while evaluating 'bookmarks.kak' configuration: %val{error}" + + set-option -add current plug_conf_errors "Error while evaluating 'bookmarks.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/.build/powerline.kak/config b/kak/plugins/.build/powerline.kak/config new file mode 100644 index 00000000..9da9ddac --- /dev/null +++ b/kak/plugins/.build/powerline.kak/config @@ -0,0 +1,19 @@ +try %{ + + powerline-start + } catch %{ + echo -debug "Error while evaluating 'powerline.kak' configuration: %val{error}" + + set-option -add current plug_conf_errors "Error while evaluating 'powerline.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/bookmarks.kak b/kak/plugins/bookmarks.kak new file mode 160000 index 00000000..2e92602e --- /dev/null +++ b/kak/plugins/bookmarks.kak @@ -0,0 +1 @@ +Subproject commit 2e92602eef5ed1717660689765b93583eecce099 diff --git a/kak/plugins/plug.kak b/kak/plugins/plug.kak new file mode 160000 index 00000000..f28b3fb8 --- /dev/null +++ b/kak/plugins/plug.kak @@ -0,0 +1 @@ +Subproject commit f28b3fb88fbc77d69b1027780cb9a16b0bd7fc76 diff --git a/kak/plugins/powerline.kak b/kak/plugins/powerline.kak new file mode 160000 index 00000000..c5ef9a84 --- /dev/null +++ b/kak/plugins/powerline.kak @@ -0,0 +1 @@ +Subproject commit c5ef9a845bbd886c73ef00c0efff986e02d5f5d8 diff --git a/kak/plugins/shellcheck.kak b/kak/plugins/shellcheck.kak new file mode 160000 index 00000000..4e633978 --- /dev/null +++ b/kak/plugins/shellcheck.kak @@ -0,0 +1 @@ +Subproject commit 4e633978c119bbb71f215828f7b59cea71a2c5a4 -- 2.51.2