Created
October 20, 2012 09:14
-
-
Save dahu/3922742 to your computer and use it in GitHub Desktop.
Edit File WORD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Edit file under cursor (not matching :help 'isfname) (:help gf) | |
| " Deliberately left off terminating <cr> if filename can't be found | |
| " to allow user to modify before execution. | |
| " (: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