From 5560e429ad8711dd46fc500fddcfe596e89ba23b Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 6 Nov 2019 21:15:02 +0300 Subject: [PATCH] .vimrc: .ctags recursive search --- .vimrc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.vimrc b/.vimrc index 5b87dee..820fb4d 100644 --- a/.vimrc +++ b/.vimrc @@ -151,11 +151,24 @@ function! ToggleMyFontSize() endfunction nnoremap :call ToggleMyFontSize() -" теги -set tags+=./.ctags -set tags+=~/.big/ctags -cscope add ./.cscope -cscope add ~/.big/cscope +" ctags +let local_tags = ".ctags" +let local_path = "/" +let current_path = getcwd() +" If the current path is a child of $HOME directory, start from $HOME +if current_path =~ $HOME + let local_path = $HOME . local_path + let current_path = substitute(current_path, $HOME, '', "") +endif +let path_parts = split(current_path, "/") +for path_part in path_parts + let local_path = local_path . path_part . "/" + if filereadable(local_path . local_tags) + exe ":set tags+=" . local_path . local_tags + endif +endfor +unlet local_tags local_path current_path path_parts + map [I:let nr = input("Which one: ")exe "normal " . nr ."[\t" " Foldging