Set selective key
Often I need to search for large size xml files for the next occurrence of the word under the cursor, but preferably if it is a closing tag
In the example below, # is the cursor. Use with *
either #
a key without a key >
or <
will move between <Dealid>
and </Dealid>
.
<Deali#d>4444</Dealid>
... 50 lines
<Dealid>6666</Dealid>
... n lines
<Dealid>5643</Dealid>
I tried it :set iskeyword+=<
, which worked great for going to the next match, but it changed vey
to include the <
closing tag, so moved to the beginning 6666
, for example, and typing vey
would be yank 6666<
, not 6666
.
Is there anyway to get the best of both words or to restrict the iskeyword+=<
operators *
and #
?
source to share
Instead of changing, 'iskeyword'
it is possible to use visual star search . This will allow you to visually select the text and then click *
. egva<*
If you don't want to use the plugin, you can put the ~/.vimrc
following mapping in your file :
xnoremap * y/\V<c-r>=escape(@", '\')<cr><cr>
Note: this collation captures unnamed case, so it is probably best to use a more advanced collation or plugin .
source to share