From 67aa3468f4205c5b793be6d7dec9cf35c30506cd 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-symbols --- kakoune/.config/kak/kakrc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kakoune/.config/kak/kakrc b/kakoune/.config/kak/kakrc index 92ab765..77867c4 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,23 @@ 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 %{ + ctags -uo - -x $(git ls-files | grep $(printf "%s\n" $kak_buffile | awk -F '.' '{print "\\." $NF}')) | awk '{ print $1 ":" $2 ":" $3 ":" $4 }' + } 'File symbols: ' %{ + edit -- %sh{ printf '%s\n' $kak_text | awk -F ':' '{ print $4 }' } %sh{ printf '%s\n' $kak_text | awk -F ':' '{ print $3 }' } + evaluate-commands %sh{ printf '%s\n' $kak_text | awk -F ':' '{ print "execute-keys /\\b" $1 "\\b" }' } + } +} + set-face global JumpLabel 'rgb:faf8f5,rgb:af8842+F' # CHANGE STATUS BAR COLOR IN INSERT MODE