ruby-zoom 5.3.0 → 5.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 142f012f19627bbd7fd91f9177af11aa8bef1e4f7c4a06f269775ee64c9d9c85
4
- data.tar.gz: a558e2fb27f3b7dd5a6054ba75eb869b979f9225db56b2ec955ecaafbed5f8d2
3
+ metadata.gz: d301bb2829817c9b24659d6d0cbc3fed7a52b4935fee6dad807535e5644d5d5a
4
+ data.tar.gz: 8d239791a5c6c86e374227f91637ddf266bc6b38f3f386d5af03a3de0fe05be4
5
5
  SHA512:
6
- metadata.gz: d609b04d7b73b15909642f2542b4178e8339d6ff2570270973bfffc02cbf8456e1449b15a6d18fe19ecb46668c48e81f8ee5ae6ccff55121cbd945a3382c68b9
7
- data.tar.gz: df9abdb6910f1543cce1a03e9756ded0e668a38872a9946a436718ab3dc8306a214dd13a438cb09c7b783d70b349ce194bf06543e2de5b54178794ceefb5ee13
6
+ metadata.gz: 1e44a8a5f10f3b319ae0f4c610819781fea1cdfaa6c7dfebaebab266bdeb189335a8640892715c743d82e4f1cb5fd8301c21a48ae3cb92682bc2c6080086ec1b
7
+ data.tar.gz: a939ba6fa4bb8593758ffde341d0591a8896ee24de27a5a71216ccd369c81d817ee93a7c80333513be3c96c5153e17eca38b11e0aac39668bf914570a666e45d
data/bin/z CHANGED
@@ -320,7 +320,7 @@ options = parse(ARGV)
320
320
 
321
321
  begin
322
322
  if (options["action"] == "rc")
323
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
323
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
324
324
  end
325
325
 
326
326
  Zoom::ProfileManager.force_tool(options["tool"])
data/bin/zc CHANGED
@@ -320,7 +320,7 @@ options = parse(ARGV)
320
320
 
321
321
  begin
322
322
  if (options["action"] == "rc")
323
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
323
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
324
324
  end
325
325
 
326
326
  Zoom::ProfileManager.force_tool(options["tool"])
data/bin/zf CHANGED
@@ -320,7 +320,7 @@ options = parse(ARGV)
320
320
 
321
321
  begin
322
322
  if (options["action"] == "rc")
323
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
323
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
324
324
  end
325
325
 
326
326
  Zoom::ProfileManager.force_tool(options["tool"])
data/bin/zg CHANGED
@@ -320,7 +320,7 @@ options = parse(ARGV)
320
320
 
321
321
  begin
322
322
  if (options["action"] == "rc")
323
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
323
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
324
324
  end
325
325
 
326
326
  Zoom::ProfileManager.force_tool(options["tool"])
data/bin/zl CHANGED
@@ -320,7 +320,7 @@ options = parse(ARGV)
320
320
 
321
321
  begin
322
322
  if (options["action"] == "rc")
323
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
323
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
324
324
  end
325
325
 
326
326
  Zoom::ProfileManager.force_tool(options["tool"])
data/bin/zr CHANGED
@@ -320,7 +320,7 @@ options = parse(ARGV)
320
320
 
321
321
  begin
322
322
  if (options["action"] == "rc")
323
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
323
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
324
324
  end
325
325
 
326
326
  Zoom::ProfileManager.force_tool(options["tool"])
@@ -49,13 +49,26 @@ class Zoom::Editor
49
49
  @editor= "vi" if (ScoobyDoo.where_are_you(@editor).nil?)
50
50
  @flags = ""
51
51
  end
52
+
53
+ # In case of vim server functionality
54
+ @vimserver = ""
55
+ @flags.match(/--servername\s+["']?([^"' ]+)/) do |m|
56
+ @vimserver = m[1]
57
+ end
58
+
59
+ # In case of vim remote functionality
60
+ if (!@vimserver.empty?)
61
+ @flags.match(/(--remote(-tab)?(-wait)?(-silent)?)/) do |m|
62
+ @flags.gsub!(/#{m[1]}/, "")
63
+ end
64
+ end
52
65
  end
53
66
 
54
67
  def open(results)
55
68
  return if (results.nil? || results.empty?)
56
69
 
57
70
  case @editor
58
- when /vim?$/
71
+ when /vim$/
59
72
  vim(results)
60
73
  else
61
74
  default(results)
@@ -83,6 +96,8 @@ class Zoom::Editor
83
96
  private :open_result
84
97
 
85
98
  def vim(results)
99
+ already_started = vim_remote_started?
100
+
86
101
  quickfix = Pathname.new("~/.cache/zoom/quickfix").expand_path
87
102
  source = Pathname.new("~/.cache/zoom/source").expand_path
88
103
  FileUtils.mkdir_p(quickfix.dirname)
@@ -101,7 +116,7 @@ class Zoom::Editor
101
116
  "nnoremap zp :cp<cr>",
102
117
  ""
103
118
  ].join("\n")
104
- zs.write(vimscript)
119
+ zs.write(vimscript) if (!already_started)
105
120
 
106
121
  files = Array.new
107
122
  results.each do |result|
@@ -124,6 +139,7 @@ class Zoom::Editor
124
139
 
125
140
  if (!files.include?(filename))
126
141
  files.push(filename)
142
+ zs.write("edit! #{filename}\n")
127
143
  zs.write("#{lineno}\nbnext\n") if (result.grep_like?)
128
144
  end
129
145
 
@@ -131,16 +147,42 @@ class Zoom::Editor
131
147
  zq.write("#{filename}:#{lineno}: #{match}\n")
132
148
  end
133
149
  end
134
- zs.write("silent cfile #{quickfix}\n")
150
+
151
+ if (!already_started)
152
+ zs.write("silent cfile #{quickfix}\n")
153
+ else
154
+ results.each do |result|
155
+ zs.write("bprev\n") if (result.grep_like?)
156
+ end
157
+ zs.write("silent caddf #{quickfix}\n")
158
+ end
135
159
 
136
160
  zq.close
137
161
  zs.close
138
162
 
139
- system(
140
- "#{@editor} #{@flags} -S #{source} '#{files.join("' '")}'"
141
- )
163
+ if (!already_started)
164
+ system("#{@editor} -c \"source #{source}\" #{@flags}")
165
+ FileUtils.rm_f(quickfix)
166
+ FileUtils.rm_f(source)
167
+ else
168
+ system(
169
+ [
170
+ @editor,
171
+ @flags,
172
+ "--remote-send \":source #{source}\n\""
173
+ ].join(" ")
174
+ )
175
+ end
176
+ end
142
177
 
143
- FileUtils.rm_f(quickfix)
144
- FileUtils.rm_f(source)
178
+ def vim_remote_started?
179
+ return false if (@vimserver.empty?)
180
+ %x(#{@editor} --serverlist).downcase.match(
181
+ /^#{@vimserver}$/
182
+ ) do
183
+ return true
184
+ end
185
+ return false
145
186
  end
187
+ private :vim_remote_started?
146
188
  end
@@ -15,7 +15,7 @@ class ResetWish < Djinni::Wish
15
15
  return
16
16
  end
17
17
 
18
- FileUtils.rm_f(Pathname.new("~/.zoomrc").expand_path)
18
+ FileUtils.rm_f(Pathname.new("~/.config/zoom/rc").expand_path)
19
19
  config = djinni_env["config"]
20
20
  config.default
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-zoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-21 00:00:00.000000000 Z
11
+ date: 2019-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest