mikejsavage.co.uk • About • Archive • RSS • Thanks for blocking ads! Blocking ads owns: AdGuard for Safari / uBlock Origin for everything else
Visual Studio has this awesome thing called "Peek Definition", which lets you open a temporary window that shows you the definition of whatever you wanted to look at. That link has a screenshot so you can see what I mean.
I have something similar but crappier working in Vim. You need to go through the stupid ctags hoops, ATM I am using vim-gutentags which actually seems pretty good. Then you can do something like
map <C-]> :vsplit<CR>:execute "tag " . expand( "<cword>" )<CR>zz<C-w>p
and then press C-] to get an unfocused vsplit at the definition of whatever the cursor was over.
It's not as good because if it can't find the tag you get a vsplit of
whatever you were looking at. It totally fails on member functions (like
size
) because ctags doesn't understand C++. With functions it asks you
whether you want to jump to the body or the prototype, when you probably
always just want to jump to the prototype. That last one might be
fixable if I tweak the flags to ctags but meh.