有选择地设置iskeyword [英] Set iskeyword selectively

查看:93
本文介绍了有选择地设置iskeyword的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,我需要在大型xml模式文件中搜索光标下该单词的下一个匹配项,但最好不要搜索它是结束标记的标记

Often I need to search large xml mode files for the next occurrence of the word under the cursor but preferably not if it's a tag the closing tag

在下面的示例中,#是光标所在的位置.将*#与iskeyword不包含><一起使用将在<Dealid></Dealid>之间移动.

In the below example # is where the cursor is. Using * or # with iskeyword not including > or < will move between <Dealid> and </Dealid>.

<Deali#d>4444</Dealid>
... 50 lines
<Dealid>6666</Dealid>
... n lines
<Dealid>5643</Dealid>

我尝试了:set iskeyword+=<,它对于移至下一场比赛表现很好,但它更改了vey以包含结束标记的<,因此移至了6666的开头,例如,键入会拉动6666<而不是6666.

I tried :set iskeyword+=< which worked fine for moving to the next match but it changed vey to include the < of the closing tag so moving to the start of 6666, for eg, and typing vey will yank 6666< rather than 6666.

是否要同时获得两个词的最佳效果或将iskeyword+=<限制为*#运算符?

Anyway of getting the best of both words or limit the iskeyword+=< to the * and # operators?

推荐答案

这应该做您想要的.

nnoremap * :set iskeyword+=<<CR>*:set iskeyword-=<<CR>
nnoremap # :set iskeyword+=<<CR>#:set iskeyword-=<<CR>

它在执行*#之前设置更改iskeyword,然后将其重置.

It sets changes iskeyword before executing * or # and then resets it.

这篇关于有选择地设置iskeyword的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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