diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-24 14:18:54 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-24 14:18:54 +1200 |
commit | ac03762d0218727d97e52adadb30cf2a9f32dd26 (patch) | |
tree | dd4a4af46ebb2dc94cd23517fa8cbef983cef581 /vim/plugin | |
parent | Move quickfix auto-open into a little plugin file (diff) | |
download | dotfiles-ac03762d0218727d97e52adadb30cf2a9f32dd26.tar.gz dotfiles-ac03762d0218727d97e52adadb30cf2a9f32dd26.zip |
Add colon_operator.vim plugin
Diffstat (limited to 'vim/plugin')
-rw-r--r-- | vim/plugin/colon_operator.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vim/plugin/colon_operator.vim b/vim/plugin/colon_operator.vim new file mode 100644 index 00000000..4360e7ab --- /dev/null +++ b/vim/plugin/colon_operator.vim @@ -0,0 +1,24 @@ +" +" colon_operator.vim: Select ranges and run colon commands on them, rather +" like the ! operator but for colon commands like :sort. +" +" Author: Tom Ryder <tom@sanctum.geek.nz> +" License: Same as Vim itself +" +if exists('g:loaded_colon_operator') || &compatible + finish +endif +if v:version < 700 + finish +endif +let g:loaded_colon_operator = 1 + +" Operator function starts typing an ex command with the operated range +" pre-specified +function! ColonOperator(type) abort + call feedkeys(':''[,'']', 'n') +endfunction + +" Set up mapping +nnoremap <Plug>(ColonOperator) + \ :<C-U>set operatorfunc=ColonOperator<CR>g@ |