2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VimShell のコマンドラインで <C-d> をエミュレートしてみる

Last updated at Posted at 2012-11-30

zsh や bash では,コマンドラインで文字入力中は <C-d> でカーソル右の文字を削除(Emacs と同じ)し,コマンドラインが空の時は EOF を送ってシェルを終了させます.
普段 <C-d> でシェルを終了させているので,VimShell でも同じことが設定したくなりました.

autocmd FileType vimshell imap 
    \ <buffer><silent><expr><C-d>
    \ vimshell#get_cur_text()=='' ? "\<Esc>\<Plug>(vimshell_exit)" : "\<Del>"

get_cur_text() で入力中の文字列を取得し,何も入力されていなければ VimShell を終了,そうでなければ <Del> を入力します.

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?