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

12391Svar: Re: Svar: Folding

Expand Messages
  • Dan Michael
    Jun 4, 2011
    • 0 Attachment
      fredag 3. juni 2011 kl. 15:37:57 UTC+2 skrev Eric Weir følgende:

      On Jun 2, 2011, at 10:55 AM, Eric Weir wrote:

      After inserting these lines when starting Vim or creating a new tab I get this error message:

      Error detected while processing BufWinEnter Auto commands for "*":
      E32: No file name   

      This is because vim naively tries to load the view for an empty buffer, but of course no saved view exists for the empty buffer. The same happens when you open a help page. There is no saved view for the help pages, so you will get an error. One simple solution is to use "silent!" instead of "silent". This will silence any error message. My preferred solution is to instead to save views only for files of certain extensions (since mkview saves a lot of things, not just folds, and sometimes you just don't want it all saved). So, for instance,

      autocmd BufWinLeave *.txt mkview
      autocmd BufWinEnter *.txt silent loadview

      And you could also use

      autocmd BufWinLeave *.* mkview
      autocmd BufWinEnter *.* silent loadview
       
      for it to work with all files with a file extension.

      And when I open a file, I get the following message:

      Error detected while processing BufWinLeave Auto commands for "*":

      After that, when i hit <return> the file opens folded.

      Try disabling all plugins and clean your .vimrc file, and see if it still happens. You may also have to clean your ~/.vim/views folder, which is where the views are saved (but then you will loose the folds). 

      Then please see :h viewoptions . As you see, a lot of things about the state of the file are saved with mkview, not only folds. It may be a very good idea to only save the things you need, like e.g. :set viewoptions=folds,cursor 

      Good luck further! But please try to avoid quadruple-posting next time.

      – Dan Michael

      --
      You received this message from the "vim_mac" 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
    • Show all 15 messages in this topic