开发者

vim: auto-expand only fold in .pm file after loading file?

开发者 https://www.devze.com 2023-04-05 17:19 出处:网络
Here is my entire .vimrc: set ignorecase set scs let perl_fold=1 hi Folded cterm=bold ctermfg=yellow ctermbg=lightblue

Here is my entire .vimrc:

set ignorecase
set scs
let perl_fold=1
hi Folded cterm=bold ctermfg=yellow ctermbg=lightblue
set modeline
set hidden

When loading a .pm file (which usually contains just a single package), all of the file's code is folded into a single line, and the first thing I have to do is to expand that fold.

Is there a way to have vim automatically expand that fold after loading the file? I em envisioning some sort of post-load hook which would allow me to say if the entire file (or more than 90%) is folded into a single line, then automatically expand that fold. (The "more than X %" condition might be needed if there are blank lines at the beginning of the file since they don't get folded开发者_如何学JAVA.)


You could try (in your vimrc:

au BufReadPost *.pm normal zo

For reference: :help :autocmd, :help BufReadPost

0

精彩评论

暂无评论...
验证码 换一张
取 消