diff options
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/put_blank_lines.vim | 24 | ||||
-rw-r--r-- | doc/put_blank_lines.txt | 2 | ||||
-rw-r--r-- | plugin/put_blank_lines.vim | 15 |
4 files changed, 18 insertions, 25 deletions
@@ -1 +1 @@ -3.1.0 +4.0.0 diff --git a/autoload/put_blank_lines.vim b/autoload/put_blank_lines.vim index 6251283..5d48193 100644 --- a/autoload/put_blank_lines.vim +++ b/autoload/put_blank_lines.vim @@ -1,19 +1,17 @@ -" Put lines above -function! put_blank_lines#Above() abort - set operatorfunc=put_blank_lines#AboveOpfunc +" Entry point +function! put_blank_lines#(above) abort + let &operatorfunc = 'put_blank_lines#' + \ . (a:above ? 'Above' : 'Below') return 'g@^' endfunction -function! put_blank_lines#AboveOpfunc(type) abort - silent put! =repeat(nr2char(10), v:count1) - ']+1 -endfunction -" Put lines below -function! put_blank_lines#Below() abort - set operatorfunc=put_blank_lines#BelowOpfunc - return 'g@^' +" Operator functions +let s:space = nr2char(10) +function! put_blank_lines#Above(type) abort + silent put! =repeat(s:space, v:count1) + ']+1 endfunction -function! put_blank_lines#BelowOpfunc(type) abort - silent put =repeat(nr2char(10), v:count1) +function! put_blank_lines#Below(type) abort + silent put =repeat(s:space, v:count1) '[-1 endfunction diff --git a/doc/put_blank_lines.txt b/doc/put_blank_lines.txt index 87076c4..46ae6a8 100644 --- a/doc/put_blank_lines.txt +++ b/doc/put_blank_lines.txt @@ -1,4 +1,4 @@ -*put_blank_lines.txt* For Vim version 7.0 Last change: 2018 July 13 +*put_blank_lines.txt* For Vim version 7.0 Last change: 2019 May 29 DESCRIPTION *put_blank_lines* diff --git a/plugin/put_blank_lines.vim b/plugin/put_blank_lines.vim index f779f46..6d08790 100644 --- a/plugin/put_blank_lines.vim +++ b/plugin/put_blank_lines.vim @@ -5,18 +5,13 @@ " Author: Tom Ryder <tom@sanctum.geek.nz> " License: Same as Vim itself " -if exists('loaded_put_blank_lines') || &compatible - finish -endif -if v:version < 700 +if exists('loaded_put_blank_lines') || &compatible || v:version < 700 finish endif let loaded_put_blank_lines = 1 " Set up mappings to autoloaded functions -nnoremap <expr> <silent> <unique> - \ <Plug>(PutBlankLinesBelow) - \ put_blank_lines#Below() -nnoremap <expr> <silent> <unique> - \ <Plug>(PutBlankLinesAbove) - \ put_blank_lines#Above() +nnoremap <expr> <Plug>(PutBlankLinesBelow) + \ put_blank_lines#(0) +nnoremap <expr> <Plug>(PutBlankLinesAbove) + \ put_blank_lines#(1) |