Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " :WhichEdit {{{
- MyAlterCommand we WhichEdit
- command!
- \ -nargs=+
- \ WhichEdit
- \ call s:cmd_which_edit([<f-args>])
- function! s:system(command, args) "{{{
- " For shellescape(), set noshellslash
- let save_shellslash = &shellslash
- set noshellslash
- try
- return system(
- \ join([a:command] + map(copy(a:args), 'shellescape(v:val)'), ' ')
- \)
- finally
- let &shellslash = save_shellslash
- endtry
- endfunction "}}}
- function! s:cmd_which_edit(args) "{{{
- let [exe; args] = a:args
- try
- let out_path = s:system(exe, args)
- let out_path = substitute(out_path, '\n$', '', '') " chomp
- if filereadable(out_path)
- execute 'edit' out_path
- endif
- catch
- echohl WarningMsg
- echomsg v:exception
- echohl None
- endtry
- endfunction "}}}
- " }}}
Add Comment
Please, Sign In to add comment