Created
April 24, 2020 10:29
-
-
Save Milly/c9dbcbc3eb8ff2fd361ae188013d8c83 to your computer and use it in GitHub Desktop.
Open path with VSCode in windows+vim+netrw
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
let g:netrw_open_custom_prog = '"vscode://file/%s"' | |
function! Netrw_open_custom(file) abort | |
let l:path = a:file | |
if exists('b:netrw_curdir') | |
let l:path = b:netrw_curdir . '/' . a:file | |
endif | |
if glob(l:path) != '' | |
execute '!start' printf(g:netrw_open_custom_prog, l:path) | |
endif | |
endfunction | |
augroup Netrw_open_custom | |
autocmd! | |
autocmd FileType netrw nnoremap <buffer> gv :call Netrw_open_custom(netrw#GX())<CR> | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment