diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-17 22:40:31 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-17 22:40:31 +1200 |
commit | f2d595cf0f10eae715536397e226eb3241706af7 (patch) | |
tree | 42ca516c9bb82c175bba2e505c2991146f61b525 /plugin | |
parent | Version 0.2.0 (diff) | |
download | vim-put-blank-lines-f2d595cf0f10eae715536397e226eb3241706af7.tar.gz vim-put-blank-lines-f2d595cf0f10eae715536397e226eb3241706af7.zip |
Backport to 6.0v0.2.0
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/put_blank_lines.vim | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/plugin/put_blank_lines.vim b/plugin/put_blank_lines.vim index 09bb1b8..eed1d14 100644 --- a/plugin/put_blank_lines.vim +++ b/plugin/put_blank_lines.vim @@ -1,6 +1,6 @@ " " put_blank_lines.vim: Provide plugin maps to put blank lines above or below -" the current line. The guts of this is ripped straight out of Tim Pope's +" the current line. The guts of this is backported from Tim Pope's " unimpaired.vim plugin, and still uses repeat.vim if it can find it. " " Author: Tom Ryder <tom@sanctum.geek.nz> @@ -9,17 +9,28 @@ if exists('g:loaded_put_blank_lines') || &compatible finish endif +if v:version < 600 + finish +endif let g:loaded_put_blank_lines = 1 function! s:PutBlankLinesAbove(count) - silent put! =repeat(nr2char(10), a:count) - ']+1 + let l:i = 0 + while l:i < a:count + silent put! =nr2char(10) + let l:i = l:i + 1 + ']+1 + endwhile silent! call repeat#set("\<Plug>PutBlankLinesAbove", a:count) endfunction function! s:PutBlankLinesBelow(count) - silent put =repeat(nr2char(10), a:count) - '[-1 + let l:i = 0 + while l:i < a:count + silent put =nr2char(10) + let l:i = l:i + 1 + '[-1 + endwhile silent! call repeat#set("\<Plug>PutBlankLinesBelow", a:count) endfunction |