Vim折叠用新标记扩展

时间:2015-09-05 23:25:25

标签: vim

如果我有一块用vim折叠的css或js,当在它上面添加一个新块时,该块就会被展开。

目前,我只是在我的vimrc

中有这个
autocmd FileType css,scss setlocal foldmethod=marker
autocmd FileType css,scss setlocal foldmarker={,}

Vim-fold issue

有没有办法禁用它? 请:h fold并检查,但也想问这里。

1 个答案:

答案 0 :(得分:2)

直接从vim wiki添加到vimrchttp://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text

" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif