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

Re: Fold all blocks without TODO in vim notes file

Expand Messages
  • Sepp Tannhuber
    Hi Salman, thanks for answering! ... With this method I can unfold block by block with hitting . Is it possible to automate this on startup so that vi
    Message 1 of 5 , Jul 3, 2012
    • 0 Attachment
      Hi Salman,

      thanks for answering!

      For now I use a simple key mapping:
      : map <C-f> <Esc>/TODO<CR>zo

      With this method I can unfold block by block with hitting <C-f>.
      Is it possible to automate this on startup so that vi hits <C-f> until it reaches
      end of file?

      Cheers
      Joseph:x

      --
      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
    • Salman Halim
      ... However, this is a one-time that will happen automatically when the ... This should work for both insert, visual and normal mode. In insert mode, it will
      Message 2 of 5 , Jul 3, 2012
      • 0 Attachment
        On Tue, Jul 3, 2012 at 6:08 PM, Sepp Tannhuber <sepp.tannhuber@...> wrote:
        > Hi Salman,
        >
        > thanks for answering!
        >
        > For now I use a simple key mapping:
        > : map <C-f> <Esc>/TODO<CR>zo
        >
        > With this method I can unfold block by block with hitting <C-f>.
        > Is it possible to automate this on startup so that vi hits <C-f> until it reaches
        > end of file?
        >
        > Cheers
        > Joseph:x

        You could just do something like:

        :au BufRead <TheFileName> g/TODO/foldopen!

        However, this is a one-time that will happen automatically when the
        file is opened; for a mapping, I would do:

        :map <c-f> :g/TODO/foldopen!
        :imap <c-f> <c-o><c-f>

        This should work for both insert, visual and normal mode. In insert
        mode, it will return you to insert mode after the mapping and, in
        visual mode, it will limit the effect to the visually selected region.

        For help on autocommands, try :help :au, :help BufRead, :help :g and
        :help :foldopen.

        Salman

        --
        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
      • Sepp Tannhuber
        Hi Salman, thank you very much! I did it with your help. I added your key mappings ... to my ~/.vim/ftplugin/notes.vim and made a keyboard shortcut ... for my
        Message 3 of 5 , Jul 4, 2012
        • 0 Attachment
          Hi Salman,

          thank you very much! I did it with your help. I added your key mappings
          > map <C-f> :g/TODO/foldopen!<CR>
          > imap <C-f> <C-o><C-f>
          to my ~/.vim/ftplugin/notes.vim and made a keyboard shortcut
          > vi notes -c 'set foldenable' -c 'set foldlevel=0' -c 'g/TODO/foldopen!'
          for my window manager. This does exactly what I want.


          Thank you
          Sepp

          --
          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.