Private in Mozilla Firefox, incognito in Google Chrome.
nmap \b :call ExtractOpenURL('')<CR>
nmap \w :call ExtractOpenURL('-n')<CR>
nmap \t :call ExtractOpenURL('-t')<CR>
nmap \b :call ExtractOpenURL('')<CR>
nmap \w :call ExtractOpenURL('-n')<CR>
nmap \t :call ExtractOpenURL('-t')<CR>
+nmap \p :call ExtractOpenURL('-p')<CR>
" Send visual block to a browser
vmap \b ""y:call OpenURL('<C-R>"', '')<CR>
vmap \w ""y:call OpenURL('<C-R>"', '-n')<CR>
vmap \t ""y:call OpenURL('<C-R>"', '-t')<CR>
" Send visual block to a browser
vmap \b ""y:call OpenURL('<C-R>"', '')<CR>
vmap \w ""y:call OpenURL('<C-R>"', '-n')<CR>
vmap \t ""y:call OpenURL('<C-R>"', '-t')<CR>
+vmap \p ""y:call OpenURL('<C-R>"', '-p')<CR>
" Encode and send visual block to a browser
vmap \B ""y:call EncodeOpenURL('<C-R>"', '')<CR>
vmap \W ""y:call EncodeOpenURL('<C-R>"', '-n')<CR>
" Encode and send visual block to a browser
vmap \B ""y:call EncodeOpenURL('<C-R>"', '')<CR>
vmap \W ""y:call EncodeOpenURL('<C-R>"', '-n')<CR>
def set_current_browser():
stack = get_stack()
if stack:
def set_current_browser():
stack = get_stack()
if stack:
- os.environ['BROWSER'] = stack[0].strip()
+ os.environ['BROWSER'] = browser = stack[0].strip()
+ return browser
# This must be imported and called before webbrowser
# because webbrowser reads BROWSER environment variable at the import time
from browser_stack import set_current_browser
# This must be imported and called before webbrowser
# because webbrowser reads BROWSER environment variable at the import time
from browser_stack import set_current_browser
+browser = set_current_browser()
+
+if sys.argv[1] in ("-p", "--private", "--incognito"):
+ try:
+ url = sys.argv[2]
+ except IndexError:
+ url = ''
+ if browser == 'firefox':
+ if url:
+ os.system('firefox --private-window "%s"' % url)
+ else:
+ os.system('firefox --private-window')
+ sys.exit()
+ elif browser in ("google-chrome", "chrome", "chromium", "chromium-browser"):
+ os.system('%s --incognito "%s"' % (browser, url))
+ sys.exit()
+ sys.exit("Unsupported browser")