From: Andre Ramnitz Date: Mon, 11 Dec 2023 22:27:09 +0000 (+0100) Subject: kak: add kks integration X-Git-Tag: v0.2~344 X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=20338ad3f9d7085cdf83d2cc855b1035e2e680cb;p=dotfiles.git kak: add kks integration --- diff --git a/kak/.config/kak/kakrc b/kak/.config/kak/kakrc index 25233298..5b0f4c8f 100644 --- a/kak/.config/kak/kakrc +++ b/kak/.config/kak/kakrc @@ -3,6 +3,37 @@ hook global RegisterModified '"' %{ nop %sh{ printf %s "$kak_main_reg_dquote" | xsel --input --clipboard }} +# Kakoune shell integration, see https://github.com/kkga/kks +eval %sh{ kks init } + +# 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 "andreyorst/smarttab.kak" defer smarttab %{ + # when 'backspace' is pressed, 4 spaces are deleted at once + set-option global softtabstop 4 + } config %{ + hook global WinSetOption filetype=(rust|markdown|kak|lisp|scheme|py|sh|perl) expandtab + hook global WinSetOption filetype=(makefile|gas) noexpandtab + hook global WinSetOption filetype=(c|cpp) smarttab + } + plug "whereswaldon/shellcheck.kak" + plug "kakounedotcom/prelude.kak" + plug "occivink/sudo-write.kak" + plug "foot.kak" + # Look and Feel # ───────────── add-highlighter global/trailing-whitespace regex '\h+$' 0:Error # trailing whitespaces in red @@ -78,23 +109,6 @@ define-command -hidden -params 2 inc %{ try %{ 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 # ──────────────── @@ -106,7 +120,7 @@ map -docstring 'select lines downwards' global normal X TLx map global normal ': inc %val{count} +' map global normal ': inc %val{count} -' -# User modes +# default user mode # # ────────── 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' @@ -122,32 +136,20 @@ map global user -docstring 'relative line numbers disable' R ': remove-highlight map global user -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap' map global user -docstring 'wrap disable' W ': remove-highlighter buffer/bw' -# 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 "andreyorst/smarttab.kak" defer smarttab %{ - # when 'backspace' is pressed, 4 spaces are deleted at once - set-option global softtabstop 4 - } config %{ - hook global WinSetOption filetype=(rust|markdown|kak|lisp|scheme|py|sh|perl) expandtab - hook global WinSetOption filetype=(makefile|gas) noexpandtab - hook global WinSetOption filetype=(c|cpp) smarttab - } - plug "whereswaldon/shellcheck.kak" - plug "kakounedotcom/prelude.kak" - plug "occivink/sudo-write.kak" - -# PLUGin ends +# kks user mode +declare-user-mode kks +map global normal -docstring 'kks mode' ': enter-user-mode kks' +map global kks f -docstring 'files' ': kks-connect terminal-popup kks-files' +map global kks F -docstring 'files (all)' ': kks-connect terminal-popup kks-files -HI' +map global kks g -docstring 'git files' ': kks-connect terminal-popup kks-git-files' +map global kks b -docstring 'buffers' ': kks-connect terminal-popup kks-buffers' +map global kks / -docstring 'live grep' ': kks-connect terminal-popup kks-grep' +map global kks l -docstring 'lines in buffer' ': kks-connect terminal-popup kks-lines' +map global kks r -docstring 'recent files' ': kks-connect terminal-popup kks-mru' +map global kks -docstring 'filetypes' ': kks-connect terminal-popup kks-filetypes' + +set-option global foot_normal_cmd 'foot' +set-option global foot_popup_cmd 'foot' +set-option global foot_popup_flags '--app-id=popup' +set-option global foot_panel_cmd 'foot'