vimamsa 0.1.13 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/custom_example.rb +12 -0
  3. data/lib/vimamsa/ack.rb +3 -4
  4. data/lib/vimamsa/actions.rb +1 -2
  5. data/lib/vimamsa/audio.rb +25 -1
  6. data/lib/vimamsa/buffer.rb +116 -591
  7. data/lib/vimamsa/buffer_changetext.rb +272 -0
  8. data/lib/vimamsa/buffer_cursor.rb +303 -0
  9. data/lib/vimamsa/buffer_list.rb +137 -133
  10. data/lib/vimamsa/buffer_manager.rb +15 -15
  11. data/lib/vimamsa/clipboard.rb +36 -0
  12. data/lib/vimamsa/conf.rb +136 -5
  13. data/lib/vimamsa/constants.rb +0 -10
  14. data/lib/vimamsa/debug.rb +9 -8
  15. data/lib/vimamsa/editor.rb +57 -84
  16. data/lib/vimamsa/encrypt.rb +6 -11
  17. data/lib/vimamsa/file_history.rb +0 -8
  18. data/lib/vimamsa/file_manager.rb +142 -10
  19. data/lib/vimamsa/gui.rb +106 -85
  20. data/lib/vimamsa/gui_dialog.rb +113 -0
  21. data/lib/vimamsa/gui_menu.rb +5 -1
  22. data/lib/vimamsa/gui_sourceview.rb +46 -29
  23. data/lib/vimamsa/gui_sourceview_autocomplete.rb +141 -0
  24. data/lib/vimamsa/gui_text.rb +49 -0
  25. data/lib/vimamsa/hyper_plain_text.rb +19 -5
  26. data/lib/vimamsa/key_actions.rb +41 -202
  27. data/lib/vimamsa/key_binding_tree.rb +129 -41
  28. data/lib/vimamsa/key_bindings_vimlike.rb +58 -48
  29. data/lib/vimamsa/langservp.rb +23 -3
  30. data/lib/vimamsa/macro.rb +35 -25
  31. data/lib/vimamsa/main.rb +7 -10
  32. data/lib/vimamsa/rbvma.rb +13 -11
  33. data/lib/vimamsa/search.rb +1 -1
  34. data/lib/vimamsa/search_replace.rb +106 -160
  35. data/lib/vimamsa/terminal.rb +34 -0
  36. data/lib/vimamsa/tests.rb +122 -0
  37. data/lib/vimamsa/util.rb +43 -4
  38. data/lib/vimamsa/version.rb +1 -1
  39. data/vimamsa.gemspec +5 -2
  40. metadata +59 -9
  41. /data/lib/vimamsa/{form_generator.rb → gui_form_generator.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bd13f53f2d774550226da6e379842c2d54bde6e8ffa5362d4769940d93a033e
4
- data.tar.gz: 5f2db7ad2c5402a816f186e266194f1a7545b1a2a71fd532f9140634835fc3f2
3
+ metadata.gz: ea3e4fa5b65895cba0a20cae08fad4f422008e786f4cd3ab405d39bf630f52db
4
+ data.tar.gz: 65b80bb0e663f64d241e51130aac9e13106c58ff20f698c095e5cf43b416ce41
5
5
  SHA512:
6
- metadata.gz: d41917d0e0cfa9a876579bea6aaaafee3b3eff3757d74c399922a5db71220889f278df03bd1bc3e1177002fa906e3d30792280004dd5270d2b135dd6006f51ca
7
- data.tar.gz: c4935e09ecb5a714cb481ac00386e698aee72583030f03cf9b7c182c71066513339c2c0c4aa6f723e00630e659704e95a107007a76af936d08e67a8e6ded5c5f
6
+ metadata.gz: 1c056fa3ed552a410b7a9f06ebfb0f2eb1444feba9a5810a520e8012a245b83bd156115566d2965095e8d7bacc184883e1bb16e724efa26c9abd0180c2640050
7
+ data.tar.gz: 9196b537289ac4a08b09c53dbbdf03ccd5bec1cb50d3de4b40a03352cf64c0fc0776d489803a421d00d72bad72fd96cefc45865f27d1df5f22b67b9906c4edf9
data/custom_example.rb CHANGED
@@ -15,6 +15,18 @@
15
15
  # Open this file every time the program starts
16
16
  # setcnf :startup_file, "~/Documents/startup.txt"
17
17
 
18
+ # To enable LSP:
19
+ # cnf.lsp.enabled = true
20
+ # cnf.lsp.server.solargraph = { name: "solargraph", command: "solargraph stdio", type: "stdio" }
21
+ # cnf.lsp.server.solargraph.languages = ["ruby"]
22
+
23
+ # cnf.lsp.server.clangd = { name: "clangd", command: "clangd-12 --offset-encoding=utf-8", type: "stdio" }
24
+ # cnf.lsp.server.clangd.languages = ["c", "cpp"]
25
+
26
+
27
+
28
+
29
+
18
30
  def insert_date()
19
31
  # $buffer.insert_txt("#{DateTime.now().strftime("==========\n%Y-%m-%d")}\n")
20
32
  vma.buf.insert_txt("#{DateTime.now().strftime("%Y-%m-%d")}\n")
data/lib/vimamsa/ack.rb CHANGED
@@ -45,7 +45,7 @@ Will search all .txt files in the following directories:
45
45
  dlist = dlist + Dir.glob("#{d}/**/*").select { |e| File.file?(e) and fext.include?(File.extname(e)) and File.size(e) < 200e3 }
46
46
  end
47
47
  bufstr = "Results:\n\n"
48
- b = create_new_buffer(bufstr,"contentsearch")
48
+ b = create_new_buffer(bufstr, "contentsearch")
49
49
  lno = 1
50
50
  @linep = {}
51
51
  for fp in dlist
@@ -81,7 +81,6 @@ Will search all .txt files in the following directories:
81
81
  end
82
82
  end
83
83
 
84
- # jumpto = $grep_matches[lineno]
85
84
  # if jumpto.class == Integer
86
85
  # vma.buffers.set_current_buffer($grep_bufid, update_history = true)
87
86
  # buf.jump_to_line(jumpto)
@@ -118,8 +117,8 @@ def ack_buffer(_instr, b = nil)
118
117
  bufstr += run_cmd("ack -Q --type-add=gd=.gd -ki --nohtml --nojs --nojson #{instr} #{path}")
119
118
  end
120
119
  if bufstr.size > 5
121
- b = create_new_buffer(bufstr,"ack")
122
- highlight_match(b, _instr, color: "#10bd8e")
120
+ b = create_new_buffer(bufstr, "ack")
121
+ Gui.highlight_match(b, _instr, color: cnf.match.highlight.color!)
123
122
  else
124
123
  message("No results for input:#{instr}")
125
124
  end
@@ -121,9 +121,8 @@ def search_actions_select_callback(search_str, idx)
121
121
  end
122
122
 
123
123
  def filter_items(item_list, item_key, search_str)
124
- # Ripl.start :binding => binding
125
124
  item_hash = {}
126
- puts item_list.inspect
125
+ # debug item_list.inspect
127
126
  scores = Parallel.map(item_list, in_threads: 8) do |item|
128
127
  if item[:str].class != String
129
128
  puts item.inspect
data/lib/vimamsa/audio.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  require "gstreamer"
2
2
 
3
+ class File
4
+ def self.exists?(fn)
5
+ File.exist?(fn)
6
+ end
7
+ end
8
+
3
9
  # following the example gstreamer-4.2.0/sample/helloworld_e.rb
4
10
  class Audio
5
11
  @@playbin = nil
@@ -22,6 +28,8 @@ class Audio
22
28
  end
23
29
  end
24
30
 
31
+ # playbin.seek(10.0)
32
+
25
33
  # playbin.volume
26
34
  # playbin.volume=1.0
27
35
  # playbin.stream_time
@@ -35,10 +43,10 @@ class Audio
35
43
  end
36
44
  playbin.uri = uri
37
45
  @@playbin = playbin
46
+ $pb = playbin
38
47
 
39
48
  bus = playbin.bus
40
49
  bus.add_watch do |bus, message|
41
-
42
50
  case message.type
43
51
  when Gst::MessageType::EOS
44
52
  puts "End-of-stream"
@@ -54,5 +62,21 @@ class Audio
54
62
 
55
63
  # start play back and listed to events
56
64
  playbin.play
65
+ playbin.seek_simple(Gst::Format::TIME, Gst::SeekFlags::NONE, 10.0)
66
+ end
67
+
68
+ def self.seek_forward(secs = 5.0)
69
+ return if @@playbin.nil?
70
+ if @@playbin.current_state == "playing"
71
+ duration = @@playbin.query_duration(Gst::Format::TIME)[1]
72
+ curpos = @@playbin.query_position(Gst::Format::TIME)[1]
73
+ newpos = curpos + secs * 1.0e9
74
+ newpos = 0.0 if newpos < 0
75
+ return if newpos > duration
76
+ @@playbin.seek_simple(Gst::Format::TIME, Gst::SeekFlags::FLUSH, newpos)
77
+ message("New audio pos: #{(newpos / 1.0e9).round(1)}/#{(duration / 1.0e9).round(1)}")
78
+ # $pb.query_position(Gst::Format::TIME)[1]/1.0e9
79
+ end
57
80
  end
58
81
  end
82
+