4
4

More than 5 years have passed since last update.

Vimで画面分割して指定行に移動する(ぱくり)

Last updated at Posted at 2014-04-06

Vimで画面分割して指定行に移動する - daisuzu's notes が便利そうだったので自分で使う用に少し手を加えた。
count がなかったら、そのまま split, vsplit を実行する。
execute cnt . 'G' だと曖昧だと怒られたので cursor() を使ってみた。

nnoremap _ :SplitAndGo split<CR>
nnoremap <bar> :SplitAndGo vsplit<CR>

command! -count=1 -nargs=1 -complete=customlist,SAG_Complete SplitAndGo call SplitAndGo(<q-args>)

function! SplitAndGo(cmd)
  execute a:cmd
  if !v:count
    return
  endif
  execute "normal! " . v:count . 'G'
endfunction

function! SAG_Complete(ArgLead, CmdLine, CursorPos)
  return ['split', 'vsplit']
endfunction
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4