Permalink
Browse files

introduce g:opengoogletranslate#openbrowsercmd to specify open browse…

…r command.
  • Loading branch information...
1 parent a8ab1f3 commit 84972bd82b2711ad398e3fd7ca75ed615b07c642 @haya14busa committed Nov 12, 2016
Showing with 14 additions and 0 deletions.
  1. +5 −0 autoload/opengoogletranslate.vim
  2. +9 −0 doc/open-googletranslate.txt
@@ -1,12 +1,17 @@
let s:URI = vital#opengoogletranslate#import('Web.URI')
let g:opengoogletranslate#default_lang = get(g:, 'opengoogletranslate#default_lang', '')
+let g:opengoogletranslate#openbrowsercmd = get(g:, 'opengoogletranslate#openbrowsercmd', '')
" opengoogletranslate#open() opens Google Translate page.
"
" TODO: support removing comment prefix in given input?
function! opengoogletranslate#open(...) abort
let url = call('opengoogletranslate#url', a:000)
+ if executable(g:opengoogletranslate#openbrowsercmd) ==# 1
+ call job_start([g:opengoogletranslate#openbrowsercmd, url])
+ return
+ endif
try
call openbrowser#open(url)
catch /^Vim\%((\a\+)\)\=:E117/
@@ -77,6 +77,15 @@ g:opengoogletranslate#default_lang *g:opengoogletranslate#default_lang*
Default target language. The format should be two lowercase letters
(e.g. en, ja, etc...). Default is empty and inferred by |v:lang|.
+g:opengoogletranslate#openbrowsercmd *g:opengoogletranslate#openbrowsercmd*
+ Browser command to open URL. Default is empty and it open your default
+ browser.
+
+ Example:
+ You can use https://github.com/rhysd/electron-open-url to open
+ Google Translate in same window instead of opening a lot of tabs.
+
+
==============================================================================
CHANGELOG *open-googletranslate-changelog*

0 comments on commit 84972bd

Please sign in to comment.