1

I'm trying to improve my vim-abilities. I'm writing a command and a function to find the current Word under the cursor. What I want to be able to do is type :FindFile and have the word under the current cursor open.

" Find the file under the current W word.
function! FindFile()
    let l:contents = @"
    normal viWy
    find l:contents
    set @" = l:contents
endfunction
command! FindFile :call FindFile()
1

I'm still a n00b at vimscript, but I figured out the following.

function! FindFile()
    find <cWORD>
endfunction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.