如果我有一块用vim折叠的css或js,当在它上面添加一个新块时,该块就会被展开。
目前,我只是在我的vimrc
中有这个autocmd FileType css,scss setlocal foldmethod=marker
autocmd FileType css,scss setlocal foldmarker={,}
有没有办法禁用它?
请:h fold
并检查,但也想问这里。
答案 0 :(得分:2)
直接从vim wiki添加到vimrc
:http://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