In vimscript expand('<cword>')
gives me the word under the cursor.
How can I get the word under the cursor starting at he current cursor location (skipping the word start).
Using vimscript: matchstr(getline('.'), '\k*', getpos('.')[2]-1)
.
getline('.')
gets the current line, matchstrpos
searches for the current keyword pattern \k*
starting from the current cursor position from getpos('.')
, where current cursor position is at the second index and we need to subtract 1 to index the search correctly.
ye
should do it, but moves the cursor.ye
for fzf find, but without changing the cursor or my cut buffer."aye