Iterate over column search results

Is there a way in Vim (or the plugin) to search for a term and iterate over the search results (by nin Vim) by column rather than row? So, if my file was like this:

foo1  bar   bar
baz   baz   foo3
baz   baz   foo4
foo2  bar   bar

If I search foo, I want to iterate the results in the order 1,2,3,4. Usually it nwill move me through them in the order of 1,3,4,2.

I want this, for example, to look up search results in a huge fixed-width data file or CSV file where the columns represent fields.

(I also agree to do this in Emacs instead. :)

+3
source share
2 answers

, vim- . vim, , , . , .

vim.org: SearchCols.vim

, multvals : multvals.vim

:SearchCols <string>, <string> , , .. vim. @:, @@, .

:

  • , , .. , .
  • , , .

, , , @: @@, ( , , :match, :match none, ), multvals.vim.

+3

EDIT: vim . , ( )):

^foo , .*\ foo , .*\ .*\ foo .

, , , , foo3 foo4, 0.

. :

qa/.*\ .*\ foo
/foo
q

( , , ).

a (qa a, qb b ..). @a ....

, , , , :)

+2

Source: https://habr.com/ru/post/1703203/


All Articles