vim - How to make vimgrep do word match search? -
I have the following meaning mapped F3 to vimgrep for the word under the current cursor in the _vimrc file.
Maps & lt; F3 & gt; : "Nototcommed vimgrep /" Execute Expansion ("<"> Cword & gt; ")" / gJ ** / *. " . Expansion ("%: e") & lt; Bars & gt; CW & LT; CR & gt;
Now, I want to create vimgrep for the exact word match for the word under the current cursor. I changed it to the bottom but it does not work.
Map & lt; Leader & gt; S: "noautocmd vimgrep / \ & lt; extension. ("
Anything wrong? How do I find a word match?
The problem is that you have to repeat the backslash - a single Backslash will escape the next character, and if the character has no special meaning then the backslash is removed. E.g.
echo "\ <
It works fine:
Map Factor: Execute "noautocmd vimgrep / \\ & lt;" extension ("& lt; cword & gt;") "\\ & gt;
Comments
Post a Comment