vimamsa 0.1.21 → 0.1.23

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.
@@ -36,14 +36,12 @@ class ResizableImage < Gtk::DrawingArea
36
36
  @draw_image = pb
37
37
  @oldimg = pb
38
38
  #TODO: Should be better way to compensate for the gutter
39
- self.set_size_request(pb.width+@view.gutter_width, pb.height)
39
+ self.set_size_request(pb.width, pb.height) # +@view.gutter_width?
40
40
  end
41
41
 
42
42
  def do_draw(da, cr)
43
43
  # puts @fpath
44
- # Ripl.start :binding => binding
45
-
46
- cr.set_source_pixbuf(@draw_image, @view.gutter_width, 0)
44
+ cr.set_source_pixbuf(@draw_image, 0, 0) # @view.gutter_width
47
45
  cr.paint
48
46
  end
49
47
  end
@@ -29,6 +29,7 @@ module Vimamsa
29
29
  add_to_menu "File.New", { :label => "New file", :action => :buf_new }
30
30
  add_to_menu "File.Revert", { :label => "Reload file from disk", :action => :buf_revert }
31
31
  add_to_menu "File.List", { :label => "List open files", :action => :start_buf_manager }
32
+ add_to_menu "File.Close", { :label => "Close file", :action => :close_current_buffer }
32
33
 
33
34
  add_to_menu "File.Quit", { :label => "Quit", :action => :quit }
34
35
 
@@ -39,7 +40,10 @@ module Vimamsa
39
40
 
40
41
  # add_to_menu "Edit.StartCompletion", { :label => "StartCompletion", :action => :start_autocomplete }
41
42
  # add_to_menu "Edit.ShowCompletion", { :label => "ShowCompletion", :action => :show_autocomplete }
42
- add_to_menu "Edit.CustomRb", { :action => :edit_customrb }
43
+
44
+ add_to_menu "Settings.Preferences", { :label => "Preferences...", :action => :show_settings }
45
+ add_to_menu "Settings.Customize", { :action => :edit_customrb }
46
+ add_to_menu "Settings.ReloadCustom", { :action => :reload_customrb }
43
47
 
44
48
  add_to_menu "Actions.SearchForActions", { :label => "Search for Actions", :action => :search_actions }
45
49
 
@@ -48,18 +52,25 @@ module Vimamsa
48
52
  add_to_menu "Actions.FileHistoryFinder", { :label => "Search files in history", :action => :gui_file_history_finder }
49
53
 
50
54
  add_to_menu "Actions.experimental.Diff", { :label => "Show Diff of\nunsaved changes", :action => :diff_buffer }
55
+ add_to_menu "Actions.experimental.GitDiff", { :label => "Show git diff", :action => :git_diff_buffer }
51
56
 
57
+ add_to_menu "Actions.experimental.PrintBufferAccessList", { :label => "Print buffers by access time", :action => :print_buffer_access_list }
52
58
  add_to_menu "Actions.experimental.EnableDebug", { :label => "Enable debug", :action => :enable_debug }
53
59
  add_to_menu "Actions.experimental.DisableDebug", { :label => "Disable debug", :action => :disable_debug }
54
60
  add_to_menu "Actions.experimental.ShowImages", { :label => "Show images ⟦img:path⟧", :action => :show_images }
61
+
62
+ add_to_menu "Actions.experimental.ShowImages", { :action => :experimental_eval }
63
+
55
64
 
56
65
  add_to_menu "Actions.debug.dumpkbd", { :label => "Dump kbd state", :action => :kbd_dump_state }
57
66
 
58
67
  add_to_menu "View.BufferManager", { :label => "Show open files", :action => :start_buf_manager }
59
68
  add_to_menu "View.TwoColumn", { :label => "Toggle two column mode", :action => :toggle_two_column }
69
+ add_to_menu "View.FilePanel", { :label => "Toggle file panel", :action => :toggle_file_panel }
60
70
 
61
71
  add_to_menu "Actions.EncryptFile", { :label => "Encrypt file", :action => :encrypt_file }
62
72
  add_to_menu "Help.KeyBindings", { :label => "Show key bindings", :action => :show_key_bindings }
73
+ add_to_menu "Help.InstallDemo", { :action => :install_demo_files }
63
74
 
64
75
  #TODO: :auto_indent_buffer
65
76
 
@@ -42,6 +42,7 @@ class SelectUpdateWindow
42
42
 
43
43
  def initialize(main_window, item_list, jump_keys, select_callback, update_callback, opt = {})
44
44
  @window = Gtk::Window.new()
45
+ @window.set_transient_for($vmag.window) if $vmag&.window
45
46
  # @window.screen = main_window.screen
46
47
  @window.title = ""
47
48
  if !opt[:title].nil?
@@ -0,0 +1,155 @@
1
+ SETTINGS_DEFS = [
2
+ {
3
+ :label => "Tab / Indent",
4
+ :settings => [
5
+ { :key => [:tab, :width], :label => "Tab width", :type => :int, :min => 1, :max => 16, :step => 1 },
6
+ { :key => [:tab, :to_spaces_default], :label => "Use spaces instead of tabs (default)", :type => :bool },
7
+ { :key => [:indent_based_on_last_line], :label => "Auto-indent based on last line", :type => :bool },
8
+ ],
9
+ },
10
+ {
11
+ :label => "Font",
12
+ :settings => [
13
+ { :key => [:font, :family], :label => "Font family", :type => :string },
14
+ { :key => [:font, :size], :label => "Font size (pt)", :type => :int, :min => 4, :max => 72, :step => 1 },
15
+ ],
16
+ },
17
+ {
18
+ :label => "Appearance",
19
+ :settings => [
20
+ { :key => [:match, :highlight, :color], :label => "Search highlight color", :type => :string },
21
+ { :key => [:kbd, :show_prev_action], :label => "Show previous action in toolbar", :type => :bool },
22
+ ],
23
+ },
24
+ {
25
+ :label => "Behavior",
26
+ :settings => [
27
+ { :key => [:lsp, :enabled], :label => "Enable LSP (Language Server)", :type => :bool },
28
+ { :key => [:experimental], :label => "Enable experimental features", :type => :bool },
29
+ { :key => [:macro, :animation_delay], :label => "Macro animation delay (sec)", :type => :float, :min => 0.0, :max => 2.0, :step => 0.0001 },
30
+ ],
31
+ },
32
+ ]
33
+
34
+ class SettingsDialog
35
+ def initialize
36
+ @widgets = {}
37
+ @window = Gtk::Window.new
38
+ @window.set_transient_for($vmag.window) if $vmag&.window
39
+ @window.modal = true
40
+ @window.title = "Preferences"
41
+ @window.default_width = 500
42
+
43
+ outer = Gtk::Box.new(:vertical, 12)
44
+ # outer.margin = 16
45
+ @window.set_child(outer)
46
+
47
+ notebook = Gtk::Notebook.new
48
+ outer.append(notebook)
49
+
50
+ SETTINGS_DEFS.each do |section|
51
+ grid = Gtk::Grid.new
52
+ grid.row_spacing = 10
53
+ grid.column_spacing = 16
54
+ grid.margin_top = 12
55
+ grid.margin_bottom = 12
56
+ grid.margin_start = 12
57
+ grid.margin_end = 12
58
+
59
+ section[:settings].each_with_index do |s, row|
60
+ label = Gtk::Label.new(s[:label])
61
+ label.halign = :start
62
+ label.hexpand = true
63
+
64
+ widget = make_widget(s)
65
+ @widgets[s[:key]] = { :widget => widget, :type => s[:type] }
66
+
67
+ grid.attach(label, 0, row, 1, 1)
68
+ grid.attach(widget, 1, row, 1, 1)
69
+ end
70
+
71
+ notebook.append_page(grid, Gtk::Label.new(section[:label]))
72
+ end
73
+
74
+ hbox = Gtk::Box.new(:horizontal, 8)
75
+ hbox.halign = :end
76
+
77
+ cancel_btn = Gtk::Button.new(:label => "Cancel")
78
+ save_btn = Gtk::Button.new(:label => "Save")
79
+ cancel_btn.signal_connect("clicked") { @window.destroy }
80
+ save_btn.signal_connect("clicked") { save_and_close }
81
+
82
+ hbox.append(cancel_btn)
83
+ hbox.append(save_btn)
84
+ outer.append(hbox)
85
+
86
+ press = Gtk::EventControllerKey.new
87
+ press.set_propagation_phase(Gtk::PropagationPhase::CAPTURE)
88
+ @window.add_controller(press)
89
+ press.signal_connect("key-pressed") do |_g, keyval, _kc, _y|
90
+ if keyval == Gdk::Keyval::KEY_Escape
91
+ @window.destroy
92
+ true
93
+ else
94
+ false
95
+ end
96
+ end
97
+ end
98
+
99
+ def make_widget(s)
100
+ cur = get(s[:key])
101
+ case s[:type]
102
+ when :bool
103
+ w = Gtk::Switch.new
104
+ w.active = cur == true
105
+ w.valign = :center
106
+ w
107
+ when :int
108
+ adj = Gtk::Adjustment.new(cur.to_f, s[:min].to_f, s[:max].to_f, s[:step].to_f, s[:step].to_f * 5, 0.0)
109
+ Gtk::SpinButton.new(adj, s[:step].to_f, 0)
110
+ when :float
111
+ adj = Gtk::Adjustment.new(cur.to_f, s[:min].to_f, s[:max].to_f, s[:step].to_f, s[:step].to_f * 5, 0.0)
112
+ digits = s[:step].to_s.split(".").last.to_s.length
113
+ digits = 2 if digits < 2
114
+ Gtk::SpinButton.new(adj, s[:step].to_f, digits)
115
+ when :string
116
+ w = Gtk::Entry.new
117
+ w.text = cur.to_s
118
+ w
119
+ end
120
+ end
121
+
122
+ def save_and_close
123
+ @widgets.each do |key, info|
124
+ val = case info[:type]
125
+ when :bool then info[:widget].active?
126
+ when :int then info[:widget].value.to_i
127
+ when :float then info[:widget].value.to_f
128
+ when :string then info[:widget].text
129
+ end
130
+ set(key, val)
131
+ end
132
+ save_settings_to_file
133
+ gui_refresh_font
134
+ @window.destroy
135
+ end
136
+
137
+ def run
138
+ @window.show
139
+ end
140
+ end
141
+
142
+ def show_settings_dialog
143
+ SettingsDialog.new.run
144
+ end
145
+
146
+ def gui_refresh_font
147
+ return unless $vmag
148
+ provider = Gtk::CssProvider.new
149
+ provider.load(data: "textview { font-family: #{get(cnf.font.family)}; font-size: #{get(cnf.font.size)}pt; }")
150
+ for _k, window in $vmag.windows
151
+ view = window[:sw].child
152
+ next if view.nil?
153
+ view.style_context.add_provider(provider)
154
+ end
155
+ end
@@ -1,16 +1,6 @@
1
1
  # class VSourceView < Gtk::TextView
2
2
  class VSourceView < GtkSource::View
3
3
  attr_accessor :bufo, :autocp_active, :cpl_list
4
- # :highlight_matching_brackets
5
-
6
- # def set_highlight_current_line(vbool)
7
- # end
8
-
9
- # def set_show_line_numbers(vbool)
10
- # end
11
-
12
- # def highlight_matching_brackets=(vbool)
13
- # end
14
4
 
15
5
  # def initialize(title = nil,bufo=nil)
16
6
  def initialize(title, bufo)
@@ -27,30 +17,8 @@ class VSourceView < GtkSource::View
27
17
 
28
18
  @tt = nil
29
19
 
30
- # self.drag_dest_add_image_targets #TODO:gtk4
31
- # self.drag_dest_add_uri_targets #TODO:gtk4
32
-
33
- # signal_connect("drag-data-received") do |widget, event, x, y, data, info, time| #TODO:gtk4
34
- # puts "drag-data-received"
35
- # puts
36
- # if data.uris.size >= 1
37
-
38
- # imgpath = CGI.unescape(data.uris[0])
39
- # m = imgpath.match(/^file:\/\/(.*)/)
40
- # if m
41
- # fp = m[1]
42
- # handle_drag_and_drop(fp)
43
- # end
44
- # end
45
- # true
46
- # end
47
-
48
- # signal_connect("show-completion") do |x, y, z|
49
- # debug "SHOW-COMPLETION", 2
50
- # false
51
- # end
52
-
53
20
  # Mainly after page-up or page-down
21
+
54
22
  signal_connect("move-cursor") do |widget, event|
55
23
  # if event.name == "GTK_MOVEMENT_PAGES" and (vma.actions.last_action == "page_up" or vma.actions.last_action == "page_down")
56
24
  # handle_scrolling()
@@ -70,7 +38,6 @@ class VSourceView < GtkSource::View
70
38
 
71
39
  return
72
40
 
73
- #TODO:gtk4
74
41
  signal_connect "button-release-event" do |widget, event|
75
42
  vma.buf.set_pos(buffer.cursor_position)
76
43
  false
@@ -115,7 +82,7 @@ class VSourceView < GtkSource::View
115
82
  # Gtk::GestureDrag
116
83
  # Gtk::ShortcutController
117
84
 
118
- if ctr != @click and [Gtk::DropControllerMotion, Gtk::DropTarget, Gtk::GestureDrag, Gtk::GestureClick, Gtk::EventControllerKey].include?(ctr.class)
85
+ if ![@click, @dt].include?(ctr) and [Gtk::DropControllerMotion, Gtk::DropTarget, Gtk::GestureDrag, Gtk::GestureClick, Gtk::EventControllerKey].include?(ctr.class)
119
86
  to_remove << ctr
120
87
  end
121
88
  }
@@ -157,11 +124,8 @@ class VSourceView < GtkSource::View
157
124
  uri = v.value.gsub(/\r\n$/, "")
158
125
  end
159
126
  debug "dt,drop #{v.value},#{x},#{y}", 2
160
- begin
161
- fp = URI(uri).path
162
- buf.handle_drag_and_drop(fp)
163
- rescue URI::InvalidURIError
164
- end
127
+ fp = uri_to_path(uri)
128
+ buf.handle_drag_and_drop(fp) if !fp.nil?
165
129
  true
166
130
  end
167
131
 
@@ -210,9 +174,24 @@ class VSourceView < GtkSource::View
210
174
  i = coord_to_iter(x, y, true)
211
175
  pp i
212
176
  @range_start = i
177
+ @drag_start_x = x
178
+ @drag_start_y = y
213
179
  buf.start_selection
214
180
  end
215
181
 
182
+ @cnt_drag.signal_connect "drag-update" do |gesture, offset_x, offset_y|
183
+ next unless @range_start
184
+ cur_x = @drag_start_x + offset_x
185
+ cur_y = @drag_start_y + offset_y
186
+ debug "drag-update 2 #{cur_x} #{cur_y}"
187
+ i = coord_to_iter(cur_x, cur_y, true)
188
+ @bufo.set_pos(i) if !i.nil? and @last_iter != i
189
+ if !i.nil? and (@range_start - i).abs >= 2
190
+ vma.kbd.set_mode(:visual)
191
+ end
192
+ @last_iter = i
193
+ end
194
+
216
195
  @cnt_drag.signal_connect "drag-end" do |gesture, offsetx, offsety|
217
196
  debug "drag-end", 2
218
197
  if offsetx.abs < 5 and offsety.abs < 5
@@ -222,8 +201,7 @@ class VSourceView < GtkSource::View
222
201
  elsif vma.kbd.get_scope != :editor
223
202
  # Can't transition from editor wide mode to buffer specific mode
224
203
  vma.kbd.set_mode(:visual)
225
- else
226
- buf.end_selection
204
+ else # The normal case
227
205
  end
228
206
  @range_start = nil
229
207
  end
@@ -235,6 +213,19 @@ class VSourceView < GtkSource::View
235
213
  @click = click
236
214
 
237
215
  @range_start = nil
216
+
217
+ # Handle right click
218
+ rightclick = Gtk::GestureClick.new
219
+ rightclick.button = 3
220
+ self.add_controller(rightclick)
221
+ rightclick.signal_connect "pressed" do |gesture, n_press, x, y, z|
222
+ puts "SourceView, GestureClick rightclick released button=#{gesture.button} x=#{x} y=#{y}"
223
+ if gesture.button == 3
224
+ show_context_menu(x, y)
225
+ next true
226
+ end
227
+ end
228
+
238
229
  click.signal_connect "pressed" do |gesture, n_press, x, y, z|
239
230
  debug "SourceView, GestureClick released x=#{x} y=#{y}"
240
231
 
@@ -255,11 +246,19 @@ class VSourceView < GtkSource::View
255
246
  end
256
247
 
257
248
  @bufo.set_pos(i) if !i.nil?
249
+ if n_press == 2
250
+ #TODO: refactor to have one function for all line actions
251
+ if @bufo.module&.respond_to?(:select_line)
252
+ @bufo.module.select_line
253
+ else
254
+ @bufo.cur_nonwhitespace_word_action()
255
+ end
256
+ end
258
257
  true
259
258
  end
260
259
 
261
260
  click.signal_connect "released" do |gesture, n_press, x, y, z|
262
- debug "SourceView, GestureClick released x=#{x} y=#{y}"
261
+ debug "SourceView, GestureClick released x=#{x} y=#{y} button=#{gesture.button}"
263
262
 
264
263
  xloc = (x - gutter_width).to_i
265
264
  yloc = (y + visible_rect.y).to_i
@@ -422,15 +421,15 @@ class VSourceView < GtkSource::View
422
421
 
423
422
  keynfo = { :key_str => key_str, :key_name => keyname, :keyval => keyval }
424
423
  debug keynfo.inspect
425
- # $kbd.match_key_conf(key_str, nil, :key_press)
424
+ # vma.kbd.match_key_conf(key_str, nil, :key_press)
426
425
  # debug "key_str=#{key_str} key_"
427
426
 
428
427
  if key_str != "" # or prefixed_key_str != ""
429
428
  if sig == :key_release and keyval == @last_keyval
430
- $kbd.match_key_conf(key_str + "!", nil, :key_release)
429
+ vma.kbd.match_key_conf(key_str + "!", nil, :key_release)
431
430
  @last_event = [keynfo, :key_release]
432
431
  elsif sig == :key_press
433
- $kbd.match_key_conf(key_str, nil, :key_press)
432
+ vma.kbd.match_key_conf(key_str, nil, :key_press)
434
433
  @last_event = [keynfo, key_str, :key_press]
435
434
  end
436
435
  end
@@ -623,7 +622,7 @@ class VSourceView < GtkSource::View
623
622
 
624
623
  mode = vma.kbd.get_mode
625
624
  ctype = vma.kbd.get_cursor_type
626
- ctype = :visual if vma.buf.selection_active?
625
+ ctype = :visual if @bufo.selection_active?
627
626
 
628
627
  if [:command, :replace, :browse].include?(ctype)
629
628
  set_cursor_color(ctype)
@@ -668,4 +667,44 @@ class VSourceView < GtkSource::View
668
667
  self.cursor_visible = true
669
668
  end
670
669
  end #end draw_cursor
670
+
671
+ CONTEXT_MENU_ITEMS = [
672
+ ["Paste", :paste_after_cursor],
673
+ ["Previous buffer", :history_switch_backwards],
674
+ ]
675
+
676
+ CONTEXT_MENU_ITEMS_SELECTION = [
677
+ ["Copy", :copy_selection],
678
+ ["Cut", :cut_selection],
679
+ ]
680
+
681
+ def init_context_menu
682
+ all_items = CONTEXT_MENU_ITEMS + CONTEXT_MENU_ITEMS_SELECTION
683
+ all_items.each do |label, action_id|
684
+ actkey = "ctx_#{action_id}"
685
+ unless vma.gui.app.lookup_action(actkey)
686
+ act = Gio::SimpleAction.new(actkey)
687
+ vma.gui.app.add_action(act)
688
+ act.signal_connect("activate") do
689
+ call_action(action_id)
690
+ after_action
691
+ end
692
+ end
693
+ end
694
+ @context_menu = Gtk::PopoverMenu.new
695
+ @context_menu.set_parent(self)
696
+ @context_menu.has_arrow = false
697
+ end
698
+
699
+ def show_context_menu(x, y)
700
+ init_context_menu if @context_menu.nil?
701
+ menu = Gio::Menu.new
702
+ CONTEXT_MENU_ITEMS.each { |label, action_id| menu.append(label, "app.ctx_#{action_id}") }
703
+ if @bufo.selection_active?
704
+ CONTEXT_MENU_ITEMS_SELECTION.each { |label, action_id| menu.append(label, "app.ctx_#{action_id}") }
705
+ end
706
+ @context_menu.set_menu_model(menu)
707
+ @context_menu.set_pointing_to(Gdk::Rectangle.new(x.to_i, y.to_i, 1, 1))
708
+ @context_menu.popup
709
+ end
671
710
  end
@@ -19,12 +19,12 @@ def jump_to_next_edit
19
19
  end
20
20
 
21
21
  def is_command_mode()
22
- return true if $kbd.mode_root_state.to_s() == "C"
22
+ return true if vma.kbd.mode_root_state.to_s() == "C"
23
23
  return false
24
24
  end
25
25
 
26
26
  def is_visual_mode()
27
- return 1 if $kbd.mode_root_state.to_s() == "V"
27
+ return 1 if vma.kbd.mode_root_state.to_s() == "V"
28
28
  return 0
29
29
  end
30
30
 
@@ -35,9 +35,19 @@ reg_act(:lsp_jump_to_definition, proc { vma.buf.lsp_jump_to_def }, "LSP jump to
35
35
 
36
36
  reg_act(:eval_buf, proc { vma.buf.eval_whole_buf }, "Eval whole current buffer as ruby code (DANGEROUS)")
37
37
 
38
+ reg_act(:show_settings, proc { show_settings_dialog }, "Show settings")
39
+ reg_act(:cut_selection, proc { buf.delete(SELECTION) }, "Cut selection to clipboard")
40
+
41
+ reg_act(:insert_backspace, proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(BACKWARD_CHAR) }, "Delete backwards")
42
+ reg_act(:insert_select_up, proc { insert_select_move(BACKWARD_LINE) }, "Select texte upwards")
43
+ reg_act(:insert_select_down, proc { insert_select_move(BACKWARD_CHAR) }, "Select text downwards")
44
+
45
+ reg_act(:copy_selection, proc { buf.copy_active_selection }, "Copy selection to clipboard")
38
46
  reg_act(:enable_debug, proc { cnf.debug = true }, "Enable debug")
39
47
  reg_act(:disable_debug, proc { cnf.debug = false }, "Disable debug")
40
48
 
49
+ reg_act(:experimental_eval, proc { bindkey "V , e", "vma.buf.convert_selected_text(:eval)" }, "Enable key binding:\"[VISUAL] , e:\" Eval selected text")
50
+
41
51
  reg_act(:easy_jump, proc { EasyJump.start }, "Easy jump")
42
52
  reg_act(:gui_ensure_cursor_visible, proc { vma.gui.view.ensure_cursor_visible }, "Scroll to current cursor position")
43
53
  reg_act(:gui_refresh_cursor, proc { vma.buf.refresh_cursor }, "Refresh cursor")
@@ -46,17 +56,18 @@ reg_act(:savedebug, "savedebug", "Save debug info", { :group => :debug })
46
56
  reg_act(:open_file_dialog, "open_file_dialog", "Open file", { :group => :file })
47
57
  reg_act(:create_new_file, "create_new_file", "Create new file", { :group => :file })
48
58
  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] })
59
+ reg_act(:e_move_forward_char, "e_move_forward_char", "Move forward", { :group => [:move, :basic] })
60
+ reg_act(:e_move_backward_char, "e_move_backward_char", "Move forward", { :group => [:move, :basic] })
51
61
  # 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 })
62
+ reg_act(:history_switch_backwards, proc{bufs.history_switch(-1)}, "Prev buffer", { :group => :file })
63
+ reg_act(:history_switch_forwards, proc{bufs.history_switch(+1)}, "Next buffer", { :group => :file })
64
+ reg_act(:print_buffer_access_list, proc { bufs.print_by_access_time }, "Print buffers by access time", { :group => :file })
54
65
  reg_act(:center_on_current_line, "center_on_current_line", "", { :group => :view })
55
66
  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 }, "")
67
+ reg_act(:jump_to_next_edit, "jump_to_next_edit", "Jump to next edit pos")
68
+ reg_act(:jump_to_last_edit, proc { buf.jump_to_last_edit }, "Jump to last edit pos")
58
69
  reg_act(:jump_to_random, proc { buf.jump_to_random_pos }, "")
59
- reg_act(:insert_new_line, proc { buf.insert_new_line() }, "")
70
+ reg_act(:insert_new_line, proc { buf.insert_new_line() }, "Insert new line")
60
71
  reg_act(:show_key_bindings, proc { show_key_bindings }, "Show key bindings")
61
72
  reg_act(:put_file_path_to_clipboard, proc { buf.put_file_path_to_clipboard }, "Put file path of current file to clipboard")
62
73
  reg_act(:put_file_ref_to_clipboard, proc { buf.put_file_ref_to_clipboard }, "Put file ref of current file to clipboard")
@@ -67,12 +78,15 @@ reg_act(:set_unencrypted, proc { buf.set_unencrypted }, "Set current file to sav
67
78
  reg_act(:set_executable, proc { buf.set_executable }, "Set current file permissions to executable")
68
79
  # reg_act(:close_all_buffers, proc { bufs.close_all_buffers() }, "Close all buffers")
69
80
  reg_act(:close_current_buffer, proc { bufs.close_current_buffer(true) }, "Close current buffer")
70
- reg_act(:comment_selection, proc { buf.comment_selection }, "")
81
+ reg_act(:toggle_file_panel, proc { vma.gui.toggle_file_panel }, "Toggle file panel")
82
+ reg_act(:comment_selection, proc { buf.comment_selection }, "Comment selection")
71
83
  reg_act(:delete_char_forward, proc { buf.delete(CURRENT_CHAR_FORWARD) }, "Delete char forward", { :group => [:edit, :basic] })
72
- reg_act(:load_theme, proc { load_theme }, "Load theme")
73
84
  reg_act(:gui_file_finder, proc { vma.FileFinder.start_gui }, "Fuzzy file finder")
74
85
  reg_act(:gui_file_history_finder, proc { vma.FileHistory.start_gui }, "Fuzzy file history finder")
75
86
  reg_act(:gui_search_replace, proc { gui_search_replace }, "Search and replace")
87
+ reg_act(:find_next, proc { $search.jump_to_next() }, "Find next")
88
+
89
+
76
90
  reg_act(:set_style_bold, proc { buf.style_transform(:bold) }, "Set text weight to bold")
77
91
  reg_act(:set_style_link, proc { buf.style_transform(:link) }, "Set text as link")
78
92
  reg_act(:V_join_lines, proc { vma.buf.convert_selected_text(:joinlines) }, "Join lines")
@@ -85,11 +99,13 @@ reg_act(:set_line_style_h4, proc { buf.set_line_style(:h4) }, "Set cur line as H
85
99
  reg_act(:set_line_style_bold, proc { buf.set_line_style(:bold) }, "Set style of current line as bold")
86
100
  reg_act(:set_line_style_title, proc { buf.set_line_style(:title) }, "Set style of current line as title")
87
101
  reg_act(:clear_line_styles, proc { buf.set_line_style(:clear) }, "Clear styles of current line")
88
- reg_act(:gui_select_buffer, proc { $kbd.set_mode("S"); gui_select_buffer }, "Select buffer")
102
+ reg_act(:gui_select_buffer, proc { vma.kbd.set_mode("S"); gui_select_buffer }, "Select buffer")
89
103
  reg_act :open_file_dialog, "open_file_dialog", "Open file"
90
104
  reg_act :minibuffer_end, proc { minibuffer_end }
91
- reg_act(:invoke_replace, "invoke_replace", "")
105
+ reg_act(:invoke_replace, "invoke_replace", "Invoke replace")
92
106
  reg_act(:diff_buffer, "diff_buffer", "")
107
+ reg_act(:git_diff_buffer, proc { git_diff_buffer }, "Show git diff of current file")
108
+ reg_act(:diff_buffer_jump_to_source, proc { diff_buffer_jump_to_source }, "Jump to corresponding line in source from diff buffer")
93
109
  # reg_act(:invoke_grep_search, proc{invoke_grep_search}, "")
94
110
  reg_act(:invoke_grep_search, proc { gui_grep }, "Grep current buffer")
95
111
  reg_act(:ack_search, proc { gui_ack }, "") #invoke_ack_search
@@ -98,6 +114,32 @@ reg_act :delete_to_word_end, proc { buf.delete2(:to_word_end) }, "Delete to file
98
114
  reg_act :delete_to_next_word_start, proc { buf.delete2(:to_next_word) }, "Delete to start of next word", { :group => [:edit, :basic] }
99
115
  reg_act :delete_to_line_start, proc { buf.delete2(:to_line_start) }, "Delete to line start", { :group => [:edit, :basic] }
100
116
 
117
+
118
+ reg_act(:ack_search, proc { gui_ack }, "Ack")
119
+
120
+ reg_act(:copy_cur_line, proc {buf.copy_line}, "Copy the current line")
121
+ reg_act(:paste_before_cursor, proc {buf.paste(BEFORE)}, "Paste text before the cursor")
122
+ reg_act(:paste_after_cursor, proc {buf.paste(AFTER)}, "Paste text after the cursor")
123
+ reg_act(:redo, proc {buf.redo()}, "Redo the last undone action")
124
+ reg_act(:undo, proc {buf.undo()}, "Undo the last action")
125
+ reg_act(:jump_end_of_line, proc { buf.jump(END_OF_LINE) }, "Move to the end of the current line")
126
+ reg_act(:jump_end_of_buffer, proc {buf.jump(END_OF_BUFFER)}, "Move to the end of the buffer")
127
+ reg_act(:jump_start_of_buffer, proc { buf.jump(START_OF_BUFFER) }, "Move to the start of the buffer")
128
+ reg_act(:jump_beginning_of_line, proc { buf.jump(BEGINNING_OF_LINE) }, "Move to the beginning of the current line")
129
+ reg_act(:jump_next_word_end, proc { buf.jump_word(FORWARD,WORD_END) }, "Jump to the end of the next word")
130
+ reg_act(:jump_prev_word_start, proc { buf.jump_word(BACKWARD,WORD_START) }, "Jump to the start of the previous word")
131
+ reg_act(:jump_next_word_start, proc { buf.jump_word(FORWARD,WORD_START) }, "Jump to the start of the next word")
132
+ reg_act(:insert_mode, proc { vma.kbd.set_mode(:insert) }, "Switch to INSERT mode")
133
+ reg_act(:prev_mode, proc { vma.kbd.to_previous_mode }, "Return to the previous mode")
134
+ reg_act(:move_prev_line, proc { buf.move(BACKWARD_LINE) }, "Move the cursor to the previous line")
135
+ reg_act(:move_next_line, proc { buf.move(FORWARD_LINE) }, "Move the cursor to the next line")
136
+ reg_act(:move_backward_char, proc { buf.move(BACKWARD_CHAR) }, "Move one character backward")
137
+ reg_act(:start_visual_mode, proc { buf.start_selection;vma.kbd.set_mode(:visual) }, "Enter VISUAL mode (for selections)")
138
+ reg_act(:jump_last_edit, proc { buf.jump_to_last_edit }, "Jump to the last edit location")
139
+ reg_act(:install_demo_files, proc { install_demo_files }, "Install and show Demo")
140
+ reg_act(:reload_customrb, proc { reload_customrb }, "Reload custom.rb")
141
+
142
+
101
143
  reg_act :start_browse_mode, proc {
102
144
  vma.kbd.set_mode(:browse)
103
145
  bufs.reset_navigation
@@ -165,6 +207,9 @@ act_list = {
165
207
 
166
208
  :backward_line => { :proc => proc { buf.move(BACKWARD_LINE) },
167
209
  :desc => "Move one line backward", :group => [:move, :basic] },
210
+
211
+ :increment_word => { :proc => proc { buf.increment_current_word},
212
+ :desc => "Increment word", :group => [:edit, :extra] },
168
213
 
169
214
  # { :proc => proc { },
170
215
  # :desc => "", :group => : },