Skip to content

Instantly share code, notes, and snippets.

@MattDietz
Created August 15, 2012 20:23
Show Gist options
  • Save MattDietz/3363258 to your computer and use it in GitHub Desktop.
Save MattDietz/3363258 to your computer and use it in GitHub Desktop.
CTags setup
Install this:
http://vim.sourceforge.net/scripts/script.php?script_id=273
.vimrc setup:
""" ctags
map ,bt :!ctags -R . <CR>
""" Borrowed and adapted from github.com/tr3buchet
fun GenPythonCTags()
let result = system('ctags -R -f ~/.ctags/python_usr_lib /usr/local/lib/python2.6')
let result = system('ctags -R -f ~/.ctags/python_std_lib /usr/lib/python2.6')
echo "Finished generating python ctags"
endfun
fun GenCTags()
let path = system('git rev-parse --show-toplevel | tr -d "\n"')
if v:shell_error
echo "not a git or bzr repo"
return 0
endif
let result = system('ctags --exclude=*tox --exclude=*git -R -f ' . path . '/tags ' . path)
echo "Generated tags completed. Tags file placed in " . path
endfun
set tags=~/.ctags/python_std_lib,~/.ctags/python_usr_lib,tags;$HOME
nnoremap <silent> <F2> :call GenCTags()<cr>
""" Opens the tag under the cursor in a vsplit
nnoremap <F4> :vsp <cr>:exec("tag ".expand("<cword>"))<cr>
nnoremap <F5> :split <cr>:exec("tag ".expand("<cword>"))<cr>
""" Mapping for the tags list plugin
nnoremap ,tl :TlistToggle<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment