]> Freerunner's - dotfiles.git/commitdiff
kak: integrate editorconfig properly
authorAndre Ramnitz <tux.rising@gmail.com>
Sun, 8 Sep 2024 13:43:28 +0000 (15:43 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Sun, 8 Sep 2024 16:12:24 +0000 (18:12 +0200)
on Gentoo, this needs app-text/editorconfig-core-c with USE=cli
installed alongside to work

config/dot-config/kak/kakrc

index 04b16d0dbc888b864a8a81f6f922df79e3e8cfcc..6f763fdda89726953f0633b08e28c62cc158eedc 100644 (file)
@@ -22,7 +22,6 @@ hook global NormalKey y %{ nop %sh{
 # ──────────────────────────────────────────────────────────────────────────────
 hook global BufOpenFile .* %{
     modeline-parse
-    # editorconfig-load ## fucks up linters. disable for now
 }
 
 hook global BufCreate [^*].* %{
@@ -32,8 +31,8 @@ hook global BufCreate [^*].* %{
      }
 }
 
-hook global BufNewFile .* %{
-    editorconfig-load
+hook global WinCreate ^[^*]+$ %{
+    editorconfig-load # needs editorconfig-core-c with use-flag "+cli" on Gentoo
 }
 
 # dynamic scrolloff
@@ -48,7 +47,6 @@ hook global WinCreate [^*].* %{
     }
 }
 
-
 # session manager
 # ──────────────────────────────────────────────────────────────────────────────
 evaluate-commands %sh{
@@ -58,11 +56,11 @@ evaluate-commands %sh{
 # Enable PLUGin manager
 # ──────────────────────────────────────────────────────────────────────────────
 source "%val{config}/bundle/kak-bundle/rc/kak-bundle.kak"
-bundle-noload kak-bundle https://codeberg.org/jdugan6249/kak-bundle
+bundle-noload kak-bundle https://codeberg.org/jdugan6240/kak-bundle
 bundle kakoune-sudo-write https://github.com/occivink/kakoune-sudo-write
 bundle kakoune-find https://github.com/occivink/kakoune-find
 bundle kakoune-expand https://github.com/occivink/kakoune-expand
-bundle foot.kak https://github.com/kkga/foot.kak 
+bundle foot.kak https://github.com/kkga/foot.kak
 bundle kak-harpoon https://github.com/raiguard/kak-harpoon %{
         hook global WinCreate .* harpoon-add-bindings
 }
@@ -71,7 +69,7 @@ bundle kakship https://github.com/eburghar/kakship %{
 }
     bundle-install-hook kakship %{
       cargo install --force --path . --root ~/.local
-       [ ! -e $kak_config/starship.toml ] && cp starship.toml $kak_config/
+        [ ! -e $kak_config/starship.toml ] && cp starship.toml $kak_config/
     }
 bundle-noload dabruin.kak https://git.sr.ht/~nasmevka/dabruin.kak
     bundle-install-hook dabruin.kak %{
@@ -86,40 +84,40 @@ bundle-noload dabruin.kak https://git.sr.ht/~nasmevka/dabruin.kak
 
 # Enable some linting and formatting
 # ──────────────────────────────────────────────────────────────────────────────
-       hook global WinSetOption filetype=js %{
-       set window formatcmd 'npx prettier --stdin-filepath $kak_buffile<ret><space>;'
-    }  
-       hook global WinSetOption filetype=css %{
-       set-option window lintcmd "npx stylelint --formatter unix --stdin-filename='%val{buffile}'"
-    }  
-       hook global WinSetOption filetype=scss %{
-       set window formatcmd 'npx prettier --parser scss --stdin-filepath $kak_buffile<ret><space>;'
-    }  
-       hook global WinSetOption filetype=less %{
-       set window formatcmd 'npx prettier --parser less --stdin-filepath $kak_buffile<ret><space>;'
-    }  
-       hook global WinSetOption filetype=html %{
-       set window formatcmd 'npx prettier --parser html --stdin-filepath $kak_buffile<ret><space>;'
-    }  
-       hook global WinSetOption filetype=(json|jsonc) %{
-       set-option window lintcmd %{ run() { cat -- "$1" | jq 2>&1 | awk -v filename="$1" '/ at line [0-9]+, column [0-9]+$/ { line=$(NF - 2); column=$NF; sub(/ at line [0-9]+, column [0-9]+$/, ""); printf "%s:%d:%d: error: %s", filename, line, column, $0; }'; } && run }
-    }  
-       hook global WinSetOption filetype=md %{
-       set window formatcmd 'npx prettier --parser md --stdin-filepath $kak_buffile<ret><space>;'
+    hook global WinSetOption filetype=js %{
+        set window formatcmd 'npx prettier --stdin-filepath $kak_buffile<ret><space>;'
+    }
+    hook global WinSetOption filetype=css %{
+        set-option window lintcmd "npx stylelint --formatter unix --stdin-filename='%val{buffile}'"
+    }
+    hook global WinSetOption filetype=scss %{
+        set window formatcmd 'npx prettier --parser scss --stdin-filepath $kak_buffile<ret><space>;'
+    }
+    hook global WinSetOption filetype=less %{
+        set window formatcmd 'npx prettier --parser less --stdin-filepath $kak_buffile<ret><space>;'
+    }
+    hook global WinSetOption filetype=html %{
+        set window formatcmd 'npx prettier --parser html --stdin-filepath $kak_buffile<ret><space>;'
+    }
+    hook global WinSetOption filetype=(json|jsonc) %{
+        set-option window lintcmd %{ run() { cat -- "$1" | jq 2>&1 | awk -v filename="$1" '/ at line [0-9]+, column [0-9]+$/ { line=$(NF - 2); column=$NF; sub(/ at line [0-9]+, column [0-9]+$/, ""); printf "%s:%d:%d: error: %s", filename, line, column, $0; }'; } && run }
+    }
+    hook global WinSetOption filetype=md %{
+        set window formatcmd 'npx prettier --parser md --stdin-filepath $kak_buffile<ret><space>;'
     }
     hook global WinSetOption filetype=sh %{
         # needs shfmt: $ go install mvdan.cc/sh/v3/cmd/shfmt@latest
         set-option buffer formatcmd "shfmt"
         set-option window lintcmd "shellcheck -fgcc -Cnever"
     }
-       hook global WinSetOption filetype=yaml %{
-       set window formatcmd 'npx prettier --parser yaml --stdin-filepath $kak_buffile<ret><space>;'
+    hook global WinSetOption filetype=yaml %{
+        set window formatcmd 'npx prettier --parser yaml --stdin-filepath $kak_buffile<ret><space>;'
         set-option window lintcmd %{
             run() {
                 # change [message-type] to message-type:
                 yamllint -f parsable "$1" | sed 's/ \[\(.*\)\] / \1: /'
                 } && run }
-    }  
+    }
 
 
 # Look and Feel
@@ -144,7 +142,7 @@ hook global ModeChange (push|pop):.*:insert %{
 
 # Undo colour changes when we leave insert mode.
 hook global ModeChange (push|pop):insert:.* %{
-    unset-face window StatusLine 
+    unset-face window StatusLine
 }
 
 
@@ -184,9 +182,9 @@ map global normal -docstring 'Previous buffer'  <c-p> ': buffer-previous<ret>'
 # ──────────────────────────────────────────────────────────────────────────────
 map global user -docstring '(b)uffer mode'                              b  ': enter-user-mode buffermode<ret>'
 map global user -docstring '(s)election mode'                           s  ': enter-user-mode selmode<ret>'
-map global user -docstring ':::::::::::::::::::::::::::::::: ::'        :  ': buffer *scratch*<ret>'
-map global user -docstring '(S)cratch buffer goto'                      S  ': buffer *scratch*<ret>'
-map global user -docstring '(D)ebug buffer goto'                        D  ': buffer *debug*<ret>'
+map global user -docstring ':::::::::::::::::::::::::::::::: ::'        :  ': <esc>'
+map global user -docstring 'goto (S)cratch buffer'                      S  ': buffer *scratch*<ret>'
+map global user -docstring 'goto (D)ebug buffer'                        D  ': buffer *debug*<ret>'
 map global user -docstring '(e)xpand selection'                         e  ': expand<ret>'
 map global user -docstring '(E)dit kakrc'                               E  ': e ~/.config/kak/kakrc<ret>'
 map global user -docstring '(r)elative line numbers enable'             r  ': addhl window/nl number-lines -min-digits 3 -relative -hlcursor<ret>'
@@ -197,16 +195,16 @@ map global user -docstring '(i)ncrease value'                           i  ': in
 # buffer user mode
 # ──────────────────────────────────────────────────────────────────────────────
 declare-user-mode buffermode
-map global buffermode -docstring 'enable autocomplete'                  a  ': set-option -add buffer autocomplete insert<ret>'
-map global buffermode -docstring 'disable autocomplete'                 A  ': set-option -remove buffer autocomplete insert<ret>'
-map global buffermode -docstring 'clean tabs and trailing whitespaces'  c  ': clean-buffer<ret>'
-map global buffermode -docstring 'delete buffer'                        d  ': delete-buffer<ret>'
-map global buffermode -docstring 'buffer picker'                        l  ': kks-connect terminal-popup kks-buffers<ret>'
-map global buffermode -docstring 'Lint buffer'                          L  ': buffer *lint-output*<ret>'
-map global buffermode -docstring 'Next buffer '                         n  ': buffer-next<ret>'
-map global buffermode -docstring 'Previous buffer'                      p  ': buffer-previous<ret>'
-map global buffermode -docstring 'wrap enable'                          w  ': add-highlighter buffer/bw wrap<ret>'
-map global buffermode -docstring 'wrap disable'                         W  ': remove-highlighter buffer/bw<ret>'
+map global buffermode -docstring 'enable (a)utocomplete'                a  ': set-option -add buffer autocomplete insert<ret>'
+map global buffermode -docstring 'disable (A)utocomplete'               A  ': set-option -remove buffer autocomplete insert<ret>'
+map global buffermode -docstring '(c)lean tabs and trailing whitespaces'  c  ': clean-buffer<ret>'
+map global buffermode -docstring '(d)elete buffer'                      d  ': delete-buffer<ret>'
+map global buffermode -docstring '(l)ist buffers'                       l  ': kks-connect terminal-popup kks-buffers<ret>'
+map global buffermode -docstring '(L)int buffer'                        L  ': buffer *lint-output*<ret>'
+map global buffermode -docstring '(n)ext buffer'                        n  ': buffer-next<ret>'
+map global buffermode -docstring '(p)revious buffer'                    p  ': buffer-previous<ret>'
+map global buffermode -docstring '(w)rap enable'                        w  ': add-highlighter buffer/bw wrap<ret>'
+map global buffermode -docstring '(W)rap disable'                       W  ': remove-highlighter buffer/bw<ret>'
 
 # selection user mode
 # ──────────────────────────────────────────────────────────────────────────────
@@ -219,9 +217,10 @@ map global selmode -docstring 'sort words (V)ertically in selection '   v '| sor
 # ──────────────────────────────────────────────────────────────────────────────
 set-option global foot_normal_cmd 'footclient'
 set-option global foot_popup_cmd 'footclient'
-set-option global foot_normal_flags ''
-set-option global foot_popup_flags '-a kakpopup'
 set-option global foot_panel_cmd 'footclient'
+set-option global foot_normal_flags ''
+set-option global foot_popup_flags '-a kakpopup' '-W 250x50'
+set-option global foot_panel_flags '-a kakpopup' '-W 400x1'
 
 # language config
 # ──────────────────────────────────────────────────────────────────────────────