aboutsummaryrefslogtreecommitdiff
path: root/autoload/colon_operator.vim
blob: e5918d10d2225b2b5a9d7e7628254d75b95b4e43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" Operator prompts for a command if it doesn't have one from a prior run, and
" then runs the command on the selected text
function! colon_operator#Operatorfunc(type) abort
  if !exists('s:command')
    let s:command = input('g:', '', 'command')
  endif
  execute "'[,']".s:command
endfunction

" Clear command so that we get prompted to input it, set operator function,
" and return <expr> motions to run it
function! colon_operator#Map() abort
  unlet! s:command
  set operatorfunc=colon_operator#Operatorfunc
  return 'g@'
endfunction