Vertical threads and folding in gvim

I'm having problems with auto splitting and folding. In my ~ / .gvimrc file, at the very end, I have a command vsplit

, so when I use gvim and not vim, it opens with two panes. The problem occurs when I open a file that is usually folded through the command line like in gvim example.cpp

. This opens the example.cpp file in two panes; however, the first panel folds and the second does not. This is a minor annoyance, but I wondered if anyone has a suggestion to get the second (or all) buffers to collapse when the window appears.

If it matters, I am using set foldmethod=indent

~ / .vimrc in my file and my version is 7.1.

0


a source to share


1 answer


This is very strange, this is also happening here, I guess the error must be an error because the other settings are valid in the second panel except for the parameter 'foldmethod'

.

Anyway, I found an easy workaround. I have this at the end of mine .vimrc

, and what you are looking for now works on my vim:

set foldmethod=indent
set sw=2
set tw=2

vsplit +edit

      



Now when I open the file the window splits in two and both fold correctly.

The workaround runs the ex command :edit

in the second pane so that the missing settings (though it seems to be only missing 'foldmethod'

) are reloaded. What does +edit

after vsplit

.

Hope this solves your problem.

+1


a source







All Articles