在 Vim 中移动到当前单词的结尾 [英] Move to end of the current word in Vim

查看:23
本文介绍了在 Vim 中移动到当前单词的结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常我使用 ea 将某些内容附加到单词中;但是,如果光标已经在单词的最后一个位置,这将不起作用.

Usually I use ea to append something to a word; however, this doesn't work if the cursor is already in the last position of the word.

ea 将使光标移动到下一个单词的末尾.

ea will cause the cursor to move to the end of the next word.

我想知道是否有任何热键可以移动到当前词的末尾,即使光标已经在词的最后位置.

I'm interested to know whether there is any hotkey for moving to the end of current word even if the cursor is already in the last position of the word.

谢谢.

推荐答案

如果您愿意,您可以更改 e 的功能.例如,你可以把

You can change the functionality of e if you desire. For example, you could put

nnoremap e he

在你的 ~/.vimrc 中.这将 e 映射到 he 以便它以您想要的方式工作.但是,您可能会发现 e 很有用并且不想完全改写它.您可以使用 键添加备用映射.

in your ~/.vimrc. This maps e to he so that it works the way you want. However, you may find e useful and not want to make over it completely. You could use your <leader> key to add an alternate mapping.

nnoremap <leader>e he

这样您就可以使用\e,e(取决于您的mapleader 设置)来达到预期的效果.我倾向于同意其他人的观点,即习惯 vim 的标准单键会更好.一般来说,对于您经常使用的较长命令,请使用映射.

So that you can use \e or ,e (depending on your mapleader setting) to achieve the desired effect. I tend to agree with the others that it's better to become used to vim's standard single keys though. In general, use maps for longer commands that you regularly use.

没有像您建议的那样的内置命令,但是单词末尾有正则表达式 \>.

There's no builtin command like the one you're suggesting, but there is regex \> for the end of a word.

这篇关于在 Vim 中移动到当前单词的结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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