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
data/lib/vimamsa/util.rb CHANGED
@@ -1,11 +1,52 @@
1
1
  require "open3"
2
2
 
3
+ # Get all indexes for start of matching regexp
4
+ def scan_indexes(txt, regex)
5
+ # indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) + 1 }
6
+ indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) }
7
+ return indexes
8
+ end
9
+
10
+ def file_mime_type(fpath)
11
+ fpath = File.expand_path(fpath)
12
+ return false if !File.readable?(fpath)
13
+ r = exec_cmd("file", "--mime-type", "--mime-encoding", fpath)
14
+ return false if r.class != String
15
+ return false if r.size < 2
16
+ m = r.match(".*:\s*(.*)")
17
+ mimetype = m[1].match(/(.*);/)
18
+ charset = m[1].match(/charset=(.*)/)
19
+ return [mimetype, charset]
20
+ end
21
+
22
+ def file_is_text_file(fpath)
23
+ debug "file_is_text_file(#{fpath})"
24
+ fpath = File.expand_path(fpath)
25
+ return false if !File.exist?(fpath)
26
+ return false if !File.file?(fpath)
27
+
28
+ if File.size(fpath) < 1000e3 #smaler than 1MB
29
+ str = IO.read(fpath)
30
+ str.force_encoding("UTF-8")
31
+ debug "Small file with valid utf-8"
32
+ return true if str.valid_encoding?
33
+ end
34
+
35
+ #TODO: not sure if needed
36
+ r = exec_cmd("file", fpath)
37
+ return true if r.match(/UTF-8.*text/)
38
+ return true if r.match(/ASCII.*text/)
39
+ return false
40
+ end
41
+
42
+ # file --mime-type --mime-encoding
3
43
 
4
44
  # Run idle proc once
5
45
  # Delay execution of proc until Gtk has fully processed the last calls.
6
- def run_as_idle(p)
46
+ def run_as_idle(p, delay: 0.0)
7
47
  if p.class == Proc
8
48
  Thread.new {
49
+ sleep delay
9
50
  GLib::Idle.add(proc { p.call; false })
10
51
  }
11
52
  end
@@ -69,7 +110,7 @@ class HSafe
69
110
  hh = @h
70
111
  while !b.empty?
71
112
  x = b.pop
72
- puts "x=#{x}"
113
+ debug "x=#{x}"
73
114
  pp b
74
115
  ok = false
75
116
  if hh.class == Hash or hh.class == Array
@@ -192,8 +233,6 @@ def sanitize_input(str)
192
233
  return str
193
234
  end
194
235
 
195
-
196
-
197
236
  def is_url(s)
198
237
  return s.match(/(https?|file):\/\/.*/) != nil
199
238
  end
@@ -1,3 +1,3 @@
1
1
  module Vimamsa
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.15"
3
3
  end
data/vimamsa.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib","ext"]
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 2.4.21"
24
- spec.add_development_dependency "rake", "~> 13.0"
24
+ spec.add_development_dependency "rake", "~> 13.1.0"
25
25
 
26
26
  spec.add_runtime_dependency 'rufo', '~> 0.16.2'
27
27
 
@@ -29,11 +29,14 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency 'ripl-multi_line', '~> 0.3.1'
30
30
  spec.add_runtime_dependency 'gdk4', '~> 4.2.0'
31
31
  spec.add_runtime_dependency 'gtk4', '~> 4.2.0'
32
+ spec.add_runtime_dependency 'rambling-trie', '~> 2.3.1'
33
+
32
34
  spec.add_runtime_dependency 'differ', '~> 0.1.2'
33
35
  spec.add_runtime_dependency 'gtksourceview5', '~> 4.2.0'
34
36
  spec.add_runtime_dependency 'parallel', '~> 1.14' #TODO: update?
35
37
  spec.add_runtime_dependency 'listen', '~> 3.4' #TODO: update?
36
-
38
+ spec.add_runtime_dependency 'language_server-protocol', '~> 3.17.0.3'
39
+ spec.add_runtime_dependency 'gstreamer', '~> 4.2.0'
37
40
 
38
41
  spec.extensions = ["ext/vmaext/extconf.rb"]
39
42
  spec.licenses = ['GPL-3.0+']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimamsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sami Sieranoja
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-29 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '13.0'
33
+ version: 13.1.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '13.0'
40
+ version: 13.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rufo
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 4.2.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rambling-trie
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 2.3.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 2.3.1
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: differ
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +178,34 @@ dependencies:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
180
  version: '3.4'
181
+ - !ruby/object:Gem::Dependency
182
+ name: language_server-protocol
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 3.17.0.3
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 3.17.0.3
195
+ - !ruby/object:Gem::Dependency
196
+ name: gstreamer
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 4.2.0
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 4.2.0
167
209
  description: Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby
168
210
  and GTK.
169
211
  email:
@@ -192,8 +234,11 @@ files:
192
234
  - lib/vimamsa/actions.rb
193
235
  - lib/vimamsa/audio.rb
194
236
  - lib/vimamsa/buffer.rb
237
+ - lib/vimamsa/buffer_changetext.rb
238
+ - lib/vimamsa/buffer_cursor.rb
195
239
  - lib/vimamsa/buffer_list.rb
196
240
  - lib/vimamsa/buffer_manager.rb
241
+ - lib/vimamsa/clipboard.rb
197
242
  - lib/vimamsa/conf.rb
198
243
  - lib/vimamsa/constants.rb
199
244
  - lib/vimamsa/debug.rb
@@ -203,12 +248,15 @@ files:
203
248
  - lib/vimamsa/file_finder.rb
204
249
  - lib/vimamsa/file_history.rb
205
250
  - lib/vimamsa/file_manager.rb
206
- - lib/vimamsa/form_generator.rb
207
251
  - lib/vimamsa/gui.rb
252
+ - lib/vimamsa/gui_dialog.rb
253
+ - lib/vimamsa/gui_form_generator.rb
208
254
  - lib/vimamsa/gui_image.rb
209
255
  - lib/vimamsa/gui_menu.rb
210
256
  - lib/vimamsa/gui_select_window.rb
211
257
  - lib/vimamsa/gui_sourceview.rb
258
+ - lib/vimamsa/gui_sourceview_autocomplete.rb
259
+ - lib/vimamsa/gui_text.rb
212
260
  - lib/vimamsa/hook.rb
213
261
  - lib/vimamsa/hyper_plain_text.rb
214
262
  - lib/vimamsa/key_actions.rb
@@ -220,6 +268,8 @@ files:
220
268
  - lib/vimamsa/rbvma.rb
221
269
  - lib/vimamsa/search.rb
222
270
  - lib/vimamsa/search_replace.rb
271
+ - lib/vimamsa/terminal.rb
272
+ - lib/vimamsa/tests.rb
223
273
  - lib/vimamsa/text_transforms.rb
224
274
  - lib/vimamsa/util.rb
225
275
  - lib/vimamsa/version.rb
@@ -232,7 +282,7 @@ homepage: https://github.com/SamiSieranoja/vimamsa
232
282
  licenses:
233
283
  - GPL-3.0+
234
284
  metadata: {}
235
- post_install_message:
285
+ post_install_message:
236
286
  rdoc_options: []
237
287
  require_paths:
238
288
  - lib
@@ -248,8 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
298
  - !ruby/object:Gem::Version
249
299
  version: '0'
250
300
  requirements: []
251
- rubygems_version: 3.4.20
252
- signing_key:
301
+ rubygems_version: 3.3.26
302
+ signing_key:
253
303
  specification_version: 4
254
304
  summary: Vimamsa
255
305
  test_files: []