In normal mode I want to be able to select a word and when I press <leader>i
yield the following string in next line, The word is <word_that_was_highlighted>
. Is it possible to do this in vim? I attempted a solution using nnoremap
like as follows but that didn't work.
nnoremap <leader>i :let @h=@*<c-r>"hp
Here I was attempting to paste the content of register * into h, and then paste that onto a new line.
nnoremap <leader>i yiwoThe word is <Esc>p
which yanks the current word (yiw
), adds a new line (o
) and writeThe word is
before going to normal mode and pasting the previously yanked word?