goog 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/goog.rb +1 -1
  2. data/vim/goog.vim +19 -3
  3. metadata +1 -1
data/lib/goog.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Goog
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
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
- let g:text_web_browser = system("echo -n $(which elinks || which links || which lynx)")
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 . " --dump " . shellescape(href) . " "
31
+ let command = g:text_web_browser . ' ' . shellescape(href) . " "
22
32
  echom command
23
33
  let result = system(command)
24
- new WebPage
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: