vim
コマンドラインの範囲
サーチ…
絶対行番号
次のコマンドを実行:commandライン上の23への56 :
:23,56command
NB:範囲はデフォルトで含まれています。
相対行番号
次のコマンドでは、範囲は現在の行より6行上で始まり、3行下で終了します。
:-6,+3command
ラインショートカット
-
.現在の行を表しますが、完全に省略することもできます。 -
$は最後の行を表します。 -
%はバッファ全体を表し、1,$ショートカットです。
以下の2つのコマンドが実行されます:command現在の行から最後の行までのすべてのファイルの:command :
:.,$command
:,$command
以下のコマンドが実行され:commandバッファ全体の:command :
:%command
マーク
以下のコマンドが実行され:command fマニュアルマークを含む行からtマニュアルマークを含む行までのすべての行での:command :
:'f,'tcommand
自動マークも使用できます:
:'<,'>command " covers the visual selection
:'{,'}command " covers the current paragraph
:'[,']command " covers the last changed text
See :help mark-motions 。
サーチ
以下のコマンドが実行:command最初に一致からのすべてのライン上from最初に一致するto :
:/from/,/to/command " from next 'from' to next 'to'
:?from?,/to/command " from previous 'from' to next 'to'
:?from?,?to?command " from previous 'from' to previous 'to'
参照:help search-commands 。
ラインオフセット
ラインオフセットを使用して開始線と終了線を調整できます。
:/foo/-,/bar/+4command " from the line above next 'foo' to 4 lines below next 'bar'
参照:help search-offset 。
混合範囲
上記のすべてを表現可能な範囲に組み合わせることは可能です:
:1267,/foo/-2command
:'{,command
:'f,$command
創造的であり、読むことを忘れないでください:help cmdline-ranges 。
Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow