-
Notifications
You must be signed in to change notification settings - Fork 715
Ctags
GavinSmith0123 edited this page Oct 20, 2022
·
4 revisions
Kakoune provides the ctags.kak
script, but this won't work with out of the box ctags from sourceforge.net. It relies on the readtags command that is available in universal-ctags, but not installed by default. The easiest way would be to use ctags from http://github.com/universal-ctags/ctags which will install the readtags command.
Use the following hook to search for a tags
file in the current directory, then parent directories, until found or the home or root directory is reached.
hook global KakBegin .* %{
evaluate-commands %sh{
path="$PWD"
while [ "$path" != "$HOME" ] && [ "$path" != "/" ]; do
if [ -e "./tags" ]; then
printf "%s\n" "set-option -add current ctagsfiles %{$path/tags}"
break
else
cd ..
path="$PWD"
fi
done
}
}
This is equivalent to vim's :set tags=./tags;
option.
This makes C-]
look up the symbol under the cursor, similarly to vim:
map global normal <c-]> <a-i>w:ctags-search<ret>
Use C-o
as usual to go back.
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV