tags:

views:

64

answers:

2

I'm wondering if there's a command in Vim I'm missing that does columnar motion. What I'm thinking of is common in some spreadsheets, where there's a key combination that will take you downward in the column to either the next blank cell, or if you're in a blank cell then it will take you to the next non-blank cell. Some text may illustate:

a-------
-------
-------
b-------

c-------
-------
-------
d-------


e-------
-------

What I'm looking for is most efficient way to move from a to b, from b to c, from c to d, from d to e. I know this can be done using / searches, but is there a more efficient way using something analous to the line-based motion commands? Seems like there should be, but I can't find it.

+2  A: 

Try this to jump between non-empty lines:

:nmap j /^.\+$<CR>
Sudhanshu
Sudhansu -- Thanks a lot, I may end up doing something like that. But I'd like to avoid messing with mappings if there's a good built-in way to make these movements.
Herbert Sitz
@Herbert - No, I don't think vim has any built in way to do it.
Sudhanshu
@Sudhansu -- Thanks, there's some comfort in knowing I'm not missing something. Now I guess question becomes merely, What is the best way to do it?
Herbert Sitz
+3  A: 

I'm not sure if this fits your request exactly but vim has sentence, paragraph, and section movement keys built-in. In your case, I think you probably want the paragraph ( '{' and '}' ) or section ( '[' and ']' ) motion keys.

Brian Phillips