垂直vim光标在命令模式下 [英] Vertical vim cursor in command mode

查看:182
本文介绍了垂直vim光标在命令模式下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac上,我有我的终端光标设置为垂直条选项。然而在vim命令模式下,光标是垂直条,但它不允许我使用hjkl去行的结尾,它总是在结束之前停止。这是特别讨厌的,因为你必须使用箭头键在插入模式,使光标移到行尾。任何修复都会感激。



例如:hello worl | d我想要的是hello world |

解决方案

我想你正在寻找 set virtualedit = onemore



:help'virtualedit'

 这些单词的逗号分隔列表:
块允许在可视块模式下进行虚拟编辑。
insert允许在插入模式下进行虚拟编辑。
all允许在所有模式下进行虚拟编辑。
onemore允许光标移动超过行尾

[...]

onemore不一样,它只允许在该行的最后一个字符后移动光标
。这使得一些命令更多
一致。以前,如果行为空,光标总是超过行的结尾
。但它远离Vi兼容。它也可以
打破一些插件或Vim脚本。例如,因为l可以移动
光标在最后一个字符之后。小心使用!

我从来没有注意到任何问题,所以看起来相当安全,尽管警告。 / p>

Im on mac and I have my terminal cursor set to the vertical bar option. However in vim command mode the cursor is the vertical bar but it wont let me use hjkl to go to the end of the line, it always stops right before the end. This is especially annoying because you have to use the arrow keys in insert mode to make the cursor go the end of the line. Any fix would be appreciated

eg: hello worl | d , what I want is hello world |

解决方案

I think you're looking for set virtualedit=onemore.

From :help 'virtualedit':

A comma separated list of these words:
    block   Allow virtual editing in Visual block mode.
    insert  Allow virtual editing in Insert mode.
    all     Allow virtual editing in all modes.
    onemore Allow the cursor to move just past the end of the line

[...]

"onemore" is not the same, it will only allow moving the cursor just
after the last character of the line.  This makes some commands more
consistent.  Previously the cursor was always past the end of the line
if the line was empty.  But it is far from Vi compatible.  It may also
break some plugins or Vim scripts.  For example because l can move
the cursor after the last character.  Use with care!

I've never noticed any problems myself, so it seems reasonably safe in spite of the warning.

这篇关于垂直vim光标在命令模式下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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