0

I have two opening buffers and one has foldenable and foldmethod=indent, other has nofoldenable and foldmethod=syntax.

I need that when I move between buffers, each buffer has it own fold settings and for example a buffer keeps folded even I move to other buffer that has nofoldenable

Can we achieve this?

Vim 8.1 / Archlinux

0

We can achieve this by set setlocal for python file and nofoldenable in global in .vimrc.

| improve this answer | |
0

If by move between buffers you mean -- doing it with a single window (no splits) then the only(?) option is to use autocommands. As an example:

augroup fold_params | au!
    au BufRead,BufNewFile *.py :setl fdm=indent | setl foldenable
    au BufRead,BufNewFile *.c :setl fdm=syntax | setl nofoldenable
augroup end

Options foldmethod and foldenable are local to window so you have to redefine them as soon as you open other file/buffer in the same window.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.