aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-28 23:07:20 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-28 23:07:20 +1200
commit2ed276c5e70bb3dabcb86a57e22c3703d9b44cd1 (patch)
treebeb4c1994389c5c751d916f5d9e665174dac1767
parentMerge branch 'release/v0.2.0' (diff)
parentBump VERSION (diff)
downloadvim-foldlevelstart-stdin-master.tar.gz
vim-foldlevelstart-stdin-master.zip
Merge branch 'release/v1.0.0'HEADv1.0.0master
* release/v1.0.0: Pare down to single command
-rw-r--r--VERSION2
-rw-r--r--doc/foldlevelstart_stdin.txt8
-rw-r--r--plugin/foldlevelstart_stdin.vim16
3 files changed, 7 insertions, 19 deletions
diff --git a/VERSION b/VERSION
index 0ea3a94..3eefcb9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.0
+1.0.0
diff --git a/doc/foldlevelstart_stdin.txt b/doc/foldlevelstart_stdin.txt
index 33a48f6..0e9b95c 100644
--- a/doc/foldlevelstart_stdin.txt
+++ b/doc/foldlevelstart_stdin.txt
@@ -1,15 +1,13 @@
-*foldlevelstart_stdin.txt* For Vim version 7.0 Last change: 2018 Aug 16
+*foldlevelstart_stdin.txt* For Vim version 7.0 Last change: 2019 May 28
DESCRIPTION *foldlevelstart_stdin*
This tiny plugin sets 'foldlevel' to 'foldlevelstart' after reading from
-standard input, which Vim doesn't do by default.
+standard input with |--|, which Vim doesn't do by default.
REQUIREMENTS *foldlevelstart_stdin-requirements*
-This plugin only loads if 'compatible' is not set. It requires the |+autocmd|
-and |+folding| features, with the |StdinReadPre| event introduced in
-|version7|.
+This plugin only loads if 'compatible' is not set.
AUTHOR *foldlevelstart_stdin-author*
diff --git a/plugin/foldlevelstart_stdin.vim b/plugin/foldlevelstart_stdin.vim
index 37caddc..7e3531c 100644
--- a/plugin/foldlevelstart_stdin.vim
+++ b/plugin/foldlevelstart_stdin.vim
@@ -5,24 +5,14 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('loaded_foldlevelstart_stdin') || &compatible
- finish
-endif
-if !has('autocmd') || !has('folding') || !exists('##StdinReadPre')
+if exists('loaded_foldlevelstart_stdin') || &compatible || v:version < 700
finish
endif
let loaded_foldlevelstart_stdin = 1
-" Check if 'foldlevelstart' is non-negative, and set 'foldlevel' to its value
-" if it is
-function! s:SetFoldlevel() abort
- if &foldlevelstart >= 0
- let &l:foldlevel = &foldlevelstart
- endif
-endfunction
-
" Watch for stdin reads and set fold level accordingly
augroup foldlevelstart_stdin
autocmd!
- autocmd StdinReadPre * call s:SetFoldlevel()
+ autocmd StdinReadPre *
+ \ let &l:foldlevel = max([&foldlevelstart, &g:foldlevel, 0])
augroup END