I have my projects in /srv/http/dev folder. I generated ctags file for one project:
$ ctags -R --languages=php .
Now I set ctags path:
:set tags=/srv/http/dev/proj/tags
And it's working fine.
But I have many projects in dev/ folder. How can I set ctags in .vimrc file? set tags=tags
not working properly.
And I would like to generate tags file by pressing hotkey on selected NERDTree folder. I tried:
nmap <silent> <F4>
\ :!ctags -R
\ --languages=php .<CR>
But it creates tags file in home folder and shows warnings about scanning home folder..
EDIT: As @Alexandru Plugaru advised I should use g:NERDTreeFileNode.GetSelected() function.
I am just newbie vim user, so I have one more question. I have added in my .vimrc file:
function createTags()
let curNodePath = g:NERDTreeFileNode.GetSelected().path.str
exec ':!ctags -R --languages=php ' . curNodePath
endfunction
nmap <silent> <F4> :execute createTags()<CR>
But by pressing on F4 I see:
E117: Unknown function: createTags
E15: Invalid expression: createTags
EDIT 2: Thanks to @Alexandru Plugaru I got this:
function CreateTags()
let curNodePath = g:NERDTreeFileNode.GetSelected().path.str()
exec ':!ctags -R --languages=php -f ' . curNodePath . '/tags ' . curNodePath
endfunction
nmap <silent> <F4> :call CreateTags()<CR>
And it works! By pressing F4 I get tags file in project folder.