如何配置VIM使运动指令将包括下划线和字母大写,但建成后,将忽略它们? [英] How can I configure vim so that movement commands will include underscores and CamelCase, but completion will ignore them?

查看:117
本文介绍了如何配置VIM使运动指令将包括下划线和字母大写,但建成后,将忽略它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我现在有这样的:

For example, I currently have this:

set iskeyword-=_

这有使这项工作的效果:

This has the effect of making this work:

foo_bar

如果光标在F,pressingW¯¯将光标移到下划线。 pressing再次移动到栏中的B。这是为运动所期望的效果,但有打破完成的不希望的副作用。同样的故事与驼峰令牌。例如,

If cursor is on "f", pressing w moves cursor to the underscore. Pressing again moves to the "b" in bar. This is the desired effect for movement, but has the undesired side-effect of breaking completion. Same story with CamelCase tokens. For example,

如果我有这样的:

foo_bar

和I型 foo_<按Ctrl + N方式> 我不明白foo_bar这样的名称作为完成选项

and I type foo_<CTRL+N> I don't get "foo_bar" as a completion option.

推荐答案

安装驼峰运动插件并按照页面上的例子来覆盖默认是W 映射与驼峰之一。这将使运动遵循驼峰,但不会要求改变<​​code> iskeyword 。另外,您可以使用替代逗号preceded映射(我的preference),,W ,E 等做驼峰运动。

Install the camelcase motion plugin and follow the example on the page to override the default w mapping with the CamelCase one. This will make movements follow CamelCase, but won't require changes to iskeyword. Alternatively you can use the alternative comma-preceded mappings (my preference), ,w, ,e etc to do CamelCase motions.

这篇关于如何配置VIM使运动指令将包括下划线和字母大写,但建成后,将忽略它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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