ビジュアル モードを使用するとき、選択範囲をファイル全体に広げたいと思うことがよくあります。しかし、VG を押すと、最後の行の最初の文字に移動します。そのコマンドを使用する前と同じように、最後の行の同じ列に移動したいと思います。それを達成する簡単な方法はありますか?そのために 200000j を使用することもできますが、それはあまりエレガントではありません。ありがとう。
1420 次
1 に答える
17
ビジュアルモードでvimrcset nostartofline
に入力G
すると、列を変更せずに一番下の行に移動します。ただし、これにより他のコマンドが変更されるため、使用している他の動作の一部が変更される可能性があります。(これは望ましくない場合があります)。
startoflineのヘルプが以下にコピーされているので、この設定の影響を受けるコマンドを確認できます。
*'startofline'* *'sol'* *'nostartofline'* *'nosol'*
'startofline' 'sol' boolean (default on)
global
{not in Vi}
When "on" the commands listed below move the cursor to the first
non-blank of the line. When off the cursor is kept in the same column
(if possible). This applies to the commands: CTRL-D, CTRL-U, CTRL-B,
CTRL-F, "G", "H", "M", "L", gg, and to the commands "d", "<<" and ">>"
with a linewise operator, with "%" with a count and to buffer changing
commands (CTRL-^, :bnext, :bNext, etc.). Also for an Ex command that
only has a line number, e.g., ":25" or ":+".
In case of buffer changing commands the cursor is placed at the column
where it was the last time the buffer was edited.
NOTE: This option is set when 'compatible' is set.
于 2013-05-19T04:37:31.210 に答える