微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

vim – 跳转到最后一行,但保持在同一列

参见英文答案 > How to go to the end of the file in vim while preserving the current column under the cursor?1个
在Vim中,可以使用G(或带gg的第一行)跳转到最后一行,但该移动也会跳转到第一个非空格字符.

是否有一个键绑定跳转到第一行(或最后一行),但保持在同一列?

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐