]> Freerunner's - kakoune-config.git/commitdiff
Disable kak-lsp for the time being, update formaters/linkers main
authorAndre Ramnitz <tux.rising@gmail.com>
Thu, 23 Oct 2025 21:44:40 +0000 (23:44 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Thu, 23 Oct 2025 21:44:40 +0000 (23:44 +0200)
and clean-up keybinds

kakrc
languagecmd.kak
starship.toml

diff --git a/kakrc b/kakrc
index e77cb718dc61474dfe97a383a6aefdfc59bbf1b8..05d22569ac55255b6a7807c463d28b01660d52a3 100644 (file)
--- a/kakrc
+++ b/kakrc
@@ -51,6 +51,7 @@ evaluate-commands %sh{ kks init }
 define-command -override kks-connect -params 1.. -command-completion  %{
   %arg{1} sh -c %{
     export EDITOR='kks edit'
+    export VISUAL='kks edit'
     export KKS_SESSION=$1
     export KKS_CLIENT=$2
     shift 3
@@ -73,6 +74,7 @@ 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 kakoune-surround https://github.com/h-youhei/kakoune-surround
+bundle shadow.kak https://github.com/ftonneau/shadow.kak
 bundle kakship https://github.com/eburghar/kakship %{
     kakship-enable
 }
@@ -91,96 +93,61 @@ bundle-noload dabruin.kak https://git.sr.ht/~nasmevka/dabruin.kak
         rm -f "${kak_config}/colors/dabruin-light.kak"
     }
 bundle kakoune-table https://gitlab.com/listentolist/kakoune-table
-bundle kakoune-lsp https://github.com/kakoune-lsp/kakoune-lsp %{
-    bundle-install-hook kakoune-lsp %{
-        cargo build --release --locked
-        cargo install --locked --force --path .
-    }
-    set global lsp_diagnostic_line_error_sign '║'
-    set global lsp_diagnostic_line_warning_sign '┊'
-    define-command ne -docstring 'go to next error/warning from lsp' %{ lsp-find-error --include-warnings }
-    define-command pe -docstring 'go to previous error/warning from lsp' %{ lsp-find-error --previous --include-warnings }
-    define-command ee -docstring 'go to current error/warning from lsp' %{ lsp-find-error --include-warnings; lsp-find-error --previous --include-warnings }
-    # define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start }
-    # hook global WinSetOption filetype=(c|cpp|cc|rust|javascript|typescript) %{
-    #     set-option window lsp_auto_highlight_references true
-    #     set-option window lsp_hover_anchor false
-    #     lsp-auto-hover-enable
-    #     echo -debug "Enabling LSP for filtetype %opt{filetype}"
-    #     lsp-enable-window
-    # }
-    # hook global WinSetOption filetype=(rust) %{
-    #     set window lsp_server_configuration rust.clippy_preference="on"
-    # }
-    # hook global WinSetOption filetype=rust %{
-    #     hook window BufWritePre .* %{
-    #         evaluate-commands %sh{
-    #             test -f rustfmt.toml && printf lsp-formatting-sync
-    #         }
-    #     }
-    # }
-    evaluate-commands %sh{ kak-lsp }
-    lsp-enable
-    hook global KakEnd .* lsp-exit
-}
-
-
-# Enable some linting and formating
-# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+#bundle kakoune-lsp https://github.com/kakoune-lsp/kakoune-lsp %{
+#    bundle-install-hook kakoune-lsp %{
+#        cargo build --release --locked
+#        cargo install --locked --force --path .
+#    }
+#    set global lsp_diagnostic_line_error_sign '║'
+#    set global lsp_diagnostic_line_warning_sign '┊'
+#    define-command ne -docstring 'go to next error/warning from lsp' %{ lsp-find-error --include-warnings }
+#    define-command pe -docstring 'go to previous error/warning from lsp' %{ lsp-find-error --previous --include-warnings }
+#    define-command ee -docstring 'go to current error/warning from lsp' %{ lsp-find-error --include-warnings; lsp-find-error --previous --include-warnings }
+#    # define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start }
+#    # hook global WinSetOption filetype=(c|cpp|cc|rust|javascript|typescript) %{
+#    #     set-option window lsp_auto_highlight_references true
+#    #     set-option window lsp_hover_anchor false
+#    #     lsp-auto-hover-enable
+#    #     echo -debug "Enabling LSP for filtetype %opt{filetype}"
+#    #     lsp-enable-window
+#    # }
+#    # hook global WinSetOption filetype=(rust) %{
+#    #     set window lsp_server_configuration rust.clippy_preference="on"
+#    # }
+#    # hook global WinSetOption filetype=rust %{
+#    #     hook windoformat-buffer#    #         }
+#    #         evaluate-commands<ret> %slint-buffer{
+#    #             test -f rustfmt.toml && printf lsp-formatting-sync
+#    #         }
+#    #     }
+#    # }
+#    evaluate-commands %sh{ kak-lsp }
+#    lsp-enable
+# #    hook global KakEnd .* lsp-exit
+# #}
+
+
+# # Enable linting and formating
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 source %sh{
-    echo ${kak_config}/languagecmd.kak # borrowed from https://git.sr.ht/~nasmevka
+    echo ${kak_config}/languagecmd.kak # boilerplate from https://git.sr.ht/~nasmevka
 }
 
-# Enable some code formaters
-# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-hook global BufSetOption filetype=(js|javascript) %{
-    set-option buffer formatcmd "prettier --stdin-filepath=%val{buffile}"
-}
-hook global WinSetOption filetype=scss %{
-    set-option buffer formatcmd 'npx prettier --parser scss --stdin-filepath=%val{buffile}'
-}
-hook global WinSetOption filetype=less %{
-    set-option buffer formatcmd 'npx prettier --parser less --stdin-filepath=%val{buffile}'
-}
-hook global WinSetOption filetype=html %{
-    set-option buffer formatcmd 'npx prettier --parser html --stdin-filepath=%val{buffile}'
-}
-hook global WinSetOption filetype=md %{
-    set-option buffer formatcmd 'npx prettier --parser md --stdin-filepath=%val{buffile}'
-}
-hook global WinSetOption filetype=sh %{
-    # needs shfmt: $ go install mvdan.cc/sh/v3/cmd/shfmt@latest
-    set-option buffer formatcmd "shfmt -i 4 -ci -sr -"
-}
-hook global WinSetOption filetype=yaml %{
-    set-option buffer formatcmd "npx prettier --parser yaml --stdin-filepath=%val{buffile}"
-}
-hook global WinSetOption filetype=(json|jsonc) %{
-    set-option buffer formatcmd "jq --indent %opt{tabstop} ."
-}
 
-# Enable some code linters
+# Shadow.kak config
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-hook global WinSetOption filetype=(c|h) %{
-    set-option window lintcmd "cppcheck --language=c --enable=warning,style,information --template='{file}:{line}:{column}: {severity}: {message}' --suppress='*:*.h' 2>&1"
-}
-hook global WinSetOption filetype=css %{
-    set-option window lintcmd "npx stylelint --formatter unix --stdin-filename='%val{buffile}'"
-}
-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=sh %{
-    # needs shfmt: $ go install mvdan.cc/sh/v3/cmd/shfmt@latest
-    set-option window lintcmd "shellcheck -fgcc -Cnever"
-}
-hook global WinSetOption filetype=yaml %{
-    set-option window lintcmd %{
-        run() {
-            # change [message-type] to message-type:
-            yamllint -f parsable "$1" | sed 's/ \[\(.*\)\] / \1: /'
-            } && run }
-}
+# markdown
+shadow-set markdown \
+code ^\h*``` \n\h*``` nofirst nolast default,rgb:c9c9c9 \
+note ^Note \n\n first nolast default,rgb:ddddc5
+shadow-decorate markdown \
+border ^\h*``` default,rgb:c9afaf
+
+# kak
+shadow-set kak \
+comment ^# ^# nofirst nolast default
+shadow-decorate kak \
+border ^# default,rgb:222222
 
 
 # Look and Feel
@@ -338,7 +305,7 @@ map global normal -docstring 'help'                                     <F1>  ':
 map global user -docstring 'buffer mode'                                 b  ': enter-user-mode buffermode<ret>'
 map global user -docstring 'git mode'                                    g  ': enter-user-mode gitmode<ret>'
 map global user -docstring 'selection mode'                              s  ': enter-user-mode selmode<ret>'
-map global user -docstring 'LSP mode'                                    l  ': enter-user-mode lsp<ret>' 
+map global user -docstring 'LSP mode'                                    l  ': enter-user-mode lsp<ret>' 
 map global user -docstring 'Table mode'                                  t  ': enter-user-mode table<ret>' 
 map global user -docstring 'Table mode (locked)'                         T  ': enter-user-mode -lock table<ret>' 
 map global user -docstring ':::::::::::::::::::::::::::::::: ::'         :  ': <esc>'
@@ -364,13 +331,13 @@ map global user -docstring 'case insensitive backward extend-search' '<a-?>' <a-
 
 # kak-lsp keys
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
-map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
-map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
-map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
-map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
-map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
-map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
+map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
+map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
+map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
+map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
+map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
+map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
+map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
 
 # buffer user mode
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -378,10 +345,12 @@ 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 'Debug output buffer'                   d  ': buffer *debug*<ret>'
+map global buffermode -docstring 'delete buffer'                         D  ': delete-buffer<ret>'
+map global buffermode -docstring 'format buffer'                         f  ': format-buffer<ret>'
 map global buffermode -docstring 'show file info'                        i  ': info "file saved at %sh{date}"<ret>'
-map global buffermode -docstring 'list buffers'                          l  ': kks-connect terminal-popup kks-buffers<ret>'
-map global buffermode -docstring 'Lint buffer'                           L  ': buffer *lint-output*<ret>'
+map global buffermode -docstring 'run linter'                            l  ': lint-buffer<ret>'
+map global buffermode -docstring 'Lint output 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 'Word-wrap enable'                      w  ': add-highlighter buffer/wordwrap wrap -word -indent<ret>'
index e5827736ecb27dd254db19dc60067a5061d910d0..ce15ee56ebc605e18de970efb8dc1190e819a709 100644 (file)
@@ -7,6 +7,12 @@ hook -group languagecmd global WinSetOption filetype=go %{
     set-option buffer lintcmd          "golangci-lint run --out-format=line-number --uniq-by-line=true --allow-parallel-runners | grep %val{bufname} #"
 }
 
+### json
+hook -group languagecmd global WinSetOption filetype=(json|jsonc) %{
+    set-option buffer formatcmd 'set-option buffer formatcmd "jq --indent %opt{tabstop} ."'
+    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 }
+}
+
 ### python
 hook -group languagecmd global WinSetOption filetype=python %{
     set-option buffer formatcmd 'black --line-length 150 -'
@@ -24,35 +30,25 @@ hook -group languagecmd global WinSetOption filetype=sh %{
 }
 
 ### C
-hook -group languagecmd global WinSetOption filetype=c %{
+hook -group languagecmd global WinSetOption filetype=(c|h) %{
     set-option buffer formatcmd 'clang-format -'
     set-option buffer lintcmd "clang-check --analyze %val{buffile} 2>&1 | sed '/^[^/]/d' #"
 }
 
-### scheme (CHICKEN)
-hook -group languagecmd global WinSetOption filetype=scheme %{
-    set-option buffer formatcmd ''
-    set-option buffer lintcmd   ''
-    # spaces for indent, using only two since scheme can have a lot of indentation
-    set-option buffer tabstop 2
-    set-option buffer indentwidth 2
-
-       enter-spacemode
-       enable-replkak-bindings
-       # launch parinfer last since we want the tabulation->space transformation before
-    parinfer-enable-window -indent
-}
-
-hook -group languagecmd global WinSetOption filetype=markdown %{
-    try %{
-               declare-surrounding-pair 'surround selection with italic syntax'      ital  * *
-               declare-surrounding-pair 'surround selection with bold syntax'        bold  ** **
-               declare-surrounding-pair 'surround selection with inline code syntax' icode ` `
-               declare-surrounding-pair 'surround selection with bloc code syntax'   bcode <ret>```<ret> <ret>```<ret>
-               alias buffer italic surround-with-ital
-               alias buffer bold surround-with-bold
-               alias buffer inline surround-with-icode
-               alias buffer bloc surround-with-bcode
+### Markdown
+hook -group languagecmd global WinSetOption filetype=(md|markdown) %{
+    # try %{
+    #     declare-surrounding-pair 'surround selection with italic syntax'      ital  * *
+    #     declare-surrounding-pair 'surround selection with bold syntax'        bold  ** **
+    #     declare-surrounding-pair 'surround selection with inline code syntax' icode ` `
+    #     declare-surrounding-pair 'surround selection with bloc code syntax'   bcode <ret>```<ret> <ret>```<ret>
+    #     alias buffer italic surround-with-ital
+    #     alias buffer bold surround-with-bold
+    #     alias buffer inline surround-with-icode
+    #     alias buffer bloc surround-with-bcode
+    # }
+    hook global WinSetOption filetype=md %{
+        set-option buffer formatcmd 'npx prettier --parser md --stdin-filepath=%val{buffile}'
     }
 }
 
@@ -74,4 +70,33 @@ hook -group languagecmd global WinSetOption filetype=hare %{
        set-option buffer indentwidth 8
 }
 
+### CSS
+hook global WinSetOption filetype=css %{
+    set-option buffer formatcmd "yarn dlx stylelint --fix --stdin-filename='%val{buffile}'"
+    set-option window lintcmd "yarn dlx stylelint --formatter unix --stdin-filename='%val{buffile}'"
+}
+
+### YAML
+hook global WinSetOption filetype=yaml %{
+    set-option window lintcmd %{                                                                                                        
+    run() {                                                                                                                           
+        # change [message-type] to message-type:                                                                                       
+        yamllint -f parsable "$1" | sed 's/ \[\(.*\)\] / \1: /'                                                                        
+    } && run }                                                                                                                          
+    set-option buffer formatcmd "npx prettier --parser yaml --stdin-filepath=%val{buffile}"
+
+}
 
+### TODO: add corresponding linter
+hook global BufSetOption filetype=(js|javascript) %{
+    set-option buffer formatcmd "prettier --stdin-filepath=%val{buffile}"
+}
+hook global WinSetOption filetype=scss %{
+    set-option buffer formatcmd 'npx prettier --parser scss --stdin-filepath=%val{buffile}'
+}
+hook global WinSetOption filetype=less %{
+    set-option buffer formatcmd 'npx prettier --parser less --stdin-filepath=%val{buffile}'
+}
+hook global WinSetOption filetype=html %{
+    set-option buffer formatcmd 'npx prettier --parser html --stdin-filepath=%val{buffile}'
+}
index 1345bb49c0fbbefd389afba01055a169bb0a4eb9..053e072f50e2454c81cade4792b21eacd5abd959 100644 (file)
@@ -34,7 +34,7 @@ format = "[ %opt{lsp_diagnostic_error_count}]($style)"
 style = "fg:red bold bg:default"
 when = '[ -n "$kak_opt_lsp_diagnostic_error_count" -a "$kak_opt_lsp_diagnostic_error_count" -ne 0 ]'
 shell = ['sh']
-disabled = false
+disabled = true
 
 [custom.kaklsp_warn]
 description = "Show warnings number from kak-lsp if any"
@@ -42,7 +42,7 @@ format = "[  %opt{lsp_diagnostic_warning_count}]($style)"
 style = "fg:yellow bold bg:default"
 when = '[ -n "$kak_opt_lsp_diagnostic_warning_count" -a "$kak_opt_lsp_diagnostic_warning_count" -ne 0 ]'
 shell = ['sh']
-disabled = false
+disabled = true
 
 [custom.kaklsp_hint]
 description = "Show hints number from kak-lsp if any"
@@ -50,7 +50,7 @@ format = "[ ﯦ %opt{lsp_diagnostic_hint_count}]($style)"
 style = "fg:white bold bg:default"
 when = '[ -n "$kak_opt_lsp_diagnostic_hint_count" -a "$kak_opt_lsp_diagnostic_hint_count" -ne 0 ]'
 shell = ['sh']
-disabled = false
+disabled = true
 
 [custom.kaklsp_code_actions]
 description = "Show lsp code actions if any"
@@ -58,7 +58,7 @@ format = "[ %opt{lsp_modeline_code_actions} ]($style)"
 style = "fg:yellow bold bg:default"
 when = '[ -n "$kak_opt_lsp_modeline_code_actions" ]'
 shell = ['sh']
-disabled = false
+disabled = true
 
 [custom.kaklsp_progress]
 description = "Show activity of kak-lsp if any"
@@ -66,7 +66,7 @@ format = " [ ]($style)"
 style = "fg:bright-white bold bg:default"
 when = '[ -n "$kak_opt_lsp_modeline_progress" ]'
 shell = ['sh']
-disabled = false
+disabled = true
 
 [git_branch]
 symbol = ""