Commit c24139a
Eric Bower
·
2026-10-14 09:15:41 -0400 EDT
parent 5e93e06
chore: cleanup
1 files changed,
+0,
-64
+0,
-64
| ... | ... | @@ -92,34 +92,6 @@ define-command delete-buffer-picker %{ | |
| 92 | 92 | } | |
| 93 | 93 | } | |
| 94 | 94 | ||
| 95 | - | # evaluate-commands %sh{ | |
| 96 | - | # if command -V kak-lsp >/dev/null 2>/dev/null ; then | |
| 97 | - | # kak-lsp --kakoune -s $kak_session | |
| 98 | - | # echo " | |
| 99 | - | # set-option global modelinefmt \"%opt{lsp_modeline} %opt{modelinefmt}\" | |
| 100 | - | # map global user <l> %{: enter-user-mode lsp<ret>} -docstring 'LSP commands' | |
| 101 | - | # map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder' | |
| 102 | - | # map global object d '<a-semicolon>lsp-diagnostic-object error warning<ret>' -docstring 'LSP errors and warnings' | |
| 103 | - | # map global object D '<a-semicolon>lsp-diagnostic-object error<ret>' -docstring 'LSP errors' | |
| 104 | - | # | |
| 105 | - | # hook global BufSetOption filetype=python %{ | |
| 106 | - | # set-option buffer lsp_servers %{ | |
| 107 | - | # [pyright] | |
| 108 | - | # command = 'pyright-langserver' | |
| 109 | - | # args = ['--stdio'] | |
| 110 | - | # root_globs = ['pyrightconfig.json', 'pyproject.toml', 'setup.py', 'setup.cfg', 'requirements.txt', 'Pipfile', '.git'] | |
| 111 | - | # } | |
| 112 | - | # lsp-enable-window | |
| 113 | - | # } | |
| 114 | - | # hook global WinSetOption filetype=(python|go|javascript|typescript|zig) %{ | |
| 115 | - | # lsp-enable-window | |
| 116 | - | # } | |
| 117 | - | # " | |
| 118 | - | # else | |
| 119 | - | # echo "echo -debug kak-lsp not found in PATH" | |
| 120 | - | # fi | |
| 121 | - | # } | |
| 122 | - | ||
| 123 | 95 | set-option global ctagscmd 'ctags-project' | |
| 124 | 96 | set-option global ctagsfiles 'tags' 'tags_deps' | |
| 125 | 97 | map global user d '<a-i>w: ctags-search<ret>' -docstring 'ctags jump to definition' |
| ... | ... | @@ -149,42 +121,6 @@ define-command ctags-file-symbols -docstring "Browse and jump to functions in cu | |
| 149 | 121 | } | |
| 150 | 122 | } | |
| 151 | 123 | ||
| 152 | - | # Override the stock ctags-search. The stock version jumps pattern-based tags | |
| 153 | - | # via a regex search that always lands on the FIRST match, so overloaded / | |
| 154 | - | # duplicate names (e.g. wayland's ~20 setHandler, all identical lines) collapse | |
| 155 | - | # to a single result. This version jumps by the exact `line:` extension field and | |
| 156 | - | # labels each item with its enclosing type (via tag-scope) plus line number, so | |
| 157 | - | # every overload is distinguishable and reachable, e.g. | |
| 158 | - | # setHandler: Surface @ line 4960 | |
| 159 | - | define-command -override ctags-search -params ..1 -docstring "Jump to a symbol's definition (line-accurate, lists overloads)" %[ | |
| 160 | - | require-module menu | |
| 161 | - | evaluate-commands %sh[ | |
| 162 | - | realpath() { ( cd "$(dirname "$1")"; printf "%s/%s\n" "$(pwd -P)" "$(basename "$1")" ) } | |
| 163 | - | export tagname="${1:-${kak_selection}}" | |
| 164 | - | eval "set -- $kak_quoted_opt_ctagsfiles" | |
| 165 | - | for candidate in "$@"; do | |
| 166 | - | [ -f "$candidate" ] && realpath "$candidate" | |
| 167 | - | done | awk '!x[$0]++' | while read -r tags; do | |
| 168 | - | printf '!TAGROOT\t%s\n' "$(realpath "${tags%/*}")/" | |
| 169 | - | readtags -e -n -t "$tags" "$tagname" | |
| 170 | - | done | tag-scope | awk -F '\t' ' | |
| 171 | - | /^!TAGROOT\t/ { tagroot = $2; next } | |
| 172 | - | { | |
| 173 | - | name = $1; path = $2 | |
| 174 | - | line = ""; scope = "" | |
| 175 | - | for (i = 4; i <= NF; i++) { if ($i ~ /^line:/) line = substr($i, 6); else if ($i ~ /^scope:/) scope = substr($i, 7) } | |
| 176 | - | if (line == "") next | |
| 177 | - | menu_item = name; gsub(/!/, "!!", menu_item) | |
| 178 | - | menu_info = (scope != "" ? scope " @ line " : "line ") line; gsub(/!/, "!!", menu_info) | |
| 179 | - | edit_path = path; if (edit_path !~ /^\//) edit_path = tagroot edit_path | |
| 180 | - | gsub(/!/, "!!", edit_path); gsub(/#/, "##", edit_path); gsub(/&/, "&&", edit_path); gsub(/\|/, "||", edit_path) | |
| 181 | - | out = out "%!" menu_item ": " menu_info "! %!evaluate-commands %# try %& edit -existing %|" edit_path "|; execute-keys %|" line "gx| & catch %& fail unable to find tag & # !" | |
| 182 | - | } | |
| 183 | - | END { print (length(out) == 0 ? "fail no such tag " ENVIRON["tagname"] : "menu -auto-single " out) } | |
| 184 | - | ' | |
| 185 | - | ] | |
| 186 | - | ] | |
| 187 | - | ||
| 188 | 124 | hook global WinCreate .* %{ | |
| 189 | 125 | ctags-enable-autoinfo | |
| 190 | 126 | } |