diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-05 11:31:04 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-05 11:31:04 +1200 |
commit | c31c7ed2df3d3cea91d981e8bde922f0836710ef (patch) | |
tree | bca6ccb91f7d8bb9eb39381c0792d9732d91ae83 /vim/ftplugin | |
parent | Merge branch 'release/v0.46.0' into develop (diff) | |
download | dotfiles-c31c7ed2df3d3cea91d981e8bde922f0836710ef.tar.gz dotfiles-c31c7ed2df3d3cea91d981e8bde922f0836710ef.zip |
Pass in mapped key directly, not a flag
This seems obvious now.
Diffstat (limited to 'vim/ftplugin')
-rw-r--r-- | vim/ftplugin/markdown/autoformat.vim | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/vim/ftplugin/markdown/autoformat.vim b/vim/ftplugin/markdown/autoformat.vim index 80bd034c..a76735d9 100644 --- a/vim/ftplugin/markdown/autoformat.vim +++ b/vim/ftplugin/markdown/autoformat.vim @@ -63,17 +63,13 @@ augroup END " Suspend auto-format when pasting anything with a linebreak if !exists('*s:Put') - function! s:Put(above) abort + function! s:Put(key) abort let l:suspended = 0 if &formatoptions =~# '\ma' && getreg() =~# '\m\n' setlocal formatoptions-=a let l:suspended = 1 endif - if a:above - execute 'normal! "'.v:register.v:count1.'P' - else - execute 'normal! "'.v:register.v:count1.'p' - endif + execute 'normal! "'.v:register.v:count1.a:key if l:suspended setlocal formatoptions+=a endif @@ -81,10 +77,10 @@ if !exists('*s:Put') endif nnoremap <buffer> <silent> \ p - \ :<C-u>call <SID>Put(0)<CR> + \ :<C-u>call <SID>Put('p')<CR> nnoremap <buffer> <silent> \ P - \ :<C-u>call <SID>Put(1)<CR> + \ :<C-u>call <SID>Put('P')<CR> " Undo all the above if exists('b:undo_ftplugin') |