goog 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/goog.rb +1 -1
- data/vim/goog.vim +19 -3
- metadata +1 -1
data/lib/goog.rb
CHANGED
data/vim/goog.vim
CHANGED
@@ -8,8 +8,18 @@ hi Constant term=NONE cterm=NONE gui=NONE ctermfg=Magenta
|
|
8
8
|
let s:http_link_pattern = 'https\?:[^ >)\]]\+'
|
9
9
|
|
10
10
|
let g:gui_web_browser = system("echo -n $(which gnome-open || which open)")
|
11
|
-
|
11
|
+
if ! exists("g:text_web_browser")
|
12
|
+
if executable("elinks")
|
13
|
+
let g:text_web_browser = 'elinks -dump -no-numbering'
|
14
|
+
elseif executable("lynx")
|
15
|
+
let g:text_web_browser = 'lynx -dump -nonumbers'
|
16
|
+
elseif executable("links")
|
17
|
+
let g:text_web_browser = 'links -dump'
|
18
|
+
endif
|
19
|
+
end
|
12
20
|
|
21
|
+
|
22
|
+
let s:web_page_bufname = "GoogBrowser"
|
13
23
|
func! s:open_href_under_cursor(text_browser)
|
14
24
|
let res = search(s:http_link_pattern, 'cw')
|
15
25
|
if res != 0
|
@@ -18,11 +28,17 @@ func! s:open_href_under_cursor(text_browser)
|
|
18
28
|
let command = g:gui_web_browser . " " . shellescape(href) . " "
|
19
29
|
call system(command)
|
20
30
|
else
|
21
|
-
let command = g:text_web_browser .
|
31
|
+
let command = g:text_web_browser . ' ' . shellescape(href) . " "
|
22
32
|
echom command
|
23
33
|
let result = system(command)
|
24
|
-
|
34
|
+
if bufexists(s:web_page_bufname) && bufwinnr(s:web_page_bufname) != -1
|
35
|
+
exec bufwinnr(s:web_page_bufname)."wincmd w"
|
36
|
+
else
|
37
|
+
exec "new ".s:web_page_bufname
|
38
|
+
endif
|
25
39
|
silent! put! =result
|
40
|
+
silent! 1put! ='URL: '.href
|
41
|
+
silent! 2put! =''
|
26
42
|
setlocal buftype=nofile
|
27
43
|
normal 1G
|
28
44
|
endif
|