ctags – Jay R. Wren – lazy dawg evarlast http://jrwren.wrenfam.com/blog babblings of a computer loving fool Wed, 15 Feb 2017 02:57:57 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.2 ctags for golang and vim; just the right things with godeps http://jrwren.wrenfam.com/blog/2014/10/20/ctags-for-golang-and-vim-just-the-right-things-with-godeps/ http://jrwren.wrenfam.com/blog/2014/10/20/ctags-for-golang-and-vim-just-the-right-things-with-godeps/#comments Mon, 20 Oct 2014 15:33:37 +0000 http://jrwren.wrenfam.com/blog/?p=1141 Continue reading "ctags for golang and vim; just the right things with godeps"]]> I use vim.

I like to press ctrl-] to go to a tag and ctrl-t to pop up that tag stack.

I use ctags from homebrew to generate my tags file which vim reads. The OSX version of ctags is inadequate.

I often invoke ctags with -R . and a list of directory names to the libraries which I am using. When using ctags with python or C this works reasonably well, but I have to maintain the list of directories somewhere.

Go lets me handle this case slightly better.

godeps is a tool which does two things, in this case I only care about the first. godeps prints the source dependencies of named packages.

Combining godeps output and sending it to ctags means my tags file automatically has tokens from all of my dependent packages. I name this shell function goctags.

goctags () { godeps ./… | awk -v GOPATH=$GOPATH ‘{print GOPATH”/src/”$1}’ | xargs ctags -R .; }

I added it to my .bashrc.

]]>
http://jrwren.wrenfam.com/blog/2014/10/20/ctags-for-golang-and-vim-just-the-right-things-with-godeps/feed/ 2