match - How to ignore Characters while matching in vim -


i'm trying vim (gvim on windows 7) since past few days , must interesting though have steep learning curve.

i have decently built _vimrc file now, forum, looking specific pattern ignore technique.

suppose, in text file have string so:

10000000c9abcdef 

and in same file have same string, separated : @ every 2 characters so,

10:00:00:00:c9:ab:cd:ef 

or, have line such as,

hostname portname switchname 

as as

hostname_portname_switchname 

how can make vim match 10000000c9abcdef 10:00:00:00:c9:ab:cd:ef , match hostname portname switchname hostname_portname_switchname ?

as of now, if place cursor below 10:00:00:00:c9:ab:cd:ef , hit *, highlights , matches 10:00:00:00:c9:ab:cd:ef, how can make match 10000000c9abcdef ? or hostname_portname_switchname hostname portname switchname ?

basically, want vim ignore non word characters ( assuming non word characters space, tab, :, ::, comma, colon, semicolon etc.)

is there way ?

after selecting match *, can modify search pattern change literal non-keyword character (\k\@!.) match non-keyword, optionally (\?):

:let @/ = substitute(@/, '\k\@!.', '\\%(\\k\\@!.\\)\\?', 'g') 

to make work _, have either adapt regular expression, or :set iskeyword-=_.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -