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

mkview saves folds incorrectly

Expand Messages
  • Dan
    Issue: views saved with mkview use normal instead of normal! commands to recreate folding, causing user-create key mappings to trigger. Steps to Reproduce:
    Message 1 of 1 , Aug 27, 2012
      Issue: views saved with mkview use "normal" instead of "normal!" commands to recreate folding, causing user-create key mappings to trigger.

      Steps to Reproduce:
      Put the following in your vimrc
      nnoremap z J
      autocmd BufWinLeave *.* mkview
      autocmd BufWinEnter *.* silent loadview

      In the commandline:
      vim ~/foo

      Insert this text:
      Test1
      Test1

      Test2
      Test2

      Fold the Test1 lines in one fold (enter visual mode, select them, then press zf)

      Save and exit.

      Open the file with vim again and observe how the file has changed to:
      Test1Test1

      Test2
      Test2

      If you open the view for that file (in ~/.vim/views/ by default), you will see there is a command:
      normal zc

      mkview should use normal! not normal for folding commands, otherwise mappings in the vimrc could be used (some folding operations seem to be done with normal!, but some aren't).

      --
      You received this message from the "vim_dev" 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.