goog 0.2.7 → 0.2.8
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.
- data/bin/goog +17 -6
- data/lib/goog.rb +1 -1
- data/plugin/goog.vim +3 -1
- metadata +2 -2
data/bin/goog
CHANGED
|
@@ -7,6 +7,17 @@ require 'uri'
|
|
|
7
7
|
require 'optparse'
|
|
8
8
|
|
|
9
9
|
$vimscript_file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'plugin', 'goog.vim'))
|
|
10
|
+
|
|
11
|
+
html_dump_program = if (`which w3m` != "")
|
|
12
|
+
"w3m -dump"
|
|
13
|
+
elsif (`which elinks` != "")
|
|
14
|
+
"elinks -dump -no-numbering"
|
|
15
|
+
elsif (`which links` != "")
|
|
16
|
+
"links -dump"
|
|
17
|
+
elsif (`which lynx` != "")
|
|
18
|
+
"lynx -dump -nonumber"
|
|
19
|
+
end
|
|
20
|
+
|
|
10
21
|
orig_query = "query: #{ARGV.join(' ')}\n\n"
|
|
11
22
|
options = {}
|
|
12
23
|
OptionParser.new do |opts|
|
|
@@ -24,7 +35,7 @@ DATE RANGE options for -d option:
|
|
|
24
35
|
|
|
25
36
|
VIM KEY MAPPINGS
|
|
26
37
|
<leader>o open URL on or after cursor in default external web browser
|
|
27
|
-
<leader>O open URL on or after cursor in split Vim window using elinks, links, or lynx
|
|
38
|
+
<leader>O open URL on or after cursor in split Vim window using w3m, elinks, links, or lynx
|
|
28
39
|
|
|
29
40
|
VIM PLUGIN COMMANDS
|
|
30
41
|
|
|
@@ -41,7 +52,7 @@ In the GoogSearchResults buffer:
|
|
|
41
52
|
CTRL-j jumps to the next URL
|
|
42
53
|
CTRL-k jumps to the previous URL
|
|
43
54
|
<leader>o open URL on or after cursor in default external web browser
|
|
44
|
-
<leader>O open URL on or after cursor in split Vim window using elinks, links, or lynx
|
|
55
|
+
<leader>O open URL on or after cursor in split Vim window using w3m, elinks, links, or lynx
|
|
45
56
|
|
|
46
57
|
goog #{Goog::VERSION}
|
|
47
58
|
http://github.com/danchoi/goog
|
|
@@ -53,7 +64,7 @@ END
|
|
|
53
64
|
opts.on("-n", '--num-pages [NUM PAGES]', 'Show NUM PAGES pages of results') {|pages| options[:pages] = pages.to_i }
|
|
54
65
|
opts.on("-c", '--color', 'Force color output') {options[:color] = true}
|
|
55
66
|
opts.on("-x", '--expand', 'Expand all results into web page text') { options[:expand] = true }
|
|
56
|
-
opts.on("-e", '--elinks', 'Open results in
|
|
67
|
+
opts.on("-e", '--elinks', 'Open results in text browser') { options[:elinks] = true }
|
|
57
68
|
opts.on("-i", '--interactive', 'Prompt for selection') { options[:interactive] = true }
|
|
58
69
|
opts.on("-v", '--vim', 'Open results in Vim and bind <leader>o to open URL on or after cursor') { options[:vim] = true }
|
|
59
70
|
opts.on('--install-plugin', 'Install Goog as a Vim plugin') {
|
|
@@ -135,7 +146,7 @@ links = []
|
|
|
135
146
|
if options[:expand]
|
|
136
147
|
$stderr.puts "Fetching #{title}: #{link}"
|
|
137
148
|
puts "#{title}: #{link}"
|
|
138
|
-
puts
|
|
149
|
+
puts `#{html_dump_program} '#{link}'`
|
|
139
150
|
puts '-' * 80
|
|
140
151
|
puts
|
|
141
152
|
end
|
|
@@ -166,13 +177,13 @@ if options[:interactive]
|
|
|
166
177
|
n = s[/\d+/,0].to_i
|
|
167
178
|
pipe = s[/[|>].*$/,0] || '| less'
|
|
168
179
|
link = links[n - 1]
|
|
169
|
-
cmd = "(echo \"#{link}\n\n\";
|
|
180
|
+
cmd = "(echo \"#{link}\n\n\"; #{html_dump_program} '#{link}') #{pipe}"
|
|
170
181
|
system cmd
|
|
171
182
|
}
|
|
172
183
|
end
|
|
173
184
|
|
|
174
185
|
if options[:elinks]
|
|
175
186
|
$stdout.close
|
|
176
|
-
exec "mv #{$tempfile.path}{,.html} &&
|
|
187
|
+
exec "mv #{$tempfile.path}{,.html} && #{html_dump_program.split(' ')[0]} #{$tempfile.path}.html"
|
|
177
188
|
end
|
|
178
189
|
|
data/lib/goog.rb
CHANGED
data/plugin/goog.vim
CHANGED
|
@@ -12,7 +12,9 @@ let s:http_link_pattern = '^https\?:[^ >)\]]\+'
|
|
|
12
12
|
|
|
13
13
|
let g:gui_web_browser = system("echo -n $(which gnome-open || which open)")
|
|
14
14
|
if ! exists("g:text_web_browser")
|
|
15
|
-
if executable("
|
|
15
|
+
if executable("w3m")
|
|
16
|
+
let g:text_web_browser = 'w3m -dump'
|
|
17
|
+
elseif executable("elinks")
|
|
16
18
|
let g:text_web_browser = 'elinks -dump -no-numbering'
|
|
17
19
|
elseif executable("lynx")
|
|
18
20
|
let g:text_web_browser = 'lynx -dump -nonumbers'
|
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.2.
|
|
4
|
+
version: 0.2.8
|
|
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:
|
|
12
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|