For most programming, I use Vim as my text editor of choice. It has a steep learning curve, but is very efficient once you get accustomed to it. I’m far from an expert on Vim and I’m always learning new things. From time to time I will endeavor to post about these tips so others can benefit from my learning.
Often times when editing code in a function, one runs across a variable that’s type isn’t immediately obvious. Here’s a few navigation techniques I just discovered to help find out what the variable is:
gd – go to declaration. This starts at the top of the function/method and works down until it finds the declaration of the variable the cursor is on. Note that this will also highlight all instances of the variable, making it easy to pick it out in a crowd.
g, – go to last edit. When using something like gd, this helps you get back to where you were. g; will go forward to the “next” edit if you need to bounce between locations.