gpt4 book ai didi

vim - 跳到最后一行,但留在同一列

转载 作者:行者123 更新时间:2023-12-04 05:24:50 26 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





How to go to the end of the file in vim while preserving the current column under the cursor?

(1 个回答)


7年前关闭。




在 Vim 中,可以使用 G 跳转到最后一行。 (或带有 gg 的第一行),但该移动也会跳转到第一个非空格字符。

是否有键绑定(bind)可以跳转到第一行(或最后一行),但留在同一列?

最佳答案

那将是 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.). [..]

关于vim - 跳到最后一行,但留在同一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16748161/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com