2013-05-19 40 views
9

通常當我使用可視化模式時,我想將選擇擴展到整個文件。但是打VG把我帶到最後一行的第一個字符。我希望它把我帶到最後一行的同一列,就像我在使用該命令之前一樣。有沒有簡單的方法來實現這一目標?我可以使用200000j或其他東西,但這不是太優雅。 謝謝。如何在保留光標下的當前列的情況下轉到vim中的文件末尾?

+0

當您在_linewise_ visual模式下使用'V'時,無論如何,選擇整行時該列無關緊要。不過,它與'v'和''不同。 –

+1

是的,我需要'C-v'。 – egdmitry

回答

12

如果您將set nostartofline添加到您的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. 
相關問題