Loading ...
Sorry, an error occurred while loading the content.
 

RE: [HELP] vim moving code block problem

Expand Messages
  • John Beckett
    ... 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
    Message 1 of 3 , Nov 1, 2010
      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').

      John

      --
      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
    • Ben Fritz
      ... 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}
      Message 2 of 3 , Nov 2, 2010
        On Nov 1, 4:51 am, "John Beckett" <johnb.beck...@...> 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
      Your message has been successfully submitted and would be delivered to recipients shortly.