我有一个坏习惯,就是使用“home”键返回到行首。当我最近开始使用 vim 时,我注意到当我在缩进的行上按 home 键时,它会让我回到该行的开头。在 Notepad++(我曾经使用的编辑器)中,它会让我返回到该行代码的开头,就在缩进之后。
有没有办法在 vim 中复制这种行为?通常,当我按 home 时,它处于插入模式,以便我(通常)将变量粘贴在那里。
I have set smartindent
在我的 vimrc 中,set noautoindent
作为“提示”页面告诉我要确保禁用自动缩进(尽管它似乎一开始就没有启用 - 也许该选项是无关的。)
在 Vim 中,有两种常用的方法可以转到行的“开头”:
-
0 (zero) go to the first column of text
-
^ go to the first non-whitespace on the line
I find that using 0w is usually the most convenient way for me to go to the first nonblank character on a line, it's the same number of keys as ^ and is easier to reach. (Of course, if there are no leading spaces on the line, don't press w.)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)