I want do do a very simple script that visually selects the word under the cursor, and then calls another function (from an already existing vim plugin) that depends on this selection.
I've tried this:
function! ThisWord()
normal! vaw
" some other function that I'm not calling yet
endfunction
map <leader>a :execute ThisWord()<CR>
However, if for example I do this in the word 'main' (somewhere near the end of the file), it selects from the top of the file just up to the word in question (including it).
How can I select just the word under the cursor?
Is this related to the '<
and '>
marks as mentioned here?
Or does the execute
somehow work with a different set of coordinates?