Skip to content

Instantly share code, notes, and snippets.

@dahu
Last active October 9, 2015 04:07
Show Gist options
  • Select an option

  • Save dahu/3435668 to your computer and use it in GitHub Desktop.

Select an option

Save dahu/3435668 to your computer and use it in GitHub Desktop.
EditFileWORD
" Edit file under cursor (not matching :help 'isfname) (:help gf)
" (:help cWORD)
function! EditFileWORD()
let file = expand('<cWORD>')
if findfile(file, &path) != ''
let file .= "\<cr>"
endif
return ":edit " . file
endfunction
" Demonstration of a (:help <expr>) map
nnoremap <expr> <leader>gf EditFileWORD()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment