vimamsa 0.1.22 → 0.1.24
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 +4 -4
- data/.dockerignore +32 -0
- data/Dockerfile +45 -0
- data/README.md +2 -2
- data/custom_example.rb +38 -9
- data/docker_cmd.sh +7 -0
- data/exe/run_tests.rb +23 -0
- data/img/screenshot1.png +0 -0
- data/img/screenshot2.png +0 -0
- data/lib/vimamsa/actions.rb +8 -0
- data/lib/vimamsa/buffer.rb +165 -53
- data/lib/vimamsa/buffer_changetext.rb +68 -14
- data/lib/vimamsa/buffer_cursor.rb +9 -3
- data/lib/vimamsa/buffer_list.rb +14 -28
- data/lib/vimamsa/buffer_manager.rb +1 -1
- data/lib/vimamsa/conf.rb +33 -1
- data/lib/vimamsa/diff_buffer.rb +185 -0
- data/lib/vimamsa/editor.rb +149 -80
- data/lib/vimamsa/file_finder.rb +6 -2
- data/lib/vimamsa/gui.rb +330 -135
- data/lib/vimamsa/gui_dialog.rb +2 -0
- data/lib/vimamsa/gui_file_panel.rb +94 -0
- data/lib/vimamsa/gui_form_generator.rb +4 -2
- data/lib/vimamsa/gui_func_panel.rb +127 -0
- data/lib/vimamsa/gui_image.rb +2 -4
- data/lib/vimamsa/gui_menu.rb +54 -1
- data/lib/vimamsa/gui_select_window.rb +18 -6
- data/lib/vimamsa/gui_settings.rb +486 -0
- data/lib/vimamsa/gui_sourceview.rb +196 -8
- data/lib/vimamsa/gui_text.rb +0 -22
- data/lib/vimamsa/hyper_plain_text.rb +1 -0
- data/lib/vimamsa/key_actions.rb +54 -31
- data/lib/vimamsa/key_binding_tree.rb +154 -8
- data/lib/vimamsa/key_bindings_vimlike.rb +48 -35
- data/lib/vimamsa/langservp.rb +161 -7
- data/lib/vimamsa/macro.rb +54 -7
- data/lib/vimamsa/main.rb +1 -0
- data/lib/vimamsa/rbvma.rb +5 -0
- data/lib/vimamsa/string_util.rb +56 -0
- data/lib/vimamsa/test_framework.rb +137 -0
- data/lib/vimamsa/util.rb +3 -36
- data/lib/vimamsa/version.rb +1 -1
- data/modules/calculator/calculator.rb +318 -0
- data/modules/calculator/calculator_info.rb +3 -0
- data/modules/terminal/terminal.rb +140 -0
- data/modules/terminal/terminal_info.rb +3 -0
- data/run_tests.rb +89 -0
- data/styles/dark.xml +1 -1
- data/styles/molokai_edit.xml +2 -2
- data/tests/key_bindings.rb +2 -0
- data/tests/test_basic_editing.rb +86 -0
- data/tests/test_copy_paste.rb +88 -0
- data/tests/test_key_bindings.rb +152 -0
- data/tests/test_module_interface.rb +98 -0
- data/tests/test_undo.rb +201 -0
- data/vimamsa.gemspec +6 -5
- metadata +52 -14
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
class VSourceView < GtkSource::View
|
|
3
3
|
attr_accessor :bufo, :autocp_active, :cpl_list
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
# def initialize(title = nil,bufo=nil)
|
|
7
6
|
def initialize(title, bufo)
|
|
8
7
|
# super(:toplevel)
|
|
@@ -19,6 +18,7 @@ class VSourceView < GtkSource::View
|
|
|
19
18
|
@tt = nil
|
|
20
19
|
|
|
21
20
|
# Mainly after page-up or page-down
|
|
21
|
+
|
|
22
22
|
signal_connect("move-cursor") do |widget, event|
|
|
23
23
|
# if event.name == "GTK_MOVEMENT_PAGES" and (vma.actions.last_action == "page_up" or vma.actions.last_action == "page_down")
|
|
24
24
|
# handle_scrolling()
|
|
@@ -45,8 +45,90 @@ class VSourceView < GtkSource::View
|
|
|
45
45
|
@curpos_mark = nil
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# Replace each character of every «word with * so the GTK buffer never
|
|
49
|
+
# exposes the real content. Length is preserved → buffer offsets stay valid.
|
|
50
|
+
def mask_for_display(str)
|
|
51
|
+
str.gsub(/(?<=«)\S+/) { |w| "*" * w.length }
|
|
52
|
+
end
|
|
53
|
+
|
|
48
54
|
def set_content(str)
|
|
49
|
-
|
|
55
|
+
if @bufo&.lang == "hyperplaintext"
|
|
56
|
+
self.buffer.set_text(mask_for_display(str))
|
|
57
|
+
else
|
|
58
|
+
self.buffer.set_text(str)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Sync the GTK buffer to mask_for_display(@bufo.to_s).
|
|
63
|
+
# Handles both directions:
|
|
64
|
+
# - masks unmasked «word regions (e.g. after typing a new «)
|
|
65
|
+
# - unmasks orphaned *** spans left behind when « is deleted
|
|
66
|
+
def remask_gtk_buffer
|
|
67
|
+
return unless @bufo&.lang == "hyperplaintext"
|
|
68
|
+
ruby_text = @bufo.to_s
|
|
69
|
+
expected = mask_for_display(ruby_text)
|
|
70
|
+
gtk_text = buffer.text
|
|
71
|
+
return if expected == gtk_text
|
|
72
|
+
return if expected.length != gtk_text.length # sanity check
|
|
73
|
+
|
|
74
|
+
# Find the smallest enclosing differing range and fix it in one edit.
|
|
75
|
+
i = 0
|
|
76
|
+
i += 1 while i < expected.length && expected[i] == gtk_text[i]
|
|
77
|
+
j = expected.length - 1
|
|
78
|
+
j -= 1 while j >= i && expected[j] == gtk_text[j]
|
|
79
|
+
|
|
80
|
+
s_iter = buffer.get_iter_at(:offset => i)
|
|
81
|
+
e_iter = buffer.get_iter_at(:offset => j + 1)
|
|
82
|
+
buffer.delete(s_iter, e_iter)
|
|
83
|
+
buffer.insert(buffer.get_iter_at(:offset => i), expected[i..j])
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Returns [word, word_start, word_end] if +pos+ (Ruby-buffer offset) is
|
|
87
|
+
# inside a «word region, nil otherwise.
|
|
88
|
+
def masked_word_at_cursor(pos)
|
|
89
|
+
text = @bufo.to_s
|
|
90
|
+
return nil unless text.include?("«")
|
|
91
|
+
text.scan(/«(\S+)/) do
|
|
92
|
+
word = $1
|
|
93
|
+
word_start = $~.begin(0) + 1 # first char after «
|
|
94
|
+
word_end = word_start + word.length
|
|
95
|
+
return [word, word_start, word_end] if pos >= word_start && pos <= word_end
|
|
96
|
+
end
|
|
97
|
+
nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Replace the masked (***) span with the real word from the Ruby buffer.
|
|
101
|
+
def unmask_gtk_region(word, word_start, word_end)
|
|
102
|
+
s_iter = buffer.get_iter_at(:offset => word_start)
|
|
103
|
+
e_iter = buffer.get_iter_at(:offset => word_end)
|
|
104
|
+
buffer.delete(s_iter, e_iter)
|
|
105
|
+
buffer.insert(buffer.get_iter_at(:offset => word_start), word)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# When in insert mode with cursor on a «word, expose the real text in the GTK
|
|
109
|
+
# buffer so the user can see/edit it. Re-mask when cursor leaves or mode changes.
|
|
110
|
+
def update_cursor_unmask
|
|
111
|
+
return unless @bufo&.lang == "hyperplaintext"
|
|
112
|
+
ctype = vma.kbd.get_cursor_type
|
|
113
|
+
pos = @bufo.pos
|
|
114
|
+
|
|
115
|
+
if ctype == :insert
|
|
116
|
+
result = masked_word_at_cursor(pos)
|
|
117
|
+
if result
|
|
118
|
+
word, word_start, word_end = result
|
|
119
|
+
return if @unmasked_range == [word_start, word_end] # already showing this word
|
|
120
|
+
remask_gtk_buffer if @unmasked_range # re-mask previous region
|
|
121
|
+
unmask_gtk_region(word, word_start, word_end)
|
|
122
|
+
@unmasked_range = [word_start, word_end]
|
|
123
|
+
return
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Not insert mode, or cursor is not over a masked word — ensure everything masked
|
|
128
|
+
if @unmasked_range
|
|
129
|
+
@unmasked_range = nil
|
|
130
|
+
remask_gtk_buffer
|
|
131
|
+
end
|
|
50
132
|
end
|
|
51
133
|
|
|
52
134
|
def gutter_width()
|
|
@@ -174,9 +256,24 @@ class VSourceView < GtkSource::View
|
|
|
174
256
|
i = coord_to_iter(x, y, true)
|
|
175
257
|
pp i
|
|
176
258
|
@range_start = i
|
|
259
|
+
@drag_start_x = x
|
|
260
|
+
@drag_start_y = y
|
|
177
261
|
buf.start_selection
|
|
178
262
|
end
|
|
179
263
|
|
|
264
|
+
@cnt_drag.signal_connect "drag-update" do |gesture, offset_x, offset_y|
|
|
265
|
+
next unless @range_start
|
|
266
|
+
cur_x = @drag_start_x + offset_x
|
|
267
|
+
cur_y = @drag_start_y + offset_y
|
|
268
|
+
debug "drag-update 2 #{cur_x} #{cur_y}"
|
|
269
|
+
i = coord_to_iter(cur_x, cur_y, true)
|
|
270
|
+
@bufo.set_pos(i) if !i.nil? and @last_iter != i
|
|
271
|
+
if !i.nil? and (@range_start - i).abs >= 2
|
|
272
|
+
vma.kbd.set_mode(:visual)
|
|
273
|
+
end
|
|
274
|
+
@last_iter = i
|
|
275
|
+
end
|
|
276
|
+
|
|
180
277
|
@cnt_drag.signal_connect "drag-end" do |gesture, offsetx, offsety|
|
|
181
278
|
debug "drag-end", 2
|
|
182
279
|
if offsetx.abs < 5 and offsety.abs < 5
|
|
@@ -186,8 +283,7 @@ class VSourceView < GtkSource::View
|
|
|
186
283
|
elsif vma.kbd.get_scope != :editor
|
|
187
284
|
# Can't transition from editor wide mode to buffer specific mode
|
|
188
285
|
vma.kbd.set_mode(:visual)
|
|
189
|
-
else
|
|
190
|
-
buf.end_selection
|
|
286
|
+
else # The normal case
|
|
191
287
|
end
|
|
192
288
|
@range_start = nil
|
|
193
289
|
end
|
|
@@ -199,8 +295,22 @@ class VSourceView < GtkSource::View
|
|
|
199
295
|
@click = click
|
|
200
296
|
|
|
201
297
|
@range_start = nil
|
|
298
|
+
|
|
299
|
+
# Handle right click
|
|
300
|
+
rightclick = Gtk::GestureClick.new
|
|
301
|
+
rightclick.button = 3
|
|
302
|
+
self.add_controller(rightclick)
|
|
303
|
+
rightclick.signal_connect "pressed" do |gesture, n_press, x, y, z|
|
|
304
|
+
puts "SourceView, GestureClick rightclick released button=#{gesture.button} x=#{x} y=#{y}"
|
|
305
|
+
if gesture.button == 3
|
|
306
|
+
show_context_menu(x, y)
|
|
307
|
+
next true
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
202
311
|
click.signal_connect "pressed" do |gesture, n_press, x, y, z|
|
|
203
312
|
debug "SourceView, GestureClick released x=#{x} y=#{y}"
|
|
313
|
+
vma.gui.instance_variable_set(:@kbd_passthrough, false)
|
|
204
314
|
|
|
205
315
|
if buf.visual_mode?
|
|
206
316
|
buf.end_visual_mode
|
|
@@ -219,11 +329,19 @@ class VSourceView < GtkSource::View
|
|
|
219
329
|
end
|
|
220
330
|
|
|
221
331
|
@bufo.set_pos(i) if !i.nil?
|
|
332
|
+
if n_press == 2
|
|
333
|
+
#TODO: refactor to have one function for all line actions
|
|
334
|
+
if @bufo.module&.respond_to?(:select_line)
|
|
335
|
+
@bufo.module.select_line
|
|
336
|
+
else
|
|
337
|
+
@bufo.cur_nonwhitespace_word_action()
|
|
338
|
+
end
|
|
339
|
+
end
|
|
222
340
|
true
|
|
223
341
|
end
|
|
224
342
|
|
|
225
343
|
click.signal_connect "released" do |gesture, n_press, x, y, z|
|
|
226
|
-
debug "SourceView, GestureClick released x=#{x} y=#{y}"
|
|
344
|
+
debug "SourceView, GestureClick released x=#{x} y=#{y} button=#{gesture.button}"
|
|
227
345
|
|
|
228
346
|
xloc = (x - gutter_width).to_i
|
|
229
347
|
yloc = (y + visible_rect.y).to_i
|
|
@@ -449,6 +567,7 @@ class VSourceView < GtkSource::View
|
|
|
449
567
|
end
|
|
450
568
|
end
|
|
451
569
|
if any_change
|
|
570
|
+
remask_gtk_buffer
|
|
452
571
|
#TODO: only when necessary
|
|
453
572
|
self.set_cursor_pos(pos)
|
|
454
573
|
end
|
|
@@ -573,7 +692,7 @@ class VSourceView < GtkSource::View
|
|
|
573
692
|
self.style_context.add_provider(prov)
|
|
574
693
|
@cursor_prov = prov
|
|
575
694
|
end
|
|
576
|
-
@ctype
|
|
695
|
+
@ctype = ctype
|
|
577
696
|
end
|
|
578
697
|
end
|
|
579
698
|
|
|
@@ -587,7 +706,7 @@ class VSourceView < GtkSource::View
|
|
|
587
706
|
|
|
588
707
|
mode = vma.kbd.get_mode
|
|
589
708
|
ctype = vma.kbd.get_cursor_type
|
|
590
|
-
ctype = :visual if
|
|
709
|
+
ctype = :visual if @bufo.selection_active?
|
|
591
710
|
|
|
592
711
|
if [:command, :replace, :browse].include?(ctype)
|
|
593
712
|
set_cursor_color(ctype)
|
|
@@ -631,6 +750,75 @@ class VSourceView < GtkSource::View
|
|
|
631
750
|
self.cursor_visible = false
|
|
632
751
|
self.cursor_visible = true
|
|
633
752
|
end
|
|
753
|
+
|
|
754
|
+
update_cursor_unmask
|
|
634
755
|
end #end draw_cursor
|
|
635
|
-
end
|
|
636
756
|
|
|
757
|
+
CONTEXT_MENU_ITEMS = [
|
|
758
|
+
["Paste", :paste_after_cursor],
|
|
759
|
+
["Previous buffer", :history_switch_backwards],
|
|
760
|
+
]
|
|
761
|
+
|
|
762
|
+
CONTEXT_MENU_ITEMS_SELECTION = [
|
|
763
|
+
["Copy", :copy_selection],
|
|
764
|
+
["Cut", :cut_selection],
|
|
765
|
+
]
|
|
766
|
+
|
|
767
|
+
def init_context_menu
|
|
768
|
+
all_items = CONTEXT_MENU_ITEMS + CONTEXT_MENU_ITEMS_SELECTION
|
|
769
|
+
all_items.each do |label, action_id|
|
|
770
|
+
actkey = "ctx_#{action_id}"
|
|
771
|
+
unless vma.gui.app.lookup_action(actkey)
|
|
772
|
+
act = Gio::SimpleAction.new(actkey)
|
|
773
|
+
vma.gui.app.add_action(act)
|
|
774
|
+
act.signal_connect("activate") do
|
|
775
|
+
call_action(action_id)
|
|
776
|
+
after_action
|
|
777
|
+
end
|
|
778
|
+
end
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
unless vma.gui.app.lookup_action("ctx_open_link")
|
|
782
|
+
act = Gio::SimpleAction.new("ctx_open_link")
|
|
783
|
+
vma.gui.app.add_action(act)
|
|
784
|
+
act.signal_connect("activate") do
|
|
785
|
+
next unless @context_link
|
|
786
|
+
if is_url(@context_link)
|
|
787
|
+
open_url(@context_link)
|
|
788
|
+
else
|
|
789
|
+
fn = hpt_check_cur_word(@context_link)
|
|
790
|
+
open_existing_file(fn) if fn
|
|
791
|
+
end
|
|
792
|
+
end
|
|
793
|
+
end
|
|
794
|
+
|
|
795
|
+
@context_menu = Gtk::PopoverMenu.new
|
|
796
|
+
@context_menu.set_parent(self)
|
|
797
|
+
@context_menu.has_arrow = false
|
|
798
|
+
end
|
|
799
|
+
|
|
800
|
+
def link_at(x, y)
|
|
801
|
+
bx, by = window_to_buffer_coords(:widget, x.to_i, y.to_i)
|
|
802
|
+
iter = get_iter_at_location(bx, by)
|
|
803
|
+
return nil unless iter
|
|
804
|
+
word, _range = @bufo.get_word_in_pos(iter.offset, boundary: :space)
|
|
805
|
+
return nil unless word
|
|
806
|
+
return word if is_url(word)
|
|
807
|
+
return word if word.match?(/⟦.+⟧/)
|
|
808
|
+
nil
|
|
809
|
+
end
|
|
810
|
+
|
|
811
|
+
def show_context_menu(x, y)
|
|
812
|
+
init_context_menu if @context_menu.nil?
|
|
813
|
+
menu = Gio::Menu.new
|
|
814
|
+
@context_link = link_at(x, y)
|
|
815
|
+
menu.append("Open link", "app.ctx_open_link") if @context_link
|
|
816
|
+
CONTEXT_MENU_ITEMS.each { |label, action_id| menu.append(label, "app.ctx_#{action_id}") }
|
|
817
|
+
if @bufo.selection_active?
|
|
818
|
+
CONTEXT_MENU_ITEMS_SELECTION.each { |label, action_id| menu.append(label, "app.ctx_#{action_id}") }
|
|
819
|
+
end
|
|
820
|
+
@context_menu.set_menu_model(menu)
|
|
821
|
+
@context_menu.set_pointing_to(Gdk::Rectangle.new(x.to_i, y.to_i, 1, 1))
|
|
822
|
+
@context_menu.popup
|
|
823
|
+
end
|
|
824
|
+
end
|
data/lib/vimamsa/gui_text.rb
CHANGED
|
@@ -24,26 +24,4 @@ module Gui
|
|
|
24
24
|
self.hilight_range(bf, r, tag: tag)
|
|
25
25
|
}
|
|
26
26
|
end
|
|
27
|
-
|
|
28
|
-
def self.highlight_match_old(bf, str, color: "#aa0000ff")
|
|
29
|
-
vbuf = bf.view.buffer
|
|
30
|
-
r = Regexp.new(Regexp.escape(str), Regexp::IGNORECASE)
|
|
31
|
-
|
|
32
|
-
hlparts = []
|
|
33
|
-
|
|
34
|
-
tt = vma.gui.view.buffer.tag_table.lookup("highlight_match_tag")
|
|
35
|
-
if tt.nil?
|
|
36
|
-
tt = vma.gui.view.buffer.create_tag("highlight_match_tag")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
tt.weight = 650
|
|
40
|
-
tt.foreground = color
|
|
41
|
-
|
|
42
|
-
ind = scan_indexes(bf, r)
|
|
43
|
-
ind.each { |x|
|
|
44
|
-
itr = vbuf.get_iter_at(:offset => x)
|
|
45
|
-
itr2 = vbuf.get_iter_at(:offset => x + str.size)
|
|
46
|
-
vbuf.apply_tag(tt, itr, itr2)
|
|
47
|
-
}
|
|
48
|
-
end
|
|
49
27
|
end
|
data/lib/vimamsa/key_actions.rb
CHANGED
|
@@ -18,15 +18,6 @@ def jump_to_next_edit
|
|
|
18
18
|
buf.jump_to_next_edit
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def is_command_mode()
|
|
22
|
-
return true if vma.kbd.mode_root_state.to_s() == "C"
|
|
23
|
-
return false
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def is_visual_mode()
|
|
27
|
-
return 1 if vma.kbd.mode_root_state.to_s() == "V"
|
|
28
|
-
return 0
|
|
29
|
-
end
|
|
30
21
|
|
|
31
22
|
reg_act(:command_to_buf, proc { command_to_buf }, "Execute command, output to buffer")
|
|
32
23
|
|
|
@@ -35,9 +26,19 @@ reg_act(:lsp_jump_to_definition, proc { vma.buf.lsp_jump_to_def }, "LSP jump to
|
|
|
35
26
|
|
|
36
27
|
reg_act(:eval_buf, proc { vma.buf.eval_whole_buf }, "Eval whole current buffer as ruby code (DANGEROUS)")
|
|
37
28
|
|
|
29
|
+
reg_act(:show_settings, proc { show_settings_dialog }, "Show settings")
|
|
30
|
+
reg_act(:cut_selection, proc { buf.delete(SELECTION) }, "Cut selection to clipboard")
|
|
31
|
+
|
|
32
|
+
reg_act(:insert_backspace, proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(BACKWARD_CHAR) }, "Delete backwards")
|
|
33
|
+
reg_act(:insert_select_up, proc { insert_select_move(BACKWARD_LINE) }, "Select texte upwards")
|
|
34
|
+
reg_act(:insert_select_down, proc { insert_select_move(FORWARD_LINE) }, "Select text downwards")
|
|
35
|
+
|
|
36
|
+
reg_act(:copy_selection, proc { buf.copy_active_selection }, "Copy selection to clipboard")
|
|
38
37
|
reg_act(:enable_debug, proc { cnf.debug = true }, "Enable debug")
|
|
39
38
|
reg_act(:disable_debug, proc { cnf.debug = false }, "Disable debug")
|
|
40
39
|
|
|
40
|
+
reg_act(:experimental_eval, proc { bindkey "V , e", "vma.buf.convert_selected_text(:eval)" }, "Enable key binding:\"[VISUAL] , e:\" Eval selected text")
|
|
41
|
+
|
|
41
42
|
reg_act(:easy_jump, proc { EasyJump.start }, "Easy jump")
|
|
42
43
|
reg_act(:gui_ensure_cursor_visible, proc { vma.gui.view.ensure_cursor_visible }, "Scroll to current cursor position")
|
|
43
44
|
reg_act(:gui_refresh_cursor, proc { vma.buf.refresh_cursor }, "Refresh cursor")
|
|
@@ -46,18 +47,20 @@ reg_act(:savedebug, "savedebug", "Save debug info", { :group => :debug })
|
|
|
46
47
|
reg_act(:open_file_dialog, "open_file_dialog", "Open file", { :group => :file })
|
|
47
48
|
reg_act(:create_new_file, "create_new_file", "Create new file", { :group => :file })
|
|
48
49
|
reg_act(:backup_all_buffers, proc { backup_all_buffers }, "Backup all buffers", { :group => :file })
|
|
49
|
-
reg_act(:e_move_forward_char, "e_move_forward_char", "", { :group => [:move, :basic] })
|
|
50
|
-
reg_act(:e_move_backward_char, "e_move_backward_char", "", { :group => [:move, :basic] })
|
|
50
|
+
reg_act(:e_move_forward_char, "e_move_forward_char", "Move forward", { :group => [:move, :basic] })
|
|
51
|
+
reg_act(:e_move_backward_char, "e_move_backward_char", "Move forward", { :group => [:move, :basic] })
|
|
51
52
|
# reg_act(:history_switch_backwards, proc{bufs.history_switch_backwards}, "", { :group => :file })
|
|
52
|
-
reg_act(:history_switch_backwards, proc{bufs.history_switch(-1)}, "", { :group => :file })
|
|
53
|
-
reg_act(:history_switch_forwards, proc{bufs.history_switch(+1)}, "", { :group => :file })
|
|
53
|
+
reg_act(:history_switch_backwards, proc { bufs.history_switch(-1) }, "Prev buffer", { :group => :file })
|
|
54
|
+
reg_act(:history_switch_forwards, proc { bufs.history_switch(+1) }, "Next buffer", { :group => :file })
|
|
55
|
+
reg_act(:print_buffer_access_list, proc { bufs.print_by_access_time }, "Print buffers by access time", { :group => :file })
|
|
54
56
|
reg_act(:center_on_current_line, "center_on_current_line", "", { :group => :view })
|
|
55
57
|
reg_act(:run_last_macro, proc { vma.macro.run_last_macro }, "Run last recorded or executed macro", { :group => :macro })
|
|
56
|
-
reg_act(:jump_to_next_edit, "jump_to_next_edit", "")
|
|
57
|
-
reg_act(:jump_to_last_edit, proc { buf.jump_to_last_edit }, "")
|
|
58
|
+
reg_act(:jump_to_next_edit, "jump_to_next_edit", "Jump to next edit pos")
|
|
59
|
+
reg_act(:jump_to_last_edit, proc { buf.jump_to_last_edit }, "Jump to last edit pos")
|
|
58
60
|
reg_act(:jump_to_random, proc { buf.jump_to_random_pos }, "")
|
|
59
|
-
reg_act(:insert_new_line, proc { buf.insert_new_line() }, "")
|
|
61
|
+
reg_act(:insert_new_line, proc { buf.insert_new_line() }, "Insert new line")
|
|
60
62
|
reg_act(:show_key_bindings, proc { show_key_bindings }, "Show key bindings")
|
|
63
|
+
reg_act(:show_free_key_bindings, proc { show_free_key_bindings }, "Show available (unbound) key binding slots")
|
|
61
64
|
reg_act(:put_file_path_to_clipboard, proc { buf.put_file_path_to_clipboard }, "Put file path of current file to clipboard")
|
|
62
65
|
reg_act(:put_file_ref_to_clipboard, proc { buf.put_file_ref_to_clipboard }, "Put file ref of current file to clipboard")
|
|
63
66
|
|
|
@@ -67,11 +70,19 @@ reg_act(:set_unencrypted, proc { buf.set_unencrypted }, "Set current file to sav
|
|
|
67
70
|
reg_act(:set_executable, proc { buf.set_executable }, "Set current file permissions to executable")
|
|
68
71
|
# reg_act(:close_all_buffers, proc { bufs.close_all_buffers() }, "Close all buffers")
|
|
69
72
|
reg_act(:close_current_buffer, proc { bufs.close_current_buffer(true) }, "Close current buffer")
|
|
70
|
-
reg_act(:
|
|
73
|
+
reg_act(:toggle_file_panel, proc { vma.gui.toggle_file_panel }, "Toggle file panel")
|
|
74
|
+
reg_act(:show_message_history, proc { vma.gui.show_message_history }, "Show message history")
|
|
75
|
+
reg_act(:toggle_func_panel, proc { vma.gui.toggle_func_panel }, "Toggle LSP function panel")
|
|
76
|
+
reg_act(:refresh_func_panel, proc { vma.gui.func_panel_refresh }, "Refresh LSP function panel")
|
|
77
|
+
reg_act(:git_diff_w, proc { git_diff_w }, "Show git diff -w for whole repository")
|
|
78
|
+
reg_act(:lsp_print_functions, proc { lsp_print_functions }, "LSP print functions in current file")
|
|
79
|
+
reg_act(:comment_selection, proc { buf.comment_selection }, "Comment selection")
|
|
71
80
|
reg_act(:delete_char_forward, proc { buf.delete(CURRENT_CHAR_FORWARD) }, "Delete char forward", { :group => [:edit, :basic] })
|
|
72
81
|
reg_act(:gui_file_finder, proc { vma.FileFinder.start_gui }, "Fuzzy file finder")
|
|
73
82
|
reg_act(:gui_file_history_finder, proc { vma.FileHistory.start_gui }, "Fuzzy file history finder")
|
|
74
83
|
reg_act(:gui_search_replace, proc { gui_search_replace }, "Search and replace")
|
|
84
|
+
reg_act(:find_next, proc { $search.jump_to_next() }, "Find next")
|
|
85
|
+
|
|
75
86
|
reg_act(:set_style_bold, proc { buf.style_transform(:bold) }, "Set text weight to bold")
|
|
76
87
|
reg_act(:set_style_link, proc { buf.style_transform(:link) }, "Set text as link")
|
|
77
88
|
reg_act(:V_join_lines, proc { vma.buf.convert_selected_text(:joinlines) }, "Join lines")
|
|
@@ -87,8 +98,10 @@ reg_act(:clear_line_styles, proc { buf.set_line_style(:clear) }, "Clear styles o
|
|
|
87
98
|
reg_act(:gui_select_buffer, proc { vma.kbd.set_mode("S"); gui_select_buffer }, "Select buffer")
|
|
88
99
|
reg_act :open_file_dialog, "open_file_dialog", "Open file"
|
|
89
100
|
reg_act :minibuffer_end, proc { minibuffer_end }
|
|
90
|
-
reg_act(:invoke_replace, "invoke_replace", "")
|
|
101
|
+
reg_act(:invoke_replace, "invoke_replace", "Invoke replace")
|
|
91
102
|
reg_act(:diff_buffer, "diff_buffer", "")
|
|
103
|
+
reg_act(:git_diff_buffer, proc { git_diff_buffer }, "Show git diff of current file")
|
|
104
|
+
reg_act(:diff_buffer_jump_to_source, proc { diff_buffer_jump_to_source }, "Jump to corresponding line in source from diff buffer")
|
|
92
105
|
# reg_act(:invoke_grep_search, proc{invoke_grep_search}, "")
|
|
93
106
|
reg_act(:invoke_grep_search, proc { gui_grep }, "Grep current buffer")
|
|
94
107
|
reg_act(:ack_search, proc { gui_ack }, "") #invoke_ack_search
|
|
@@ -97,35 +110,42 @@ reg_act :delete_to_word_end, proc { buf.delete2(:to_word_end) }, "Delete to file
|
|
|
97
110
|
reg_act :delete_to_next_word_start, proc { buf.delete2(:to_next_word) }, "Delete to start of next word", { :group => [:edit, :basic] }
|
|
98
111
|
reg_act :delete_to_line_start, proc { buf.delete2(:to_line_start) }, "Delete to line start", { :group => [:edit, :basic] }
|
|
99
112
|
|
|
113
|
+
reg_act(:ack_search, proc { gui_ack }, "Ack")
|
|
100
114
|
|
|
101
|
-
reg_act(:
|
|
102
|
-
|
|
103
|
-
reg_act(:
|
|
104
|
-
reg_act(:
|
|
105
|
-
reg_act(:
|
|
106
|
-
reg_act(:redo, proc {buf.redo()}, "Redo the last undone action")
|
|
107
|
-
reg_act(:undo, proc {buf.undo()}, "Undo the last action")
|
|
115
|
+
reg_act(:copy_cur_line, proc { buf.copy_line }, "Copy the current line")
|
|
116
|
+
reg_act(:paste_before_cursor, proc { buf.paste(BEFORE) }, "Paste text before the cursor")
|
|
117
|
+
reg_act(:paste_after_cursor, proc { buf.paste(AFTER) }, "Paste text after the cursor")
|
|
118
|
+
reg_act(:paste_over_after, proc { buf.paste_over(AFTER) }, "Paste over selection or after cursor")
|
|
119
|
+
reg_act(:paste_over_before, proc { buf.paste_over(BEFORE) }, "Paste over selection or before cursor")
|
|
120
|
+
reg_act(:redo, proc { buf.redo() }, "Redo the last undone action")
|
|
121
|
+
reg_act(:undo, proc { buf.undo() }, "Undo the last action")
|
|
108
122
|
reg_act(:jump_end_of_line, proc { buf.jump(END_OF_LINE) }, "Move to the end of the current line")
|
|
109
|
-
reg_act(:jump_end_of_buffer, proc {buf.jump(END_OF_BUFFER)}, "Move to the end of the buffer")
|
|
123
|
+
reg_act(:jump_end_of_buffer, proc { buf.jump(END_OF_BUFFER) }, "Move to the end of the buffer")
|
|
110
124
|
reg_act(:jump_start_of_buffer, proc { buf.jump(START_OF_BUFFER) }, "Move to the start of the buffer")
|
|
111
125
|
reg_act(:jump_beginning_of_line, proc { buf.jump(BEGINNING_OF_LINE) }, "Move to the beginning of the current line")
|
|
112
|
-
reg_act(:jump_next_word_end, proc { buf.jump_word(FORWARD,WORD_END) }, "Jump to the end of the next word")
|
|
113
|
-
reg_act(:jump_prev_word_start, proc { buf.jump_word(BACKWARD,WORD_START) }, "Jump to the start of the previous word")
|
|
114
|
-
reg_act(:jump_next_word_start, proc { buf.jump_word(FORWARD,WORD_START) }, "Jump to the start of the next word")
|
|
126
|
+
reg_act(:jump_next_word_end, proc { buf.jump_word(FORWARD, WORD_END) }, "Jump to the end of the next word")
|
|
127
|
+
reg_act(:jump_prev_word_start, proc { buf.jump_word(BACKWARD, WORD_START) }, "Jump to the start of the previous word")
|
|
128
|
+
reg_act(:jump_next_word_start, proc { buf.jump_word(FORWARD, WORD_START) }, "Jump to the start of the next word")
|
|
115
129
|
reg_act(:insert_mode, proc { vma.kbd.set_mode(:insert) }, "Switch to INSERT mode")
|
|
116
130
|
reg_act(:prev_mode, proc { vma.kbd.to_previous_mode }, "Return to the previous mode")
|
|
117
131
|
reg_act(:move_prev_line, proc { buf.move(BACKWARD_LINE) }, "Move the cursor to the previous line")
|
|
118
132
|
reg_act(:move_next_line, proc { buf.move(FORWARD_LINE) }, "Move the cursor to the next line")
|
|
119
133
|
reg_act(:move_backward_char, proc { buf.move(BACKWARD_CHAR) }, "Move one character backward")
|
|
120
|
-
reg_act(:start_visual_mode, proc { buf.start_selection;vma.kbd.set_mode(:visual) }, "Enter VISUAL mode (for selections)")
|
|
134
|
+
reg_act(:start_visual_mode, proc { buf.start_selection; vma.kbd.set_mode(:visual) }, "Enter VISUAL mode (for selections)")
|
|
121
135
|
reg_act(:jump_last_edit, proc { buf.jump_to_last_edit }, "Jump to the last edit location")
|
|
122
|
-
|
|
136
|
+
reg_act(:install_demo_files, proc { install_demo_files }, "Install and show Demo")
|
|
137
|
+
reg_act(:reload_customrb, proc { reload_customrb }, "Reload custom.rb")
|
|
123
138
|
|
|
124
139
|
reg_act :start_browse_mode, proc {
|
|
125
140
|
vma.kbd.set_mode(:browse)
|
|
126
141
|
bufs.reset_navigation
|
|
127
142
|
}, "Start browse mode"
|
|
128
143
|
reg_act :kbd_dump_state, proc { vma.kbd.dump_state }, "Dump keyboard tree state"
|
|
144
|
+
reg_act :toggle_kbd_passthrough, proc {
|
|
145
|
+
vma.gui.instance_variable_set(:@kbd_passthrough, !vma.gui.instance_variable_get(:@kbd_passthrough))
|
|
146
|
+
state = vma.gui.instance_variable_get(:@kbd_passthrough) ? "ON" : "OFF"
|
|
147
|
+
message("Keyboard passthrough: #{state}")
|
|
148
|
+
}, "Toggle keyboard event passthrough (allow other widgets to receive key events)"
|
|
129
149
|
|
|
130
150
|
reg_act :exit_browse_mode, proc {
|
|
131
151
|
bufs.add_current_buf_to_history
|
|
@@ -189,6 +209,9 @@ act_list = {
|
|
|
189
209
|
:backward_line => { :proc => proc { buf.move(BACKWARD_LINE) },
|
|
190
210
|
:desc => "Move one line backward", :group => [:move, :basic] },
|
|
191
211
|
|
|
212
|
+
:increment_word => { :proc => proc { buf.increment_current_word },
|
|
213
|
+
:desc => "Increment word", :group => [:edit, :extra] },
|
|
214
|
+
|
|
192
215
|
# { :proc => proc { },
|
|
193
216
|
# :desc => "", :group => : },
|
|
194
217
|
|