Tuesday, November 2, 2010

Re: vim moving code block problem

On Nov 1, 4:51 am, "John Beckett" <johnb.beck...@gmail.com> wrote:
> Zhanglistar wrote:
> > Vim manual says that to move to the start of the outer block
> > use the "[[" command. But when I use "[[", it jumps to the
> > head of file, which is a C program. And I when I use "]]", it
> > jumps to the end of the C file.
>
> Vim is not a compiler and it has no idea where functions start
> and stop. Your code probably differs from the style expected by
> Vim, my guess being that your '{' is not in the left margin (see
> ':help 29.3').
>

Vim does, however, have a decent idea where {..} pairs start and end.
So as a workaround you could probably use [] or ][ (which you say are
working} followed by %.

Or, you could use vaB to select the entire {..} block, then aB again
as needed until you have the entire function. Then switch back and
forth from end to end using o.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment