Wednesday 2 May 2012

VIM - Markers, Folding & More

Yesterday I mentioned that navigating inside of files was slowing me down a little and today I wanted to focus on fixing that. Using this handy vim resource I’ve spent today really focusing on two things - code folding and setting markers.


At first I thought this would irritate me because everything became indented because python is very explicit abut it’s indentation, but it didn’t. Once I figured out that zc and zo could open and collapse multiple depths of code folding in a toggle-able manner I began to look past the minor irritation of losing the syntax highlighting in the folds.

Setting Markers

These confused me at first because there is no visual feedback to let you know that a marker has been set. I didn’t actually figure this out until I was lying in bed writing this blog post so I guess I’ll have to try again with markers tomorrow.

ctrl-o / ctrl-i

This was a happy accident and at first I thought that I discovered that these two shortcuts seem to cycle through open buffers - super cool I thought. I was wrong …

 :help ctrl-i 

But my serendipity paid off I found out that ctrl-i & ctrl-o actually jump backward and fowards through the jump list. This knowldge nugget lead me to the jump list –


I’m not sure what that’s handy for just yet, but knowing that it’s there and that VIM is noting where I jump to and from is very helpful. Especially since the focus of today was to learn how to move around inside a file more fluidly!

As an aside I also set up VIM to handle ejs today for a little side project I’m working on that will helps get the VIM movement keys hard programmed into your head to become second nature.

Another day, more learning achieved.