在Vim中,可以使用G
(或gg
的第一行)跳转到最后一行,但该移动也会跳转到第一个非空格字符。
是否存在跳转到第一行(或最后一行)的键绑定,但保留在同一列中?
答案 0 :(得分:14)
那将是set nostartofline
。有了它, gg 和 G 将保留列,如果可能的话,就像 j 等。
来自:h 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.). [..]
答案 1 :(得分:0)
是的,有一个密钥绑定。但它完全不受影响。
1 CTRL+End
:第一行,同一列CTRL+End
:最后一行,同一列