Skip to content

Instantly share code, notes, and snippets.

@koturn
Last active January 3, 2016 09:41
Show Gist options
  • Select an option

  • Save koturn/c65c0ab20b53e961397a to your computer and use it in GitHub Desktop.

Select an option

Save koturn/c65c0ab20b53e961397a to your computer and use it in GitHub Desktop.
現在のカーソルの位置にhogehogeを挿入するコマンド
function! s:inputcmd(text) abort
let [curpos, line] = [getcurpos(), getline('.')]
let line_parts = [line[: curpos[2] - 1], line[curpos[2] :]]
call setline(line('.'), line_parts[0] . a:text . line_parts[1])
endfunction
command! -nargs=* InputCmd01 call s:inputcmd(<q-args>)
command! -nargs=* InputCmd02 call feedkeys("\<Esc>a<args>", 'n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment