vimamsa 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/vimamsa +27 -21
- data/ext/vmaext/vmaext.c +0 -3
- data/lib/vimamsa.rb +1 -31
- data/lib/vimamsa/buffer.rb +64 -35
- data/lib/vimamsa/buffer_list.rb +1 -1
- data/lib/vimamsa/default_key_bindings.rb +4 -1
- data/lib/vimamsa/editor.rb +26 -4
- data/lib/vimamsa/rbvma.rb +72 -13
- data/lib/vimamsa/util.rb +1 -1
- data/lib/vimamsa/version.rb +1 -1
- data/vimamsa.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f68b029a6b5f374740c9afa2cb7c4ac628db4c4b9295b7e64db8294dac89659
|
4
|
+
data.tar.gz: c7c72c69ec7cd513e976caff3b0b1f2e619d890d8d84e616fcd747e4ab1193be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 892b4011a44310ad05becbf108fce73d4cdda3a25d6241435b03519ad0dd264daa856502956f02f47386bce251aef3e0296cc682fc35b01fefa375fbffd5ee4a
|
7
|
+
data.tar.gz: 25c97fde0e225c7cb273bc0fa97d0db4d74376ea2ddca2baea8823dbb1e01d31334fabbaa8e319cc37d40eca23d37b3d64f2cbbbdcbbce88f7d30435cfb44a6f
|
data/exe/vimamsa
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
require
|
2
|
+
require "ripl/multi_line"
|
3
|
+
require "tempfile"
|
3
4
|
# Ripl.config[:multi_line_prompt] = ' > '
|
4
5
|
require "pathname"
|
5
6
|
|
@@ -7,28 +8,33 @@ ENV["GTK_THEME"] = "Adwaita:dark"
|
|
7
8
|
|
8
9
|
selfpath = __FILE__
|
9
10
|
selfpath = File.readlink(selfpath) if File.lstat(selfpath).symlink?
|
10
|
-
scriptdir = File.expand_path(File.dirname(selfpath)+"/..")
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
11
|
+
scriptdir = File.expand_path(File.dirname(selfpath) + "/..")
|
12
|
+
|
13
|
+
|
14
|
+
# If process is already running, open the parameter file in the running process and exit.
|
15
|
+
listen_dir = File.expand_path("~/.vimamsa/listen")
|
16
|
+
if File.exist?(listen_dir) and !ARGV[0].nil?
|
17
|
+
tmpf = Tempfile.new("vmarun", listen_dir)
|
18
|
+
fp = tmpf.path
|
19
|
+
tmpf.write(ARGV[0])
|
20
|
+
tmpf.close
|
21
|
+
tstart = Time.new
|
22
|
+
timeout = false
|
23
|
+
while File.exist?(fp)
|
24
|
+
sleep 0.001
|
25
|
+
if Time.new - tstart > 0.5
|
26
|
+
timeout = true
|
27
|
+
break
|
28
|
+
end
|
29
|
+
end
|
30
|
+
exit(0) if !timeout
|
31
|
+
end
|
32
|
+
|
33
|
+
$LOAD_PATH.unshift(File.expand_path("lib"))
|
34
|
+
$LOAD_PATH.unshift(File.expand_path("ext"))
|
27
35
|
|
28
36
|
require "vimamsa"
|
29
|
-
# Ilib:ext
|
37
|
+
# Ilib:ext
|
30
38
|
# r rbvma -e "puts VMA.new.run"
|
31
39
|
$vmag = VMAg.new()
|
32
40
|
$vmag.run
|
33
|
-
|
34
|
-
|
data/ext/vmaext/vmaext.c
CHANGED
data/lib/vimamsa.rb
CHANGED
@@ -1,42 +1,12 @@
|
|
1
1
|
require "vimamsa/version"
|
2
2
|
require "vmaext"
|
3
3
|
|
4
|
-
|
5
|
-
# require "vimamsa/constants"
|
6
|
-
# require "vimamsa/debug"
|
7
|
-
# require "vimamsa/actions"
|
8
|
-
# require "vimamsa/key_binding_tree"
|
9
|
-
# require "vimamsa/default_key_bindings"
|
10
|
-
|
11
|
-
# require "vimamsa/ack"
|
12
|
-
# require "vimamsa/buffer"
|
13
|
-
# require "vimamsa/buffer_list"
|
14
|
-
|
15
|
-
|
16
|
-
# require "vimamsa/easy_jump"
|
17
|
-
# require "vimamsa/editor"
|
18
|
-
# require "vimamsa/encrypt"
|
19
|
-
# require "vimamsa/file_finder"
|
20
|
-
# require "vimamsa/file_history"
|
21
|
-
# require "vimamsa/file_manager"
|
22
|
-
# require "vimamsa/hook"
|
23
|
-
# require "vimamsa/hyper_plain_text"
|
24
|
-
# require "vimamsa/macro"
|
25
|
-
# require "vimamsa/rbvma"
|
26
|
-
# require "vimamsa/search"
|
27
|
-
# require "vimamsa/search_replace"
|
28
|
-
# require "vimamsa/text_transforms"
|
29
|
-
# require "vimamsa/util"
|
30
|
-
# # require "version"
|
31
|
-
|
32
|
-
# require "vimamsa/main"
|
33
|
-
|
34
4
|
require "vimamsa/rbvma"
|
35
5
|
|
36
6
|
module Vimamsa
|
37
7
|
# Your code goes here...
|
38
8
|
def self.test
|
39
9
|
puts "Vimamsa test"
|
40
|
-
puts srn_dst("foobar","baz")
|
10
|
+
puts srn_dst("foobar", "baz")
|
41
11
|
end
|
42
12
|
end
|
data/lib/vimamsa/buffer.rb
CHANGED
@@ -15,7 +15,7 @@ class Buffer < String
|
|
15
15
|
|
16
16
|
attr_reader :pos, :lpos, :cpos, :deltas, :edit_history, :fname, :call_func, :pathname, :basename, :update_highlight, :marks, :is_highlighted, :syntax_detect_failed, :id, :lang
|
17
17
|
attr_writer :call_func, :update_highlight
|
18
|
-
attr_accessor :qt_update_highlight, :update_hl_startpos, :update_hl_endpos, :hl_queue, :syntax_parser, :highlights, :qt_reset_highlight, :is_parsing_syntax, :line_ends, :bt, :line_action_handler, :module, :active_kbd_mode
|
18
|
+
attr_accessor :qt_update_highlight, :update_hl_startpos, :update_hl_endpos, :hl_queue, :syntax_parser, :highlights, :qt_reset_highlight, :is_parsing_syntax, :line_ends, :bt, :line_action_handler, :module, :active_kbd_mode, :title, :subtitle
|
19
19
|
|
20
20
|
@@num_buffers = 0
|
21
21
|
|
@@ -29,7 +29,6 @@ class Buffer < String
|
|
29
29
|
qt_create_buffer(@id)
|
30
30
|
puts "NEW BUFFER fn=#{fname} ID:#{@id}"
|
31
31
|
|
32
|
-
#
|
33
32
|
@module = nil
|
34
33
|
|
35
34
|
@crypt = nil
|
@@ -47,7 +46,21 @@ class Buffer < String
|
|
47
46
|
@hl_queue = []
|
48
47
|
@line_action_handler = nil
|
49
48
|
|
49
|
+
@dirname = nil
|
50
|
+
@title = "*buf-#{@id}*"
|
51
|
+
@subtitle = ""
|
52
|
+
|
53
|
+
if @fname
|
54
|
+
@title = File.basename(@fname)
|
55
|
+
@dirname = File.dirname(@fname)
|
56
|
+
userhome = File.expand_path("~")
|
57
|
+
@subtitle = @dirname.gsub(/^#{userhome}/, "~")
|
58
|
+
end
|
59
|
+
|
50
60
|
t1 = Time.now
|
61
|
+
qt_set_current_buffer(@id)
|
62
|
+
gui_set_window_title(@title, @subtitle)
|
63
|
+
|
51
64
|
set_content(str)
|
52
65
|
debug "init time:#{Time.now - t1}"
|
53
66
|
|
@@ -63,7 +76,7 @@ class Buffer < String
|
|
63
76
|
else
|
64
77
|
$kbd.set_mode_to_default
|
65
78
|
end
|
66
|
-
qt_set_current_buffer(@id)
|
79
|
+
# qt_set_current_buffer(@id)
|
67
80
|
end
|
68
81
|
|
69
82
|
def detect_file_language
|
@@ -73,6 +86,20 @@ class Buffer < String
|
|
73
86
|
@lang = "ruby" if @fname.match(/\.(rb)$/)
|
74
87
|
@lang = "hyperplaintext" if @fname.match(/\.(txt)$/)
|
75
88
|
@lang = "php" if @fname.match(/\.(php)$/)
|
89
|
+
|
90
|
+
lm = GtkSource::LanguageManager.new
|
91
|
+
|
92
|
+
lm.set_search_path(lm.search_path << ppath("lang/"))
|
93
|
+
lang = lm.guess_language(@fname)
|
94
|
+
# lang.get_metadata("line-comment-start")
|
95
|
+
# lang.get_metadata("block-comment-start")
|
96
|
+
# lang.get_metadata("block-comment-end")
|
97
|
+
@lang_nfo = lang
|
98
|
+
if !lang.nil? and !lang.id.nil?
|
99
|
+
puts "Guessed LANG: #{lang.id}"
|
100
|
+
@lang = lang.id
|
101
|
+
end
|
102
|
+
|
76
103
|
if @lang
|
77
104
|
gui_set_file_lang(@id, @lang)
|
78
105
|
end
|
@@ -134,21 +161,7 @@ class Buffer < String
|
|
134
161
|
end
|
135
162
|
|
136
163
|
def get_file_type()
|
137
|
-
|
138
|
-
if !@fname
|
139
|
-
@syntax_detect_failed = true
|
140
|
-
return ""
|
141
|
-
end
|
142
|
-
if @ftype == nil
|
143
|
-
@ftype = VER::Syntax::Detector.detect(@fname)
|
144
|
-
if @ftype == nil
|
145
|
-
@syntax_detect_failed = true
|
146
|
-
else
|
147
|
-
@syntax_detect_failed = false
|
148
|
-
end
|
149
|
-
end
|
150
|
-
debug "ftype=#{@ftype.inspect}"
|
151
|
-
return @ftype
|
164
|
+
return @lang
|
152
165
|
end
|
153
166
|
|
154
167
|
def revert()
|
@@ -488,16 +501,26 @@ class Buffer < String
|
|
488
501
|
end
|
489
502
|
|
490
503
|
def get_com_str()
|
491
|
-
return nil if @syntax_detect_failed
|
504
|
+
# return nil if @syntax_detect_failed
|
492
505
|
|
493
506
|
com_str = nil
|
494
|
-
if get_file_type() == "
|
495
|
-
|
496
|
-
elsif get_file_type() == "
|
497
|
-
|
498
|
-
else
|
499
|
-
|
507
|
+
# if get_file_type() == "c" or get_file_type() == "java"
|
508
|
+
# com_str = "//"
|
509
|
+
# elsif get_file_type() == "ruby"
|
510
|
+
# com_str = "#"
|
511
|
+
# else
|
512
|
+
# com_str = "//"
|
513
|
+
# end
|
514
|
+
|
515
|
+
if !@lang_nfo.nil?
|
516
|
+
com_str = @lang_nfo.get_metadata("line-comment-start")
|
500
517
|
end
|
518
|
+
|
519
|
+
# lang.get_metadata("block-comment-start")
|
520
|
+
# lang.get_metadata("block-comment-end")
|
521
|
+
|
522
|
+
com_str = "//" if com_str.nil?
|
523
|
+
|
501
524
|
return com_str
|
502
525
|
end
|
503
526
|
|
@@ -1262,6 +1285,7 @@ class Buffer < String
|
|
1262
1285
|
end
|
1263
1286
|
|
1264
1287
|
def jump_to_next_instance_of_char(char, direction = FORWARD)
|
1288
|
+
|
1265
1289
|
#return if at_end_of_line?
|
1266
1290
|
if direction == FORWARD
|
1267
1291
|
position_of_next_char = self.index(char, @pos + 1)
|
@@ -1618,12 +1642,7 @@ class Buffer < String
|
|
1618
1642
|
# TODO:?
|
1619
1643
|
end
|
1620
1644
|
|
1621
|
-
def
|
1622
|
-
if !@fname
|
1623
|
-
save_as()
|
1624
|
-
return
|
1625
|
-
end
|
1626
|
-
message("Saving file #{@fname}")
|
1645
|
+
def write_contents_to_file(fpath)
|
1627
1646
|
if @crypt != nil
|
1628
1647
|
mode = "wb+"
|
1629
1648
|
contents = "VMACRYPT001" + @crypt.encrypt(self.to_s)
|
@@ -1633,7 +1652,7 @@ class Buffer < String
|
|
1633
1652
|
end
|
1634
1653
|
|
1635
1654
|
Thread.new {
|
1636
|
-
File.open(
|
1655
|
+
File.open(fpath, mode) do |io|
|
1637
1656
|
#io.set_encoding(self.encoding)
|
1638
1657
|
|
1639
1658
|
begin
|
@@ -1653,6 +1672,15 @@ class Buffer < String
|
|
1653
1672
|
}
|
1654
1673
|
end
|
1655
1674
|
|
1675
|
+
def save()
|
1676
|
+
if !@fname
|
1677
|
+
save_as()
|
1678
|
+
return
|
1679
|
+
end
|
1680
|
+
message("Saving file #{@fname}")
|
1681
|
+
write_contents_to_file(@fname)
|
1682
|
+
end
|
1683
|
+
|
1656
1684
|
# Indents whole buffer using external program
|
1657
1685
|
def indent()
|
1658
1686
|
file = Tempfile.new("out")
|
@@ -1665,7 +1693,7 @@ class Buffer < String
|
|
1665
1693
|
|
1666
1694
|
message("Auto format #{@fname}")
|
1667
1695
|
|
1668
|
-
if
|
1696
|
+
if ["chdr", "c", "cpp"].include?(get_file_type())
|
1669
1697
|
|
1670
1698
|
#C/C++/Java/JavaScript/Objective-C/Protobuf code
|
1671
1699
|
system("clang-format -style='{BasedOnStyle: LLVM, ColumnLimit: 100, SortIncludes: false}' #{file.path} > #{infile.path}")
|
@@ -1675,7 +1703,7 @@ class Buffer < String
|
|
1675
1703
|
debug cmd
|
1676
1704
|
system(cmd)
|
1677
1705
|
bufc = IO.read(infile.path)
|
1678
|
-
elsif get_file_type() == "
|
1706
|
+
elsif get_file_type() == "ruby"
|
1679
1707
|
cmd = "rufo #{file.path}"
|
1680
1708
|
debug cmd
|
1681
1709
|
system(cmd)
|
@@ -1700,13 +1728,14 @@ class Buffer < String
|
|
1700
1728
|
savepath = "#{spath}/#{spfx}_#{datetime}"
|
1701
1729
|
if is_path_writable(savepath)
|
1702
1730
|
debug "BACKUP BUFFER TO: #{savepath}"
|
1703
|
-
|
1731
|
+
write_contents_to_file(savepath)
|
1704
1732
|
else
|
1705
1733
|
message("PATH NOT WRITABLE: #{savepath}")
|
1706
1734
|
end
|
1707
1735
|
end
|
1708
1736
|
end
|
1709
1737
|
|
1738
|
+
#TODO
|
1710
1739
|
def write_to_file(savepath, s)
|
1711
1740
|
if is_path_writable(savepath)
|
1712
1741
|
IO.write(savepath, $buffer.to_s)
|
data/lib/vimamsa/buffer_list.rb
CHANGED
@@ -83,8 +83,8 @@ class BufferList < Array
|
|
83
83
|
$hook.call(:change_buffer, $buffer)
|
84
84
|
$buffer.set_active
|
85
85
|
|
86
|
-
set_window_title("Vimamsa - #{fpath}")
|
87
86
|
qt_set_current_buffer($buffer.id)
|
87
|
+
gui_set_window_title($buffer.title,$buffer.subtitle)
|
88
88
|
|
89
89
|
# hpt_scan_images() if $debug # experimental
|
90
90
|
end
|
@@ -289,6 +289,9 @@ default_keys = {
|
|
289
289
|
# 'C '=> 'buf.jump_word(BACKWARD,END)',#TODO
|
290
290
|
"VC f <char>" => "buf.jump_to_next_instance_of_char(<char>)",
|
291
291
|
"VC F <char>" => "buf.jump_to_next_instance_of_char(<char>,BACKWARD)",
|
292
|
+
"VC f space" => "buf.jump_to_next_instance_of_char(' ')",
|
293
|
+
"VC F space" => "buf.jump_to_next_instance_of_char(' ',BACKWARD)",
|
294
|
+
|
292
295
|
"VC /[1-9]/" => "set_next_command_count(<char>)",
|
293
296
|
# 'VC number=/[0-9]/+ g'=> 'jump_to_line(<number>)',
|
294
297
|
# 'VC X=/[0-9]/+ * Y=/[0-9]/+ '=> 'x_times_y(<X>,<Y>)',
|
@@ -435,7 +438,7 @@ default_keys = {
|
|
435
438
|
"I alt-f" => "buf.jump_word(FORWARD,WORD_START)",
|
436
439
|
"I alt-b" => "buf.jump_word(BACKWARD,WORD_START)",
|
437
440
|
|
438
|
-
"I tab" => 'buf.insert_txt("
|
441
|
+
"I tab" => 'buf.insert_txt(" ")',
|
439
442
|
"I space" => 'buf.insert_txt(" ")',
|
440
443
|
# "I return" => 'buf.insert_new_line()',
|
441
444
|
}
|
data/lib/vimamsa/editor.rb
CHANGED
@@ -39,6 +39,24 @@ class Editor
|
|
39
39
|
@_plugins = {}
|
40
40
|
end
|
41
41
|
|
42
|
+
def open_file_listener(added)
|
43
|
+
if !added.empty?
|
44
|
+
for fp in added
|
45
|
+
sleep 0.1
|
46
|
+
x = IO.read(fp)
|
47
|
+
File.delete(fp)
|
48
|
+
for f in x.lines
|
49
|
+
f.gsub!("\n", "")
|
50
|
+
if File.exist?(f)
|
51
|
+
if file_is_text_file(f)
|
52
|
+
jump_to_file(f)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
42
60
|
def start
|
43
61
|
# $highlight = {}
|
44
62
|
|
@@ -76,6 +94,13 @@ class Editor
|
|
76
94
|
|
77
95
|
dot_dir = File.expand_path("~/.vimamsa")
|
78
96
|
Dir.mkdir(dot_dir) unless File.exist?(dot_dir)
|
97
|
+
listen_dir = File.expand_path("~/.vimamsa/listen")
|
98
|
+
Dir.mkdir(listen_dir) unless File.exist?(dot_dir)
|
99
|
+
listener = Listen.to(listen_dir) do |modified, added, removed|
|
100
|
+
puts(modified: modified, added: added, removed: removed)
|
101
|
+
open_file_listener(added)
|
102
|
+
end
|
103
|
+
listener.start
|
79
104
|
|
80
105
|
$cnf[:theme] = "Twilight_edit"
|
81
106
|
$cnf[:syntax_highlight] = true
|
@@ -231,9 +256,7 @@ class Editor
|
|
231
256
|
end
|
232
257
|
|
233
258
|
def _quit()
|
234
|
-
# Shut down the Qt thread before the ruby thread
|
235
259
|
vma.shutdown
|
236
|
-
qt_quit
|
237
260
|
exit
|
238
261
|
end
|
239
262
|
|
@@ -432,7 +455,7 @@ GUESS_ENCODING_ORDER = [
|
|
432
455
|
def create_new_file(filename = nil, file_contents = "\n")
|
433
456
|
debug "NEW FILE CREATED"
|
434
457
|
buffer = Buffer.new(file_contents)
|
435
|
-
qt_set_current_buffer(buffer.id) #TODO: remove?
|
458
|
+
# qt_set_current_buffer(buffer.id) #TODO: remove?
|
436
459
|
$buffers << buffer
|
437
460
|
return buffer
|
438
461
|
end
|
@@ -493,7 +516,6 @@ def open_new_file(filename, file_contents = "")
|
|
493
516
|
fname = filename
|
494
517
|
load_buffer(fname)
|
495
518
|
end
|
496
|
-
set_window_title("Vimamsa - #{File.basename(filename)}")
|
497
519
|
end
|
498
520
|
|
499
521
|
def scan_word_start_marks(search_str)
|
data/lib/vimamsa/rbvma.rb
CHANGED
@@ -7,6 +7,7 @@ require "pathname"
|
|
7
7
|
require "date"
|
8
8
|
require "ripl/multi_line"
|
9
9
|
require "json"
|
10
|
+
require "listen"
|
10
11
|
|
11
12
|
puts "INIT rbvma"
|
12
13
|
|
@@ -326,9 +327,9 @@ end
|
|
326
327
|
def qt_select_window_close(arg = nil)
|
327
328
|
end
|
328
329
|
|
329
|
-
def set_window_title(str)
|
330
|
-
unimplemented
|
331
|
-
end
|
330
|
+
# def set_window_title(str)
|
331
|
+
# unimplemented
|
332
|
+
# end
|
332
333
|
|
333
334
|
def render_text(tmpbuf, pos, selection_start, reset)
|
334
335
|
unimplemented
|
@@ -371,12 +372,16 @@ def qt_set_current_buffer(id)
|
|
371
372
|
# itr = view.buffer.get_iter_at(:offset => 0)
|
372
373
|
# view.buffer.place_cursor(itr)
|
373
374
|
|
374
|
-
wtitle = ""
|
375
|
-
wtitle = buf.fname if !buf.fname.nil?
|
376
|
-
$vmag.window.title = wtitle
|
375
|
+
# wtitle = ""
|
376
|
+
# wtitle = buf.fname if !buf.fname.nil?
|
377
377
|
$vmag.sw.show_all
|
378
378
|
end
|
379
379
|
|
380
|
+
def gui_set_window_title(wtitle,subtitle="")
|
381
|
+
$vmag.window.title = wtitle
|
382
|
+
$vmag.window.titlebar.subtitle = subtitle
|
383
|
+
end
|
384
|
+
|
380
385
|
def unimplemented
|
381
386
|
puts "unimplemented"
|
382
387
|
end
|
@@ -469,6 +474,18 @@ class VSourceView < GtkSource::View
|
|
469
474
|
@last_keyval = nil
|
470
475
|
@last_event = [nil, nil]
|
471
476
|
|
477
|
+
signal_connect "button-press-event" do |_widget, event|
|
478
|
+
if event.button == Gdk::BUTTON_PRIMARY
|
479
|
+
# puts "Gdk::BUTTON_PRIMARY"
|
480
|
+
false
|
481
|
+
elsif event.button == Gdk::BUTTON_SECONDARY
|
482
|
+
# puts "Gdk::BUTTON_SECONDARY"
|
483
|
+
true
|
484
|
+
else
|
485
|
+
true
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
472
489
|
signal_connect("key_press_event") do |widget, event|
|
473
490
|
handle_key_event(event, :key_press_event)
|
474
491
|
true
|
@@ -943,14 +960,15 @@ class VMAg
|
|
943
960
|
end
|
944
961
|
|
945
962
|
def init_header_bar()
|
946
|
-
# @window = Gtk::Window.new(:toplevel)
|
947
|
-
# @window.screen = main_window.screen
|
948
|
-
# @window.set_default_size(600, 400)
|
949
963
|
|
950
964
|
header = Gtk::HeaderBar.new
|
965
|
+
@header = header
|
951
966
|
header.show_close_button = true
|
952
|
-
header.title = "
|
953
|
-
header.has_subtitle =
|
967
|
+
header.title = ""
|
968
|
+
header.has_subtitle = true
|
969
|
+
header.subtitle = ""
|
970
|
+
# Ripl.start :binding => binding
|
971
|
+
|
954
972
|
|
955
973
|
# icon = Gio::ThemedIcon.new("mail-send-receive-symbolic")
|
956
974
|
# icon = Gio::ThemedIcon.new("document-open-symbolic")
|
@@ -958,17 +976,43 @@ class VMAg
|
|
958
976
|
|
959
977
|
#edit-redo edit-paste edit-find-replace edit-undo edit-find edit-cut edit-copy
|
960
978
|
#document-open document-save document-save-as document-properties document-new
|
979
|
+
# document-revert-symbolic
|
980
|
+
#
|
981
|
+
|
982
|
+
#TODO:
|
983
|
+
# button = Gtk::Button.new
|
984
|
+
# icon = Gio::ThemedIcon.new("open-menu-symbolic")
|
985
|
+
# image = Gtk::Image.new(:icon => icon, :size => :button)
|
986
|
+
# button.add(image)
|
987
|
+
# header.pack_end(button)
|
988
|
+
|
961
989
|
button = Gtk::Button.new
|
962
|
-
icon = Gio::ThemedIcon.new("open-
|
990
|
+
icon = Gio::ThemedIcon.new("document-open-symbolic")
|
963
991
|
image = Gtk::Image.new(:icon => icon, :size => :button)
|
964
992
|
button.add(image)
|
965
993
|
header.pack_end(button)
|
966
994
|
|
995
|
+
button.signal_connect "clicked" do |_widget|
|
996
|
+
open_file_dialog
|
997
|
+
end
|
998
|
+
|
999
|
+
button = Gtk::Button.new
|
1000
|
+
icon = Gio::ThemedIcon.new("document-save-symbolic")
|
1001
|
+
image = Gtk::Image.new(:icon => icon, :size => :button)
|
1002
|
+
button.add(image)
|
1003
|
+
header.pack_end(button)
|
1004
|
+
button.signal_connect "clicked" do |_widget|
|
1005
|
+
buf.save
|
1006
|
+
end
|
1007
|
+
|
967
1008
|
button = Gtk::Button.new
|
968
|
-
icon = Gio::ThemedIcon.new("document-
|
1009
|
+
icon = Gio::ThemedIcon.new("document-new-symbolic")
|
969
1010
|
image = Gtk::Image.new(:icon => icon, :size => :button)
|
970
1011
|
button.add(image)
|
971
1012
|
header.pack_end(button)
|
1013
|
+
button.signal_connect "clicked" do |_widget|
|
1014
|
+
create_new_file
|
1015
|
+
end
|
972
1016
|
|
973
1017
|
box = Gtk::Box.new(:horizontal, 0)
|
974
1018
|
box.style_context.add_class("linked")
|
@@ -977,11 +1021,26 @@ class VMAg
|
|
977
1021
|
image = Gtk::Image.new(:icon_name => "pan-start-symbolic", :size => :button)
|
978
1022
|
button.add(image)
|
979
1023
|
box.add(button)
|
1024
|
+
button.signal_connect "clicked" do |_widget|
|
1025
|
+
history_switch_backwards
|
1026
|
+
end
|
980
1027
|
|
981
1028
|
button = Gtk::Button.new
|
982
1029
|
image = Gtk::Image.new(:icon_name => "pan-end-symbolic", :size => :button)
|
983
1030
|
button.add(image)
|
984
1031
|
box.add(button)
|
1032
|
+
button.signal_connect "clicked" do |_widget|
|
1033
|
+
history_switch_forwards
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
button = Gtk::Button.new
|
1037
|
+
icon = Gio::ThemedIcon.new("window-close-symbolic")
|
1038
|
+
image = Gtk::Image.new(:icon => icon, :size => :button)
|
1039
|
+
button.add(image)
|
1040
|
+
box.add(button)
|
1041
|
+
button.signal_connect "clicked" do |_widget|
|
1042
|
+
bufs.close_current_buffer
|
1043
|
+
end
|
985
1044
|
|
986
1045
|
header.pack_start(box)
|
987
1046
|
@window.titlebar = header
|
data/lib/vimamsa/util.rb
CHANGED
data/lib/vimamsa/version.rb
CHANGED
data/vimamsa.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_runtime_dependency 'gtksourceview3', '~> 3.4'
|
34
34
|
# spec.add_runtime_dependency 'gtksourceview4'
|
35
35
|
spec.add_runtime_dependency 'parallel', '~> 1.14'
|
36
|
+
spec.add_runtime_dependency 'listen', '~> 3.4'
|
36
37
|
|
37
38
|
spec.extensions = ["ext/vmaext/extconf.rb"]
|
38
39
|
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.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sami Sieranoja
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.14'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: listen
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3.4'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3.4'
|
153
167
|
description: Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby
|
154
168
|
and GTK.
|
155
169
|
email:
|