]> Freerunner's - dotfiles.git/commitdiff
kak: update config
authorAndre Ramnitz <tux.rising@gmail.com>
Mon, 10 Jun 2024 21:54:21 +0000 (23:54 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Sun, 18 Aug 2024 19:05:38 +0000 (21:05 +0200)
config/kak/kakrc
config/kak/plugins/powerline.kak [deleted submodule]
config/kak/plugins/shellcheck.kak [deleted submodule]

index 2c725d1b7482f3306afa30f4fbf0b587e7cac841..1612caf6bb463f21e19f6d440c43dbf858ad56c0 100644 (file)
@@ -15,7 +15,6 @@ hook global NormalKey y %{ nop %sh{
 # ──────────────────────────────────────────────────────────────────────────────
 hook global BufOpenFile .* %{
     modeline-parse
-    editorconfig-load
 }
 
 hook global BufCreate [^*].* %{
@@ -61,7 +60,6 @@ plug "andreyorst/plug.kak" noload
        hook global WinSetOption filetype=(makefile|gas) noexpandtab
        hook global WinSetOption filetype=(c|cpp) smarttab
     }
-    plug "whereswaldon/shellcheck.kak"
     plug "occivink/kakoune-sudo-write"
     plug "occivink/kakoune-find"
     plug "foot.kak"
@@ -77,6 +75,44 @@ plug "andreyorst/plug.kak" noload
     }
 
 
+# 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 window formatcmd 'npx prettier --parser css'
+    }  
+       hook global WinSetOption filetype=scss %{
+       set window formatcmd 'npx prettier --parser scss'
+    }  
+       hook global WinSetOption filetype=less %{
+       set window formatcmd 'npx prettier --parser less'
+    }  
+       hook global WinSetOption filetype=html %{
+       set window formatcmd 'npx prettier --parser html'
+    }  
+       hook global WinSetOption filetype=json %{
+       set window formatcmd 'npx prettier --parser json'
+    }  
+       hook global WinSetOption filetype=md %{
+       set window formatcmd 'npx prettier --parser md'
+    }
+    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'
+        set-option window lintcmd %{
+            run() {
+                # change [message-type] to message-type:
+                yamllint -f parsable "$1" | sed 's/ \[\(.*\)\] / \1: /'
+                } && run }
+    }  
+
+
 # Look and Feel
 # ──────────────────────────────────────────────────────────────────────────────
 add-highlighter global/trailing-whitespace regex '\h+$' 0:Error                         # trailing whitespaces in red
@@ -113,14 +149,14 @@ define-command clean-buffer -docstring 'Replace tabs with spaces and trim traili
     execute-keys -draft \%@s\h+$<ret>d
 } }
 # Bring back <c-a> and <c-x> 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"_/\d<ret><a-i>na' "$2($count)<esc>|{<space>cat<semicolon>echo<semicolon>}|bc<ret>"
-    }
-} catch %{
-    execute-keys l
-}}
+define-command -hidden -params 2 inc %{ try %{
+    evaluate-commands %sh{
+        [ "$1" = 0 ] && count=1 || count="$1"
+        printf '%s%s' 'exec h"_/\d<ret><a-i>na' "$2($count)<esc>|{<space>cat<semicolon>echo<semicolon>}|bc<ret>"
+    }
+} catch %{
+    execute-keys l
+}}
 
 
 # Various mappings
@@ -190,33 +226,3 @@ set-option global foot_panel_cmd 'foot'
 # ──────────────────────────────────────────────────────────────────────────────
 import languagecmd
 
-# Reload kakrc and .kak when saving.
-# ──────────────────────────────────────────────────────────────────────────────
-# Adds -override to definitions (unless they seem to be python defs!)
-# Evals provide module directly
-
-def resource -params 1 %{
-    eval %sh{
-        file=$(dirname "$1")/.reload.kak
-        cat "$1" |
-            sed 's/^def \([^:]*\)$/def -override \1/'   |
-            sed 's/^define-command /def -override /'    |
-            sed 's/^addhl /addhl -override/'            |
-            sed 's/^add-highlighter /addhl -override /' |
-            sed 's/^provide-module \w\+ /eval /'        |
-            cat > "$file"
-        printf %s "
-            source $file
-            nop %sh{
-                rm $file
-            }
-        "
-    }
-    echo Reloaded %arg{1}
-}
-
-rmhooks global reload-kak
-hook -group reload-kak global BufWritePost (.*kakrc|.*\.kak) %{
-     resource %val{hook_param}
-}
-
diff --git a/config/kak/plugins/powerline.kak b/config/kak/plugins/powerline.kak
deleted file mode 160000 (submodule)
index e5e9a0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e5e9a0e5734da8f7338ead7f55f9ed04f88adfc6
diff --git a/config/kak/plugins/shellcheck.kak b/config/kak/plugins/shellcheck.kak
deleted file mode 160000 (submodule)
index 4e63397..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 4e633978c119bbb71f215828f7b59cea71a2c5a4