vimamsa 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/custom_example.rb +5 -0
- data/lib/vimamsa/ack.rb +3 -4
- data/lib/vimamsa/audio.rb +25 -1
- data/lib/vimamsa/buffer.rb +43 -566
- data/lib/vimamsa/buffer_changetext.rb +255 -0
- data/lib/vimamsa/buffer_cursor.rb +303 -0
- data/lib/vimamsa/buffer_list.rb +26 -9
- data/lib/vimamsa/buffer_manager.rb +4 -2
- data/lib/vimamsa/clipboard.rb +35 -0
- data/lib/vimamsa/conf.rb +130 -5
- data/lib/vimamsa/debug.rb +4 -8
- data/lib/vimamsa/editor.rb +41 -78
- data/lib/vimamsa/encrypt.rb +6 -11
- data/lib/vimamsa/file_manager.rb +138 -9
- data/lib/vimamsa/gui.rb +3 -32
- data/lib/vimamsa/gui_dialog.rb +113 -0
- data/lib/vimamsa/gui_sourceview.rb +10 -14
- data/lib/vimamsa/gui_text.rb +19 -0
- data/lib/vimamsa/hyper_plain_text.rb +8 -5
- data/lib/vimamsa/key_actions.rb +17 -197
- data/lib/vimamsa/key_binding_tree.rb +49 -31
- data/lib/vimamsa/key_bindings_vimlike.rb +30 -30
- data/lib/vimamsa/macro.rb +35 -25
- data/lib/vimamsa/main.rb +3 -10
- data/lib/vimamsa/rbvma.rb +11 -11
- data/lib/vimamsa/search.rb +1 -1
- data/lib/vimamsa/search_replace.rb +89 -151
- data/lib/vimamsa/terminal.rb +22 -0
- data/lib/vimamsa/tests.rb +122 -0
- data/lib/vimamsa/util.rb +33 -3
- data/lib/vimamsa/version.rb +1 -1
- data/vimamsa.gemspec +3 -1
- metadata +56 -7
- /data/lib/vimamsa/{form_generator.rb → gui_form_generator.rb} +0 -0
@@ -62,62 +62,103 @@ class FileSelector
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
#
|
68
|
-
gui_one_input_action("Grep", "Search:", "grep", callback)
|
69
|
-
end
|
65
|
+
class Grep
|
66
|
+
attr_reader :buf
|
67
|
+
@@cur = nil # Current object of class
|
70
68
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
69
|
+
def self.cur()
|
70
|
+
return @@cur
|
71
|
+
end
|
74
72
|
|
75
|
-
|
73
|
+
def self.init()
|
74
|
+
vma.kbd.add_minor_mode("grep", :grep, :command)
|
75
|
+
|
76
|
+
if cnf.experimental?
|
77
|
+
bindkey "grep shift!", [:grep_apply_changes, proc {
|
78
|
+
if vma.buf.module.class == Grep
|
79
|
+
vma.buf.module.apply_changes
|
80
|
+
else
|
81
|
+
debug vma.buf.module, 2
|
82
|
+
message("ERROR")
|
83
|
+
end
|
84
|
+
}, "Write changes edited in grep buffer to the underlying file"]
|
85
|
+
end
|
86
|
+
vma.kbd.add_minor_mode("bmgr", :buf_mgr, :command)
|
87
|
+
reg_act(:grep_buffer, proc { Grep.new.run }, "Grep current buffer")
|
76
88
|
|
77
|
-
|
78
|
-
tt.weight = 650
|
79
|
-
tt.foreground = color
|
89
|
+
bindkey "C , g", :grep_buffer
|
80
90
|
|
81
|
-
|
82
|
-
ind.each { |x|
|
83
|
-
itr = vbuf.get_iter_at(:offset => x)
|
84
|
-
itr2 = vbuf.get_iter_at(:offset => x + str.size)
|
85
|
-
vbuf.apply_tag(tt, itr, itr2)
|
86
|
-
}
|
87
|
-
end
|
91
|
+
end
|
88
92
|
|
89
|
-
def
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
def apply_changes()
|
94
|
+
b = @orig_buf
|
95
|
+
gb = vma.buf
|
96
|
+
changed = 0
|
97
|
+
gb.lines.each { |x|
|
98
|
+
if m = x.match(/(\d+):(.*)/m)
|
99
|
+
lineno = m[1].to_i
|
100
|
+
newl = m[2]
|
101
|
+
r = @orig_buf.line_range(lineno - 1, 1)
|
102
|
+
old = @orig_buf[r.first..r.last]
|
103
|
+
if old != newl
|
104
|
+
@orig_buf.replace_range(r, newl)
|
105
|
+
changed += 1
|
106
|
+
end
|
107
|
+
end
|
108
|
+
}
|
109
|
+
message("GREP: apply changes, #{changed} changed lines")
|
110
|
+
end
|
96
111
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
res_str << "#{i + 1}:"
|
102
|
-
# ind = scan_indexes(l, r)
|
103
|
-
res_str << "#{l}\n"
|
104
|
-
$grep_matches << i + 1 # Lines start from index 1
|
105
|
-
end
|
106
|
-
}
|
107
|
-
$grep_bufid = vma.buffers.current_buf
|
108
|
-
b = create_new_buffer(res_str, "grep")
|
109
|
-
vbuf = vma.gui.view.buffer
|
112
|
+
def initialize()
|
113
|
+
@buf = nil
|
114
|
+
@line_to_id = {}
|
115
|
+
end
|
110
116
|
|
111
|
-
|
117
|
+
def callback(search_str, b = nil)
|
118
|
+
debug "grep_cur_buffer(search_str)"
|
119
|
+
lines = vma.buf.split("\n")
|
120
|
+
r = Regexp.new(Regexp.escape(search_str), Regexp::IGNORECASE)
|
121
|
+
fpath = ""
|
122
|
+
fpath = vma.buf.pathname.expand_path.to_s + ":" if vma.buf.pathname
|
123
|
+
res_str = ""
|
124
|
+
|
125
|
+
hlparts = []
|
126
|
+
@grep_matches = []
|
127
|
+
lines.each_with_index { |l, i|
|
128
|
+
if r.match(l)
|
129
|
+
res_str << "#{i + 1}:"
|
130
|
+
# ind = scan_indexes(l, r)
|
131
|
+
res_str << "#{l}\n"
|
132
|
+
@grep_matches << i + 1 # Lines start from index 1
|
133
|
+
end
|
134
|
+
}
|
135
|
+
$grep_bufid = vma.buffers.current_buf
|
136
|
+
@orig_buf = vma.buf
|
137
|
+
b = create_new_buffer(res_str, "grep")
|
138
|
+
vbuf = vma.gui.view.buffer
|
139
|
+
|
140
|
+
Gui.highlight_match(b, search_str, color: cnf.match.highlight.color!)
|
141
|
+
b.default_mode = :grep
|
142
|
+
b.module = self
|
143
|
+
|
144
|
+
vma.kbd.set_mode(:grep) #TODO: allow to work with other keybindings also
|
145
|
+
vma.kbd.set_default_mode(:grep)
|
146
|
+
b.line_action_handler = proc { |lineno|
|
147
|
+
debug "GREP HANDLER:#{lineno}"
|
148
|
+
jumpto = @grep_matches[lineno]
|
149
|
+
if jumpto.class == Integer
|
150
|
+
# vma.buffers.set_current_buffer($grep_bufid, update_history = true)
|
151
|
+
# buf.jump_to_line(jumpto)
|
152
|
+
vma.buffers.set_current_buffer_by_id(@orig_buf.id)
|
153
|
+
@orig_buf.jump_to_line(jumpto)
|
154
|
+
end
|
155
|
+
}
|
156
|
+
end
|
112
157
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
vma.buffers.set_current_buffer($grep_bufid, update_history = true)
|
118
|
-
buf.jump_to_line(jumpto)
|
119
|
-
end
|
120
|
-
}
|
158
|
+
def run()
|
159
|
+
callb = self.method("callback")
|
160
|
+
gui_one_input_action("Grep", "Search:", "grep", callb)
|
161
|
+
end
|
121
162
|
end
|
122
163
|
|
123
164
|
def gui_one_input_action(title, field_label, button_title, callback, opt = {})
|
@@ -184,106 +225,3 @@ def buf_replace_string(instr)
|
|
184
225
|
end
|
185
226
|
buf_replace(a[0], a[1])
|
186
227
|
end
|
187
|
-
|
188
|
-
module Gtk
|
189
|
-
class Frame
|
190
|
-
def margin=(a)
|
191
|
-
self.margin_bottom = a
|
192
|
-
self.margin_top = a
|
193
|
-
self.margin_end = a
|
194
|
-
self.margin_start = a
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
class Box
|
199
|
-
def margin=(a)
|
200
|
-
self.margin_bottom = a
|
201
|
-
self.margin_top = a
|
202
|
-
self.margin_end = a
|
203
|
-
self.margin_start = a
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
def set_margin_all(widget, m)
|
209
|
-
widget.margin_bottom = m
|
210
|
-
widget.margin_top = m
|
211
|
-
widget.margin_end = m
|
212
|
-
widget.margin_start = m
|
213
|
-
end
|
214
|
-
|
215
|
-
class OneInputAction
|
216
|
-
def initialize(main_window, title, field_label, button_title, callback, opt = {})
|
217
|
-
@window = Gtk::Window.new()
|
218
|
-
# @window.screen = main_window.screen
|
219
|
-
# @window.title = title
|
220
|
-
@window.title = ""
|
221
|
-
|
222
|
-
frame = Gtk::Frame.new()
|
223
|
-
# frame.margin = 20
|
224
|
-
@window.set_child(frame)
|
225
|
-
|
226
|
-
infolabel = Gtk::Label.new
|
227
|
-
infolabel.markup = title
|
228
|
-
|
229
|
-
vbox = Gtk::Box.new(:vertical, 8)
|
230
|
-
vbox.margin = 10
|
231
|
-
frame.set_child(vbox)
|
232
|
-
|
233
|
-
hbox = Gtk::Box.new(:horizontal, 8)
|
234
|
-
# @window.add(hbox)
|
235
|
-
vbox.pack_end(infolabel, :expand => false, :fill => false, :padding => 0)
|
236
|
-
vbox.pack_end(hbox, :expand => false, :fill => false, :padding => 0)
|
237
|
-
|
238
|
-
button = Gtk::Button.new(:label => button_title)
|
239
|
-
cancel_button = Gtk::Button.new(:label => "Cancel")
|
240
|
-
|
241
|
-
label = Gtk::Label.new(field_label)
|
242
|
-
|
243
|
-
@entry1 = Gtk::Entry.new
|
244
|
-
|
245
|
-
if opt[:hide]
|
246
|
-
@entry1.visibility = false
|
247
|
-
end
|
248
|
-
|
249
|
-
button.signal_connect "clicked" do
|
250
|
-
callback.call(@entry1.text)
|
251
|
-
@window.destroy
|
252
|
-
end
|
253
|
-
|
254
|
-
cancel_button.signal_connect "clicked" do
|
255
|
-
@window.destroy
|
256
|
-
end
|
257
|
-
|
258
|
-
press = Gtk::EventControllerKey.new
|
259
|
-
press.set_propagation_phase(Gtk::PropagationPhase::CAPTURE)
|
260
|
-
@window.add_controller(press)
|
261
|
-
press.signal_connect "key-pressed" do |gesture, keyval, keycode, y|
|
262
|
-
if keyval == Gdk::Keyval::KEY_Return
|
263
|
-
callback.call(@entry1.text)
|
264
|
-
@window.destroy
|
265
|
-
true
|
266
|
-
elsif keyval == Gdk::Keyval::KEY_Escape
|
267
|
-
@window.destroy
|
268
|
-
true
|
269
|
-
else
|
270
|
-
false
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
hbox.pack_end(label, :expand => false, :fill => false, :padding => 0)
|
275
|
-
hbox.pack_end(@entry1, :expand => false, :fill => false, :padding => 0)
|
276
|
-
hbox.pack_end(button, :expand => false, :fill => false, :padding => 0)
|
277
|
-
hbox.pack_end(cancel_button, :expand => false, :fill => false, :padding => 0)
|
278
|
-
return
|
279
|
-
end
|
280
|
-
|
281
|
-
def run
|
282
|
-
if !@window.visible?
|
283
|
-
@window.show
|
284
|
-
else
|
285
|
-
@window.destroy
|
286
|
-
end
|
287
|
-
@window
|
288
|
-
end
|
289
|
-
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
def exec_in_terminal(cmd, autoclose = false)
|
2
|
+
# debug "CMD:#{cmd}"
|
3
|
+
|
4
|
+
# global to prevent garbage collect unlink
|
5
|
+
$initf = Tempfile.new("bashinit")
|
6
|
+
# debug $initf.path
|
7
|
+
$initf.write(cmd)
|
8
|
+
if autoclose
|
9
|
+
$initf.write("\nsleep 10; exit;\n")
|
10
|
+
$initf.write("rm #{$initf.path}\n")
|
11
|
+
else
|
12
|
+
$initf.write("rm #{$initf.path}\n")
|
13
|
+
$initf.write("\nexec bash\n")
|
14
|
+
end
|
15
|
+
$initf.close
|
16
|
+
# PTY.spawn("gnome-terminal", "--tab", "--", "bash", "-i", $initf.path, "-c", "exec bash")
|
17
|
+
# fork { exec "gnome-terminal", "--tab", "--", "bash", "-i", $initf.path, "-c", "exec bash" }
|
18
|
+
# Just another execution
|
19
|
+
fork { exec "gnome-terminal", "--tab", "--", "bash", "-i", $initf.path, "-c", "exec bash" }
|
20
|
+
end
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require "digest"
|
2
|
+
|
3
|
+
def run_tests()
|
4
|
+
tests = ["test_paste_0","test_delete_0"]
|
5
|
+
stats = []
|
6
|
+
for t in tests
|
7
|
+
r = eval(t)
|
8
|
+
if r == true
|
9
|
+
stats << "test #{t} OK"
|
10
|
+
else
|
11
|
+
stats << "test #{t} FAILED"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
debug "TEST RESULTS:",2
|
15
|
+
puts stats.join("\n")
|
16
|
+
puts "===================="
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
#
|
22
|
+
|
23
|
+
def test_paste_0(runmacro = true)
|
24
|
+
b = create_new_buffer(file_contents = "\n", prefix = "buf", setcurrent = true)
|
25
|
+
|
26
|
+
b.insert_txt(JABBERWOCKY)
|
27
|
+
b.insert_txt(LOREM_IPSUM)
|
28
|
+
b.insert_txt(LOREM_IPSUM)
|
29
|
+
|
30
|
+
macro = ["buf.jump(START_OF_BUFFER)", "buf.copy_line", :forward_line, :paste_after, :backward_line, :backward_line, "buf.paste(BEFORE)", :forward_line, :forward_line, :forward_line, :forward_line, "buf.jump_word(FORWARD,WORD_START)", "buf.start_visual_mode", "buf.jump_word(FORWARD,WORD_END)", "buf.copy_active_selection()", "buf.move(FORWARD_CHAR)", "buf.paste(BEFORE)", "buf.jump_word(FORWARD,WORD_END)", :paste_after, :forward_line, "buf.jump(BEGINNING_OF_LINE)", "buf.copy_line", :forward_line, :forward_line, :paste_after, :paste_after, :forward_line, "buf.jump_word(FORWARD,WORD_START)", "buf.start_visual_mode", "buf.jump_word(FORWARD,WORD_END)", "buf.jump_word(FORWARD,WORD_END)", "buf.jump_word(FORWARD,WORD_END)", "buf.jump_word(FORWARD,WORD_END)", "buf.jump(END_OF_LINE)", :e_move_backward_char, "buf.copy_active_selection()", :forward_line, "buf.paste(BEFORE)", "buf.paste(BEFORE)", "buf.paste(BEFORE)", "buf.paste(BEFORE)", "buf.jump(END_OF_BUFFER)", "buf.jump(BEGINNING_OF_LINE)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.start_visual_mode", "buf.jump_word(FORWARD,WORD_END)", "buf.jump_word(FORWARD,WORD_END)", "buf.jump_word(FORWARD,WORD_END)", "buf.jump_word(FORWARD,WORD_END)", "buf.copy_active_selection()", "buf.jump(BEGINNING_OF_LINE)", "buf.paste(BEFORE)", "buf.paste(BEFORE)"]
|
31
|
+
|
32
|
+
macro_r = true
|
33
|
+
if runmacro
|
34
|
+
macro_r = vma.macro.run_actions(macro)
|
35
|
+
end
|
36
|
+
|
37
|
+
hex = Digest::SHA2.hexdigest b.to_s
|
38
|
+
conds = [hex == "705061f7bc6370b501b6d09615547530a103e2a659e20fb6915d17ae65f564fa",
|
39
|
+
macro_r == true]
|
40
|
+
# debug conds
|
41
|
+
debug hex
|
42
|
+
|
43
|
+
if conds.include?(false)
|
44
|
+
return false
|
45
|
+
else
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def macro_test(macro, correct_hex, runmacro=true)
|
51
|
+
b = create_new_buffer(file_contents = "\n", prefix = "buf", setcurrent = true)
|
52
|
+
b.insert_txt(JABBERWOCKY)
|
53
|
+
b.insert_txt(LOREM_IPSUM)
|
54
|
+
b.insert_txt(LOREM_IPSUM)
|
55
|
+
|
56
|
+
macro_r = true
|
57
|
+
if runmacro
|
58
|
+
macro_r = vma.macro.run_actions(macro)
|
59
|
+
end
|
60
|
+
|
61
|
+
hex = Digest::SHA2.hexdigest b.to_s
|
62
|
+
conds = [hex == correct_hex,
|
63
|
+
macro_r == true]
|
64
|
+
# debug conds
|
65
|
+
debug hex
|
66
|
+
|
67
|
+
if conds.include?(false)
|
68
|
+
return false
|
69
|
+
else
|
70
|
+
return true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_delete_0
|
75
|
+
macro = ["buf.jump(START_OF_BUFFER)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", :e_move_backward_char, "buf.delete(BACKWARD_CHAR)", "buf.delete(BACKWARD_CHAR)", "buf.delete(BACKWARD_CHAR)", "buf.delete(BACKWARD_CHAR)", "buf.delete(BACKWARD_CHAR)", "buf.delete(BACKWARD_CHAR)", :forward_line, :e_move_backward_char, "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", "buf.delete(CURRENT_CHAR_FORWARD)", :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, :delete_line, :forward_line, :delete_line, :forward_line, :forward_line, :delete_line, :delete_line, :forward_line, :forward_line, "vma.kbd.set_mode(:audio)", :forward_line, :forward_line, :forward_line, :forward_line, "buf.delete2(:to_mark,'a')", :backward_line, :forward_line, :forward_line, "vma.kbd.set_mode(:audio)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.jump_word(FORWARD,WORD_START)", "buf.delete2(:to_mark,'a')", "buf.mark_current_position('b')", :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, :forward_line, "buf.delete2(:to_mark,'a')", "vma.kbd.set_mode(:audio)", :forward_line, :forward_line, :forward_line, "buf.jump_to_mark('a')", "buf.jump_to_mark('a')", :backward_line, :backward_line, :backward_line, :backward_line, "buf.jump_to_mark('a')", "buf.jump_to_mark('a')", "buf.jump_to_mark('a')", "buf.jump_to_mark('a')"]
|
76
|
+
return macro_test(macro, "71bc0421b47549267b327b69216ad8e042379625f99de1ba4faaa30d5042c22d")
|
77
|
+
end
|
78
|
+
|
79
|
+
LOREM_IPSUM = "
|
80
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
81
|
+
|
82
|
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst."
|
83
|
+
|
84
|
+
JABBERWOCKY = "
|
85
|
+
’Twas brillig, and the slithy toves
|
86
|
+
Did gyre and gimble in the wabe:
|
87
|
+
All mimsy were the borogoves,
|
88
|
+
And the mome raths outgrabe.
|
89
|
+
|
90
|
+
“Beware the Jabberwock, my son!
|
91
|
+
The jaws that bite, the claws that catch!
|
92
|
+
Beware the Jubjub bird, and shun
|
93
|
+
The frumious Bandersnatch!”
|
94
|
+
|
95
|
+
He took his vorpal sword in hand;
|
96
|
+
Long time the manxome foe he sought—
|
97
|
+
So rested he by the Tumtum tree
|
98
|
+
And stood awhile in thought.
|
99
|
+
|
100
|
+
And, as in uffish thought he stood,
|
101
|
+
The Jabberwock, with eyes of flame,
|
102
|
+
Came whiffling through the tulgey wood,
|
103
|
+
And burbled as it came!
|
104
|
+
|
105
|
+
One, two! One, two! And through and through
|
106
|
+
The vorpal blade went snicker-snack!
|
107
|
+
He left it dead, and with its head
|
108
|
+
He went galumphing back.
|
109
|
+
|
110
|
+
“And hast thou slain the Jabberwock?
|
111
|
+
Come to my arms, my beamish boy!
|
112
|
+
O frabjous day! Callooh! Callay!”
|
113
|
+
He chortled in his joy.
|
114
|
+
|
115
|
+
’Twas brillig, and the slithy toves
|
116
|
+
Did gyre and gimble in the wabe:
|
117
|
+
All mimsy were the borogoves,
|
118
|
+
And the mome raths outgrabe.
|
119
|
+
"
|
120
|
+
|
121
|
+
|
122
|
+
|
data/lib/vimamsa/util.rb
CHANGED
@@ -1,11 +1,43 @@
|
|
1
1
|
require "open3"
|
2
2
|
|
3
|
+
# Get all indexes for start of matching regexp
|
4
|
+
def scan_indexes(txt, regex)
|
5
|
+
# indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) + 1 }
|
6
|
+
indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) }
|
7
|
+
return indexes
|
8
|
+
end
|
9
|
+
|
10
|
+
def file_mime_type(fpath)
|
11
|
+
fpath = File.expand_path(fpath)
|
12
|
+
return false if !File.readable?(fpath)
|
13
|
+
r = exec_cmd("file", "--mime-type", "--mime-encoding", fpath)
|
14
|
+
return false if r.class != String
|
15
|
+
return false if r.size < 2
|
16
|
+
m = r.match(".*:\s*(.*)")
|
17
|
+
mimetype = m[1].match(/(.*);/)
|
18
|
+
charset = m[1].match(/charset=(.*)/)
|
19
|
+
return [mimetype, charset]
|
20
|
+
end
|
21
|
+
|
22
|
+
def file_is_text_file(fpath)
|
23
|
+
debug "file_is_text_file(#{fpath})"
|
24
|
+
fpath = File.expand_path(fpath)
|
25
|
+
return false if !File.exist?(fpath)
|
26
|
+
r = exec_cmd("file", fpath)
|
27
|
+
debug "DEBUG:#{r}"
|
28
|
+
return true if r.match(/UTF-8.*text/)
|
29
|
+
return true if r.match(/ASCII.*text/)
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
|
33
|
+
# file --mime-type --mime-encoding
|
3
34
|
|
4
35
|
# Run idle proc once
|
5
36
|
# Delay execution of proc until Gtk has fully processed the last calls.
|
6
|
-
def run_as_idle(p)
|
37
|
+
def run_as_idle(p, delay: 0.0)
|
7
38
|
if p.class == Proc
|
8
39
|
Thread.new {
|
40
|
+
sleep delay
|
9
41
|
GLib::Idle.add(proc { p.call; false })
|
10
42
|
}
|
11
43
|
end
|
@@ -192,8 +224,6 @@ def sanitize_input(str)
|
|
192
224
|
return str
|
193
225
|
end
|
194
226
|
|
195
|
-
|
196
|
-
|
197
227
|
def is_url(s)
|
198
228
|
return s.match(/(https?|file):\/\/.*/) != nil
|
199
229
|
end
|
data/lib/vimamsa/version.rb
CHANGED
data/vimamsa.gemspec
CHANGED
@@ -29,11 +29,13 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency 'ripl-multi_line', '~> 0.3.1'
|
30
30
|
spec.add_runtime_dependency 'gdk4', '~> 4.2.0'
|
31
31
|
spec.add_runtime_dependency 'gtk4', '~> 4.2.0'
|
32
|
+
spec.add_runtime_dependency 'rake', '~> 13.1.0'
|
32
33
|
spec.add_runtime_dependency 'differ', '~> 0.1.2'
|
33
34
|
spec.add_runtime_dependency 'gtksourceview5', '~> 4.2.0'
|
34
35
|
spec.add_runtime_dependency 'parallel', '~> 1.14' #TODO: update?
|
35
36
|
spec.add_runtime_dependency 'listen', '~> 3.4' #TODO: update?
|
36
|
-
|
37
|
+
spec.add_runtime_dependency 'language_server-protocol', '~> 3.17.0.3'
|
38
|
+
spec.add_runtime_dependency 'gstreamer', '~> 4.2.0'
|
37
39
|
|
38
40
|
spec.extensions = ["ext/vmaext/extconf.rb"]
|
39
41
|
spec.licenses = ['GPL-3.0+']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimamsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sami Sieranoja
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 4.2.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 13.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 13.1.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: differ
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +178,34 @@ dependencies:
|
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '3.4'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: language_server-protocol
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 3.17.0.3
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 3.17.0.3
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: gstreamer
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 4.2.0
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 4.2.0
|
167
209
|
description: Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby
|
168
210
|
and GTK.
|
169
211
|
email:
|
@@ -192,8 +234,11 @@ files:
|
|
192
234
|
- lib/vimamsa/actions.rb
|
193
235
|
- lib/vimamsa/audio.rb
|
194
236
|
- lib/vimamsa/buffer.rb
|
237
|
+
- lib/vimamsa/buffer_changetext.rb
|
238
|
+
- lib/vimamsa/buffer_cursor.rb
|
195
239
|
- lib/vimamsa/buffer_list.rb
|
196
240
|
- lib/vimamsa/buffer_manager.rb
|
241
|
+
- lib/vimamsa/clipboard.rb
|
197
242
|
- lib/vimamsa/conf.rb
|
198
243
|
- lib/vimamsa/constants.rb
|
199
244
|
- lib/vimamsa/debug.rb
|
@@ -203,12 +248,14 @@ files:
|
|
203
248
|
- lib/vimamsa/file_finder.rb
|
204
249
|
- lib/vimamsa/file_history.rb
|
205
250
|
- lib/vimamsa/file_manager.rb
|
206
|
-
- lib/vimamsa/form_generator.rb
|
207
251
|
- lib/vimamsa/gui.rb
|
252
|
+
- lib/vimamsa/gui_dialog.rb
|
253
|
+
- lib/vimamsa/gui_form_generator.rb
|
208
254
|
- lib/vimamsa/gui_image.rb
|
209
255
|
- lib/vimamsa/gui_menu.rb
|
210
256
|
- lib/vimamsa/gui_select_window.rb
|
211
257
|
- lib/vimamsa/gui_sourceview.rb
|
258
|
+
- lib/vimamsa/gui_text.rb
|
212
259
|
- lib/vimamsa/hook.rb
|
213
260
|
- lib/vimamsa/hyper_plain_text.rb
|
214
261
|
- lib/vimamsa/key_actions.rb
|
@@ -220,6 +267,8 @@ files:
|
|
220
267
|
- lib/vimamsa/rbvma.rb
|
221
268
|
- lib/vimamsa/search.rb
|
222
269
|
- lib/vimamsa/search_replace.rb
|
270
|
+
- lib/vimamsa/terminal.rb
|
271
|
+
- lib/vimamsa/tests.rb
|
223
272
|
- lib/vimamsa/text_transforms.rb
|
224
273
|
- lib/vimamsa/util.rb
|
225
274
|
- lib/vimamsa/version.rb
|
@@ -232,7 +281,7 @@ homepage: https://github.com/SamiSieranoja/vimamsa
|
|
232
281
|
licenses:
|
233
282
|
- GPL-3.0+
|
234
283
|
metadata: {}
|
235
|
-
post_install_message:
|
284
|
+
post_install_message:
|
236
285
|
rdoc_options: []
|
237
286
|
require_paths:
|
238
287
|
- lib
|
@@ -248,8 +297,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
297
|
- !ruby/object:Gem::Version
|
249
298
|
version: '0'
|
250
299
|
requirements: []
|
251
|
-
rubygems_version: 3.
|
252
|
-
signing_key:
|
300
|
+
rubygems_version: 3.3.26
|
301
|
+
signing_key:
|
253
302
|
specification_version: 4
|
254
303
|
summary: Vimamsa
|
255
304
|
test_files: []
|
File without changes
|