tags:

views:

107

answers:

3

When searching for text in Vim (specifically gVim, but it shouldn't matter), how do you specify what column to search? I'm looking for values in one column only.

+3  A: 

If you're talking about character columns, then you might have luck with /^.\{33\}mytext/ which will search your file for 'mytext' beginning at column 34. Note that the number in the search is one less than the column you want (it's matching 33 characters of anything at the beginning of the line, followed by your text).

roe
+2  A: 

You could use some sort of visual selection and then :/(searchterm) to find what you're looking for. For instance CTRL+V allows you to do column selections, then with everything selected do :/(term) <enter>.

cmjreyes
+5  A: 

Even, if I tend to use the same solution as roe, you can also use \%c -> :h /\%c

Luc Hermitte
I think this is the best answer of the lot. %c was specifically made for specifying columns in regexps.
Carl Smotricz