aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/colon_operator.vim
blob: 4360e7ab99d7ad44a3a91bbf567d7e71f60ed852 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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@