LoginSignup
3
3

More than 5 years have passed since last update.

Vimで、カーソル位置を行頭トグルする(改)

Posted at

問題

^(空白文字をのぞいた行頭に移動)は、プログラミングをしてると頻繁に使うのに、^なんて押せない。カーソル位置を行頭トグルする(Vim) - Qiita [キータ]という素晴らしいTipsが投稿されたが、順番的に、^してから0したい。

解決

以下のような設定をほどこす。

nnoremap <expr> 0
\  match(strpart(getline('.'), 0, col('.') - 1), '^\s\+$') >= 0 ? '0' : '^'

こんな感じになる。

議論

^0$で循環できるともっといいのかも?

3
3
2

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