[nvim] add an optional argument for the Open command

This commit is contained in:
Dmytro Meleshko 2019-06-21 14:55:49 +03:00
parent 19c9f66519
commit 45809040d2

View file

@ -76,7 +76,7 @@ nnoremap <silent><expr> <CR> &buftype is# '' ? ":write\<CR>" : "\<CR>"
" }}}
" Open {{{
" opens file with a system program
" opens file or URL with a system program
function s:Open(path)
" HACK: 2nd parameter of this function is called 'remote', it tells
" whether to open a remote (1) or local (0) file. However, it doesn't work
@ -88,7 +88,7 @@ nnoremap <silent><expr> <CR> &buftype is# '' ? ":write\<CR>" : "\<CR>"
" if-statement which contains the 'gf' command.
call netrw#BrowseX(a:path, 2)
endfunction
command Open call s:Open(expand('%'))
command -nargs=* -complete=file Open call s:Open(empty(<q-args>) ? expand('%') : <q-args>)
" }}}
" }}}