2013-05-19 7 views
9

ビジュアルモードを使用すると、選択範囲をファイル全体に拡大したいことがあります。しかし、VGを打つと、私は最後の行の最初の文字に連れて行きます。私はそのコマンドを使用する前に私が最後の行の同じ列に連れて行きたいと思っています。それを達成する簡単な方法はありますか?私は200000jをそれに使うこともできますが、それはあまり優雅ではありません。おかげさまで カーソルの下の現在の列を維持しながらvimでファイルの最後に移動するには?

+0

_linewise_ビジュアルモードに「V」を使用すると、行全体が選択されているため、列は選択の対象になりません。しかし、それは 'v'と' 'と異なります。 –

+1

はい、 'C-v'にはこれが必要です。 – egdmitry

答えて

12

をvimrcタイピング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. 
関連する問題