aboutsummaryrefslogtreecommitdiff
path: root/plugin/foldlevelstart_stdin.vim
blob: 5fe7454dc28c1b118ad8c2035d14a21604212458 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"
" foldlevelstart_stdin.vim: Set 'foldlevel' to 'foldlevelstart' after reading
" from standard input, which Vim doesn't do by default.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('loaded_foldlevelstart_stdin') || &compatible || v:version < 700
  finish
endif
let loaded_foldlevelstart_stdin = 1

" Watch for stdin reads and set fold level accordingly
augroup foldlevelstart_stdin
  autocmd!
  autocmd StdinReadPre *
        \ let &l:foldlevel = max([&foldlevelstart, 0])
augroup END