缓冲区切换后 Vim 光标跳到行首 [英] Vim cursor jumps to beginning of the line after buffer switch

查看:30
本文介绍了缓冲区切换后 Vim 光标跳到行首的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我切换缓冲区然后返回它时(基本上是当我回到以前打开的任何缓冲区时),光标被放置在行的开头,失去了行中的先前位置.这很烦人.

When I switch buffer and then go back to it(basically when I get back to any buffer that was previously opened), cursor is placed at the start of the line, loosing previous position in line. This is very annoying.

推荐答案

可以使用设置

:se nostartofline

或简称:

:se nosol

文档:

           *'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.

这篇关于缓冲区切换后 Vim 光标跳到行首的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆