Vimスクリプト(winline)

テキストエディタ(Vimやその他)

(親記事はコチラ Vimコマンド&Script入門)

前回までにwincol、colの確認をしました。winlineを使ってみます。
ヘルプです。

                                                        *winline()*
winline()       The result is a Number, which is the screen line of the cursor
                in the window.  This is counting screen lines from the top of
                the window.  The first line is one.
                If the cursor was moved the view on the file will be updated
                first, this may cause a scroll.

まずは起動。

/tmp $ vim
:0r!seq 10

カーソルを3行めに移動します。

:echo winline()


3が返りました。
wincol()と同じく、引数がなくて数字が返るだけなので、わかりやすいですね。

画面スプリットして、

:vs

カーソルを移動して、winline実行。

:echo winline()


8が返りました。
今フォーカスしているウィンドウのカーソル位置が返ります。

コメント

タイトルとURLをコピーしました