vimamsa 0.1.12 → 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 +5 -5
- data/lib/vimamsa/actions.rb +13 -6
- data/lib/vimamsa/audio.rb +82 -0
- data/lib/vimamsa/buffer.rb +73 -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 +61 -125
- data/lib/vimamsa/encrypt.rb +6 -11
- data/lib/vimamsa/file_manager.rb +138 -9
- data/lib/vimamsa/gui.rb +11 -59
- data/lib/vimamsa/gui_dialog.rb +113 -0
- data/lib/vimamsa/gui_select_window.rb +9 -8
- data/lib/vimamsa/gui_sourceview.rb +110 -48
- data/lib/vimamsa/gui_text.rb +19 -0
- data/lib/vimamsa/hyper_plain_text.rb +15 -5
- data/lib/vimamsa/key_actions.rb +19 -195
- data/lib/vimamsa/key_binding_tree.rb +57 -33
- data/lib/vimamsa/key_bindings_vimlike.rb +39 -26
- data/lib/vimamsa/macro.rb +35 -25
- data/lib/vimamsa/main.rb +3 -17
- data/lib/vimamsa/rbvma.rb +11 -17
- data/lib/vimamsa/search.rb +1 -1
- data/lib/vimamsa/search_replace.rb +93 -131
- data/lib/vimamsa/terminal.rb +22 -0
- data/lib/vimamsa/tests.rb +122 -0
- data/lib/vimamsa/util.rb +87 -2
- data/lib/vimamsa/version.rb +1 -1
- data/vimamsa.gemspec +3 -1
- metadata +57 -7
- /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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 510c17ec3221823fe5e8c800b4146879c11f278b37a0ad807d57729210af6b3a
|
4
|
+
data.tar.gz: 211596938920f6a785830d9d516cd9c999b4c8f54a67610eaf971ce127c4b8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
@@ -111,14 +110,15 @@ Will search the following directories:
|
|
111
110
|
gui_one_input_action(nfo, "Search:", "search", callback)
|
112
111
|
end
|
113
112
|
|
114
|
-
def ack_buffer(
|
115
|
-
instr = Shellwords.escape(
|
113
|
+
def ack_buffer(_instr, b = nil)
|
114
|
+
instr = Shellwords.escape(_instr)
|
116
115
|
bufstr = ""
|
117
116
|
for path in vma.get_content_search_paths
|
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
|
-
|
120
|
+
b = create_new_buffer(bufstr, "ack")
|
121
|
+
Gui.highlight_match(b, _instr, color: cnf.match.highlight.color!)
|
122
122
|
else
|
123
123
|
message("No results for input:#{instr}")
|
124
124
|
end
|
data/lib/vimamsa/actions.rb
CHANGED
@@ -32,11 +32,14 @@ def missing_callfunc
|
|
32
32
|
end
|
33
33
|
|
34
34
|
#TODO: remove
|
35
|
-
def call(id)
|
36
|
-
call_action(id)
|
37
|
-
end
|
35
|
+
# def call(id)
|
36
|
+
# call_action(id)
|
37
|
+
# end
|
38
|
+
|
39
|
+
$acth = []
|
38
40
|
|
39
41
|
def call_action(id)
|
42
|
+
$acth << id
|
40
43
|
a = $actions[id]
|
41
44
|
if a
|
42
45
|
a.method.call()
|
@@ -45,11 +48,15 @@ def call_action(id)
|
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
51
|
+
def last_action
|
52
|
+
return $acth[-1]
|
53
|
+
end
|
54
|
+
|
48
55
|
def search_actions()
|
49
56
|
l = []
|
50
|
-
opt = { :title => "Search actions
|
57
|
+
opt = { :title => "Search for actions", :desc => "Fuzzy search for actions. <up> or <down> to change selcted. <enter> to select current." }
|
51
58
|
$select_keys = ["h", "l", "f", "d", "s", "a", "g", "z"]
|
52
|
-
|
59
|
+
|
53
60
|
gui_select_update_window(l, $select_keys.collect { |x| x.upcase },
|
54
61
|
"search_actions_select_callback",
|
55
62
|
"search_actions_update_callback",
|
@@ -109,7 +116,7 @@ def search_actions_select_callback(search_str, idx)
|
|
109
116
|
eval(acc)
|
110
117
|
elsif acc.class == Symbol
|
111
118
|
debug "Symbol"
|
112
|
-
|
119
|
+
call_action(acc)
|
113
120
|
end
|
114
121
|
end
|
115
122
|
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "gstreamer"
|
2
|
+
|
3
|
+
class File
|
4
|
+
def self.exists?(fn)
|
5
|
+
File.exist?(fn)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
# following the example gstreamer-4.2.0/sample/helloworld_e.rb
|
10
|
+
class Audio
|
11
|
+
@@playbin = nil
|
12
|
+
|
13
|
+
def self.stop
|
14
|
+
@@playbin.stop if !@@playbin.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.play(fn)
|
18
|
+
playbin = @@playbin
|
19
|
+
if playbin.nil?
|
20
|
+
playbin = Gst::ElementFactory.make("playbin")
|
21
|
+
if playbin.nil?
|
22
|
+
puts "'playbin' gstreamer plugin missing"
|
23
|
+
return
|
24
|
+
end
|
25
|
+
else
|
26
|
+
if playbin.current_state == "playing"
|
27
|
+
playbin.stop # Stop previous play
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# playbin.seek(10.0)
|
32
|
+
|
33
|
+
# playbin.volume
|
34
|
+
# playbin.volume=1.0
|
35
|
+
# playbin.stream_time
|
36
|
+
# playbin.current_state
|
37
|
+
|
38
|
+
# take the commandline argument and ensure that it is a uri
|
39
|
+
if Gst.valid_uri?(fn)
|
40
|
+
uri = fn
|
41
|
+
else
|
42
|
+
uri = Gst.filename_to_uri(fn)
|
43
|
+
end
|
44
|
+
playbin.uri = uri
|
45
|
+
@@playbin = playbin
|
46
|
+
$pb = playbin
|
47
|
+
|
48
|
+
bus = playbin.bus
|
49
|
+
bus.add_watch do |bus, message|
|
50
|
+
case message.type
|
51
|
+
when Gst::MessageType::EOS
|
52
|
+
puts "End-of-stream"
|
53
|
+
when Gst::MessageType::ERROR
|
54
|
+
error, debug = message.parse_error
|
55
|
+
puts "Debugging info: #{debug || "none"}"
|
56
|
+
puts "Error: #{error.message}"
|
57
|
+
end
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
message("Start playing audio: #{fn}")
|
62
|
+
|
63
|
+
# start play back and listed to events
|
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
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|