diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-02 14:54:16 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-02 14:54:16 +1200 |
commit | c25c045419bf818ff4a6474600e92a29f7ee7c99 (patch) | |
tree | 59c37b44f0e45c176bd69ba8fb872e2ecddf2793 /plugin | |
download | vim-put-blank-lines-c25c045419bf818ff4a6474600e92a29f7ee7c99.tar.gz vim-put-blank-lines-c25c045419bf818ff4a6474600e92a29f7ee7c99.zip |
Initial commitv0.1.0
Untimely ripp'd from unimpaired.vim (essentially) and repackaged.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/put_blank_lines.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plugin/put_blank_lines.vim b/plugin/put_blank_lines.vim new file mode 100644 index 0000000..09bb1b8 --- /dev/null +++ b/plugin/put_blank_lines.vim @@ -0,0 +1,32 @@ +" +" 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 +" unimpaired.vim plugin, and still uses repeat.vim if it can find it. +" +" Author: Tom Ryder <tom@sanctum.geek.nz> +" License: Same as Vim itself +" +if exists('g:loaded_put_blank_lines') || &compatible + finish +endif +let g:loaded_put_blank_lines = 1 + +function! s:PutBlankLinesAbove(count) + silent put! =repeat(nr2char(10), a:count) + ']+1 + silent! call repeat#set("\<Plug>PutBlankLinesAbove", a:count) +endfunction + +function! s:PutBlankLinesBelow(count) + silent put =repeat(nr2char(10), a:count) + '[-1 + silent! call repeat#set("\<Plug>PutBlankLinesBelow", a:count) +endfunction + +nnoremap <silent> <unique> + \ <Plug>PutBlankLinesAbove + \ :<C-U>call <SID>PutBlankLinesAbove(v:count1)<CR> + +nnoremap <silent> <unique> + \ <Plug>PutBlankLinesBelow + \ :<C-U>call <SID>PutBlankLinesBelow(v:count1)<CR> |