Skip to content

Instantly share code, notes, and snippets.

@Milly
Created April 24, 2020 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Milly/c9dbcbc3eb8ff2fd361ae188013d8c83 to your computer and use it in GitHub Desktop.
Save Milly/c9dbcbc3eb8ff2fd361ae188013d8c83 to your computer and use it in GitHub Desktop.
Open path with VSCode in windows+vim+netrw
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