From 8f5b3443db00f4de1b0c947bea604176a7ddaaf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Mon, 25 May 2026 00:01:54 +0200 Subject: [PATCH] kakoune: add ctags file and project symbols --- kakoune/.config/kak/kakrc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kakoune/.config/kak/kakrc b/kakoune/.config/kak/kakrc index 92ab765..5cf00cb 100644 --- a/kakoune/.config/kak/kakrc +++ b/kakoune/.config/kak/kakrc @@ -27,6 +27,8 @@ map global -docstring 'Open (recent)' file-mode 'r' ': file-open-recent' map global -docstring 'Open (nnn)' file-mode 'n' ': nnn-open %val{buffile}' map global -docstring 'Open (nnn)' file-mode 'N' ': nnn-open .' map global -docstring 'Open/create in dir' file-mode 'c' ': open-create-in-dir' +map global -docstring 'ctags file symbols' file-mode 's' ': ctags-file-symbols' +map global -docstring 'ctags project symbols' file-mode 'p' ': ctags-project-symbols' declare-user-mode git-mode map global -docstring 'Git' user 'g' ': enter-user-mode git-mode' @@ -120,6 +122,22 @@ define-command -override git-hide-diff %{ git hide-diff } +define-command -override ctags-file-symbols %{ + prompt -menu -shell-script-candidates %{ + ctags -uo - -x $kak_buffile | awk '{ print $1 ":" $2 ":" $3 }' + } 'File symbols: ' %{ + evaluate-commands %sh{ printf '%s\n' $kak_text | awk -F ':' '{ print "execute-keys", $3, "g", "/\\b" $1 "\\b" }' } + } +} + +define-command -override ctags-project-symbols %{ + prompt -menu -shell-script-candidates %{ + git ls-files | xargs ctags -uo - -x | awk '{ print $1 ":" $2 ":" $3 ":" $4 }' + } 'Project symbols: ' %{ + evaluate-commands %sh{ printf '%s\n' $kak_text | awk -F ':' '{ print "edit --", $4, $3 "; execute-keys /\\b" $1 "\\b" }' } + } +} + set-face global JumpLabel 'rgb:faf8f5,rgb:af8842+F' # CHANGE STATUS BAR COLOR IN INSERT MODE