Set iskeyword selectively

丶灬走出姿态 提交于 2019-12-04 11:43:44

This should do what you want.

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

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

Instead of changing 'iskeyword' maybe use a visual star search. This will allow you to visually select the text and then hit *. e.g. va<*

If you don't want to use a plugin you can put the following mapping in your ~/.vimrc file:

xnoremap * y/\V<c-r>=escape(@", '\')<cr><cr>

Note: this mapping clobbers the unnamed register so it would probably be best to use a more advanced mapping or a plugin.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!