goog 0.1.1 → 0.1.2

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 (4) hide show
  1. data/bin/goog +4 -0
  2. data/lib/goog.rb +1 -1
  3. data/vim/goog.vim +19 -6
  4. metadata +2 -2
data/bin/goog CHANGED
@@ -21,6 +21,10 @@ DATE RANGE options for -d option:
21
21
  m last month
22
22
  y last year
23
23
 
24
+ VIM KEY MAPPINGS
25
+ <leader>o open URL on or after cursor in default external web browser
26
+ <leader>O open URL on or after cursor in split Vim window using elinks, links, or lynx
27
+
24
28
  goog #{Goog::VERSION}
25
29
  http://github.com/danchoi/goog
26
30
  Author: Daniel Choi <dhchoi@gmail.com>
data/lib/goog.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Goog
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/vim/goog.vim CHANGED
@@ -6,17 +6,30 @@ hi Identifier term=NONE cterm=NONE gui=NONE ctermfg=LightCyan
6
6
  hi Constant term=NONE cterm=NONE gui=NONE ctermfg=Magenta
7
7
 
8
8
  let s:http_link_pattern = 'https\?:[^ >)\]]\+'
9
- let g:browser_command = system("echo -n $(which gnome-open || which open)")
10
- func! s:open_href_under_cursor()
9
+
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)")
12
+
13
+ func! s:open_href_under_cursor(text_browser)
11
14
  let res = search(s:http_link_pattern, 'cw')
12
15
  if res != 0
13
16
  let href = matchstr(expand("<cWORD>") , s:http_link_pattern)
14
- let command = g:browser_command . " '" . shellescape(href) . "' "
15
- echom command
16
- call system(command)
17
+ if a:text_browser == 0
18
+ let command = g:gui_web_browser . " " . shellescape(href) . " "
19
+ call system(command)
20
+ else
21
+ let command = g:text_web_browser . " --dump " . shellescape(href) . " "
22
+ echom command
23
+ let result = system(command)
24
+ new WebPage
25
+ silent! put! =result
26
+ setlocal buftype=nofile
27
+ normal 1G
28
+ endif
17
29
  end
18
30
  endfunc
19
31
 
20
- nnoremap <leader>o :call <SID>open_href_under_cursor()<CR>
32
+ nnoremap <leader>o :call <SID>open_href_under_cursor(0)<CR>
33
+ nnoremap <leader>O :call <SID>open_href_under_cursor(1)<CR>
21
34
 
22
35
  " http://www.padrinorb.com/pages/why
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.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-05 00:00:00.000000000 Z
12
+ date: 2012-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri