]> Freerunner's - dotfiles.git/commitdiff
kak: update config
authorAndre Ramnitz <tux.rising@gmail.com>
Sat, 16 Dec 2023 18:47:09 +0000 (19:47 +0100)
committerAndre Ramnitz <tux.rising@gmail.com>
Sun, 18 Aug 2024 16:18:52 +0000 (18:18 +0200)
.gitmodules
kak/.config/kak/kakrc
kak/.config/kak/plugins/bookmarks.kak
kak/.config/kak/plugins/kakoune-find [new submodule]
kak/.config/kak/plugins/powerline.kak [deleted submodule]
kak/.config/kak/plugins/tabs.kak [new submodule]

index 0d7408aff775d6d40dd8814caf4ba12ec1d59add..9f126a68d1340d1416fe40803d4eed4d0c2045c3 100644 (file)
@@ -6,10 +6,6 @@
        path = kak/.config/kak/plugins/plug.kak
        url = https://github.com/andreyorst/plug.kak
        branch = master
-[submodule "powerline.kak"]
-       path = kak/.config/kak/plugins/powerline.kak
-       url = https://github.com/andreyorst/powerline.kak
-       branch = master
 [submodule "shellcheck.kak"]
        path = kak/.config/kak/plugins/shellcheck.kak
        url = https://github.com/whereswaldon/shellcheck.kak
        path = kak/.config/kak/plugins/dabruin.kak
        url = https://git.sr.ht/~nasmevka/dabruin.kak
        branch = main
+[submodule "kakoune-find"]
+       path = kak/.config/kak/plugins/kakoune-find
+       url = https://github.com/occivink/kakoune-find
+       branch = master
+[submodule "kakounse-tabs"]
+       path = kak/.config/kak/plugins/tabs.kak
+       url = https://github.com/enricozb/tabs.kak
+       branch = main
index cffc58bd9af514b683de0593bcbe0b1d05de7763..e97a433d8d84f7cc68088cb2cbd0e82c6d2e5b62 100644 (file)
@@ -10,21 +10,9 @@ eval %sh{ kks init }
 # ─────────────────────
 source "%val{config}/plugins/plug.kak/rc/plug.kak"
 plug "andreyorst/plug.kak" noload
-
-    plug "andreyorst/powerline.kak" defer powerline %{
-        powerline-format global 'mode_info git bufname filetype client session line_column position'
-    } defer powerline_bufname %{
-        set-option global powerline_shorten_bufname 'short'
-    } defer powerline_freerunner %{
-        powerline-theme freerunner
-    } config %{
-        powerline-start
-    }
-
     plug "Ersikan/bookmarks.kak" %{
         hook global WinCreate .* bookmarks-enable
     }
-
     plug "andreyorst/smarttab.kak" defer smarttab %{
         # when 'backspace' is pressed, 4 spaces are deleted at once
        set-option global softtabstop 4
@@ -36,11 +24,16 @@ plug "andreyorst/plug.kak" noload
     plug "whereswaldon/shellcheck.kak"
     plug "kakounedotcom/prelude.kak"
     plug "occivink/kakoune-sudo-write"
+    plug "occivink/kakoune-find"
     plug "foot.kak"
     plug "https://git.sr.ht/~nasmevka/dabruin.kak"
+    plug "https://github.com/enricozb/tabs.kak"
 
 # Look and Feel
 # ─────────────
+set-option global tabs_modelinefmt '%val{cursor_line}:%val{cursor_char_column} {{mode_info}} '
+set-option global tabs_options --minified
+
 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
@@ -49,11 +42,6 @@ colorscheme dabruin
 set-option global tabstop 4
 set-option global indentwidth 4
 
-# run on file open
-hook global BufOpenFile .* %{
-    modeline-parse
-}
-
 # dynamic scrolloff
 # ─────────────────
 hook global WinCreate [^*].* %{
@@ -129,6 +117,8 @@ map -docstring 'select lines downwards' global normal X T<ret>Lx
 # see #inc
 map global normal <c-a> ': inc %val{count} +<ret>'
 map global normal <c-x> ': inc %val{count} -<ret>'
+map global normal Q q # map q to Q 
+map global normal q -docstring 'tabs mode' ': enter-user-mode tabs<ret>' # map q to tabs mode
 
 # default user mode
 # # ──────────
@@ -137,16 +127,21 @@ map global user -docstring 'disable autocomplete' A ': set-option -remove buffer
 map global user -docstring 'edit kakrc' e ': e ~/.config/kak/kakrc<ret>'
 map global user -docstring 'clean tabs and trailing whitespace in selections' c ': clean-selections<ret>'
 map global user -docstring 'clean tabs and trailing whitespace in the buffer' C ': clean-buffer<ret>'
-map global user -docstring 'next buffer' n ': buffer-next<ret>'
-map global user -docstring 'previous buffer' p ': buffer-previous<ret>'
-map global user -docstring 'comment-line' l ': comment-line<ret>'
+map global user -docstring 'buffer backward' b ': buffer-previous<ret>'
+map global user -docstring 'buffer forward' n ': buffer-next<ret>'
 map global user -docstring 'lint-buffer' L ': buffer *lint-output*<ret>'
 map global user -docstring 'relative line numbers enable' r ': add-highlighter window/nl number-lines -relative -hlcursor<ret>'
 map global user -docstring 'relative line numbers disable' R ': remove-highlighter window/nl<ret>'
 map global user -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap<ret>'
 map global user -docstring 'wrap disable' W ': remove-highlighter buffer/bw<ret>'
 
+# tabs user mode
+# # ──────────
+map global normal <c-p> -docstring 'kks mode'        ': enter-user-mode kks<ret>'
+
+
 # kks user mode
+# # ──────────
 declare-user-mode kks
 map global normal <c-p> -docstring 'kks mode'        ': enter-user-mode kks<ret>'
 map global kks f       -docstring 'files'            ': kks-connect terminal-popup kks-files<ret>'
@@ -164,3 +159,67 @@ set-option global foot_normal_flags ''
 set-option global foot_popup_flags '-a popup'
 set-option global foot_panel_cmd 'foot'
 
+# suspend and resume
+# # ──────────
+def suspend-and-resume \
+    -params 1..2 \
+    -docstring 'suspend-and-resume <cli command> [<kak command after resume>]: backgrounds current kakoune client and runs specified cli command.  Upon exit of command the optional kak command is executed.' \
+    %{ evaluate-commands %sh{
+
+    # Note we are adding '&& fg' which resumes the kakoune client process after the cli command exits
+    cli_cmd="$1 && fg"
+    post_resume_cmd="$2"
+
+    # automation is different platform to platform
+    platform=$(uname -s)
+    case $platform in
+        Darwin)
+            automate_cmd="sleep 0.01; osascript -e 'tell application \"System Events\" to keystroke \"$cli_cmd\" & return '"
+            kill_cmd="/bin/kill"
+            break
+            ;;
+        Linux)
+            automate_cmd="sleep 0.2; xdotool type '$cli_cmd'; xdotool key Return"
+            kill_cmd="/usr/bin/kill"
+            break
+            ;;
+    esac
+
+    # Uses platforms automation to schedule the typing of our cli command
+    nohup sh -c "$automate_cmd"  > /dev/null 2>&1 &
+    # Send kakoune client to the background
+    $kill_cmd -SIGTSTP $kak_client_pid
+
+    # ...At this point the kakoune client is paused until the " && fg " gets run in the $automate_cmd
+
+    # Upon resume, run the kak command is specified
+    if [ ! -z "$post_resume_cmd" ]; then
+        echo "$post_resume_cmd"
+    fi
+}}
+
+def for-each-line \
+    -docstring "for-each-line <command> <path to file>: run command with the value of each line in the file" \
+    -params 2 \
+    %{ evaluate-commands %sh{
+
+    while read f; do
+        printf "$1 $f\n"
+    done < "$2"
+}}
+
+def toggle-ranger %{
+    suspend-and-resume \
+        "ranger --choosefiles=/tmp/ranger-files-%val{client_pid}" \
+        "for-each-line edit /tmp/ranger-files-%val{client_pid}"
+}
+
+map global user f ': toggle-ranger<ret>' -docstring 'select files in ranger'
+
+
+# run on file open
+# ─────────────
+hook global BufOpenFile .* %{
+    modeline-parse
+}
+
index 2e92602eef5ed1717660689765b93583eecce099..a8ed9af060d6e5367ab54a6da6769d20d96be5c8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2e92602eef5ed1717660689765b93583eecce099
+Subproject commit a8ed9af060d6e5367ab54a6da6769d20d96be5c8
diff --git a/kak/.config/kak/plugins/kakoune-find b/kak/.config/kak/plugins/kakoune-find
new file mode 160000 (submodule)
index 0000000..09afcc8
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 09afcc8520d4c92928fe69da4c370b9979aa90d3
diff --git a/kak/.config/kak/plugins/powerline.kak b/kak/.config/kak/plugins/powerline.kak
deleted file mode 160000 (submodule)
index 7ce52bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 7ce52bc766eef25d43040b8651d85bb189bcb896
diff --git a/kak/.config/kak/plugins/tabs.kak b/kak/.config/kak/plugins/tabs.kak
new file mode 160000 (submodule)
index 0000000..ae66830
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit ae66830ffcc9b6a1ca58ebd4bb37ded58d3cdfdf