I want to write a command that specifies \"the word under the cursor\" in VIM. For instance, let\'s say I have the cursor on a word and I make it appear twice. For instance, i
is the word under the cursor (:help ).
Sorry, I should have been more complete in this answer.
You can nmap a command to it, or this series of keystrokes for the lazy will work:
b #go to beginning of current word
yw #yank to register
Then, when you are typing in your pattern you can hit which will paste in your command the contents of the 0-th register.
You can also make a command for this like:
:nmap w :s/\(=expand("")\)/
Which will map hitting '\' and 'w' at the same time to replace your command line with
:s/\(\)/