wincol使います。
現在のカーソルのカラム位置を返してくれます。
ヘルプです。
*wincol()*
wincol() The result is a Number, which is the virtual column of the
cursor in the window. This is counting screen cells from the
left side of the window. The leftmost column is one.
引数を指定せずにVim起動。
/tmp $ vim
適当に文字列を作ります。
:0r!seq 10 | pr -t10

カーソルは、行頭にあります。wincolを実行すると何が返ってくるでしょうか。
:echo wincol()

1が返ってきました。
wを押して、カーソルを移動し、wincolを実行してみます。
:echo wincol()

8が返ってきました。


コメント