Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Always edit a file on gf, but be nice and ask
- map gf :<C-U>call GoFile()<CR>
- function! GoFile()
- try
- normal! gf
- catch /^Vim\%((\a\+)\)\=:E447/
- let q = substitute(v:exception,'^Vim\%((\a\+)\)\=:E\d\+: \(.*\)','\1','') . ', would you like to create it?'
- try
- buffer <cfile>
- catch /^Vim\%((\a\+)\)\=:E94/
- if confirm(q ,"&Yes\n&No\n&Cancel",3) == 1
- exec 'edit '.expand('%:p:h').'/'.expand('<cfile>')
- endif
- endtry
- endtry
- endfunction
Add Comment
Please, Sign In to add comment