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

136755Re: ":new" creates buffer window with foldcolumns > 0

Expand Messages
  • Ben Fritz
    Mar 15, 2013
    • 0 Attachment
      On Thursday, March 14, 2013 6:13:10 PM UTC-5, Paul wrote:
      > In a window with nofoldenable and foldcolumn=0, I issue the
      >
      > command :new. This creates a window that has foldcolumn=5. Two of my
      >
      > other windows have foldcolumn=5, but why would the new window have
      >
      > this?
      >

      'foldcolumn' has both a global and a local value. When you create a new widow, the local value of the option is initialized to the global value. You can use :setlocal to set only the local value without affecting the global value, or :setglobal for the reverse.

      You probably created you windows something like this:

      :set foldcolumn=0
      :new
      :set foldcolumn=5
      :wincmd p
      :new

      This will create the new window with foldcolumn of 5, because you used :set, which sets both the global and the local value.

      If you use this instead, the new window will have foldcolumn of 0:

      :set foldcolumn=0
      :new
      :setlocal foldcolumn=5
      :wincmd p
      :new

      Also this:

      :set foldcolumn=0
      :new
      :set foldcolumn=5
      :setglobal foldcolumn=0
      :wincmd p
      :new

      I'd actually suggest putting a :setglobal in your .vimrc for the preferred default setting, and always using :setlocal to set individual windows.

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 4 messages in this topic