vimamsa 0.1.13 → 0.1.14

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: 9bd13f53f2d774550226da6e379842c2d54bde6e8ffa5362d4769940d93a033e
4
- data.tar.gz: 5f2db7ad2c5402a816f186e266194f1a7545b1a2a71fd532f9140634835fc3f2
3
+ metadata.gz: 510c17ec3221823fe5e8c800b4146879c11f278b37a0ad807d57729210af6b3a
4
+ data.tar.gz: 211596938920f6a785830d9d516cd9c999b4c8f54a67610eaf971ce127c4b8e5
5
5
  SHA512:
6
- metadata.gz: d41917d0e0cfa9a876579bea6aaaafee3b3eff3757d74c399922a5db71220889f278df03bd1bc3e1177002fa906e3d30792280004dd5270d2b135dd6006f51ca
7
- data.tar.gz: c4935e09ecb5a714cb481ac00386e698aee72583030f03cf9b7c182c71066513339c2c0c4aa6f723e00630e659704e95a107007a76af936d08e67a8e6ded5c5f
6
+ metadata.gz: '08b64e33fe9c031326ac005bf42da69f5e3ed9ce7ffe73d84a387ede95be8e37a44d0c57d6b5b62d3d2842b8de855dc6145e42cf4cd4a4eb8341cab33cb2b86d'
7
+ data.tar.gz: 3057288ea2ab7b13939a96282da7540287ebba518714b8aa2db7a285d9aff99e435142ab915d13d92684d229069388a0b52c86a971abad8acb817c5343ba2fff
data/custom_example.rb CHANGED
@@ -15,6 +15,11 @@
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
+ # conf(:custom_lsp)[:ruby] = {name: "solargraph", command:"solargraph stdio", type: "stdio"}
20
+ # conf(:custom_lsp)[:cpp] = {name: "clangd", command:"clangd-12 --offset-encoding=utf-8", type: "stdio"}
21
+
22
+
18
23
  def insert_date()
19
24
  # $buffer.insert_txt("#{DateTime.now().strftime("==========\n%Y-%m-%d")}\n")
20
25
  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
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
+