vimamsa 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,101 @@
1
+
2
+ # From https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
3
+ # Cross-platform way of finding an executable in the $PATH.
4
+ #
5
+ # which('ruby') #=> /usr/bin/ruby
6
+ def which(cmd)
7
+ exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
8
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
9
+ exts.each do |ext|
10
+ exe = File.join(path, "#{cmd}#{ext}")
11
+ return exe if File.executable?(exe) && !File.directory?(exe)
12
+ end
13
+ end
14
+ nil
15
+ end
16
+
17
+ def assert_binary_exists(bin)
18
+ if which(bin).nil?
19
+ raise "Binary #{bin} doesn't exist"
20
+ end
21
+ end
22
+
23
+ def read_file(text, path)
24
+ path = Pathname(path.to_s).expand_path
25
+ FileUtils.touch(path) unless File.exist?(path)
26
+ if !File.exist?(path)
27
+ #TODO: fail gracefully
28
+ return
29
+ end
30
+
31
+ encoding = text.encoding
32
+ content = path.open("r:#{encoding.name}") { |io| io.read }
33
+
34
+ debug("GUESS ENCODING")
35
+ unless content.valid_encoding? # take a guess
36
+ GUESS_ENCODING_ORDER.find { |enc|
37
+ content.force_encoding(enc)
38
+ content.valid_encoding?
39
+ }
40
+ content.encode!(Encoding::UTF_8)
41
+ end
42
+ debug("END GUESS ENCODING")
43
+
44
+ #TODO: Should put these as option:
45
+ content.gsub!(/\r\n/, "\n")
46
+ content.gsub!(/\t/, " ")
47
+ content.gsub!(/\b/, "")
48
+
49
+ # content = filter_buffer(content)
50
+ debug("END FILTER")
51
+ return content
52
+ end
53
+
54
+ def is_url(s)
55
+ return s.match(/(https?|file):\/\/.*/) != nil
56
+ end
57
+
58
+ def expand_if_existing(fpath)
59
+ return nil if fpath.class != String
60
+ fpath = File.expand_path(fpath)
61
+ fpath = nil if !File.exist?(fpath)
62
+ return fpath
63
+ end
64
+
65
+ def ppath(s)
66
+ selfpath = __FILE__
67
+ selfpath = File.readlink(selfpath) if File.lstat(selfpath).symlink?
68
+ scriptdir = File.expand_path(File.dirname(selfpath))
69
+ p = "#{scriptdir}/../../#{s}"
70
+ return File.expand_path(p)
71
+ end
72
+
73
+ def is_existing_file(s)
74
+ return false if !s
75
+ if is_path(s) and File.exist?(File.expand_path(s))
76
+ return true
77
+ end
78
+ return false
79
+ end
80
+
81
+ def is_image_file(fpath)
82
+ return false if !File.exist?(fpath)
83
+ return false if !fpath.match(/.(jpg|jpeg|png)$/i)
84
+ #TODO: check contents of file
85
+ return true
86
+ end
87
+
88
+ def is_text_file(fpath)
89
+ return false if !File.exist?(fpath)
90
+ return false if !fpath.match(/.(txt|cpp|h|rb|c|php|java|py)$/i)
91
+ #TODO: check contents of file
92
+ return true
93
+ end
94
+
95
+ def is_path(s)
96
+ m = s.match(/(~[a-z]*)?\/.*\//)
97
+ if m != nil
98
+ return true
99
+ end
100
+ return false
101
+ end
@@ -1,3 +1,3 @@
1
1
  module Vimamsa
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" ?>
2
+ <style-scheme id="molokai" name="Molokai" version="1.0">
3
+ <author/>
4
+ <_description>
5
+ Port of the Molokai Text Mate Theme to GTKSourceView.
6
+ </_description>
7
+ <style foreground="#AE81FF" name="def:boolean"/>
8
+ <style foreground="#AE81FF" name="def:number"/>
9
+ <style foreground="#E6DB74" name="def:string"/>
10
+ <style bold="true" foreground="#AE81FF" name="def:constant"/>
11
+ <style background="#F8F8F0" foreground="#000000" name="cursor"/>
12
+ <style background="#13354A" name="diff:added-line"/>
13
+ <style background="#4C4745" foreground="#89807D" name="diff:changed-line"/>
14
+ <style background="#1E0010" foreground="#960050" name="diff:removed-line"/>
15
+ <style background="#1E0010" foreground="#960050" name="def:error"/>
16
+ <style foreground="#A6E22E" name="def:function"/>
17
+ <style foreground="#FD971F" name="def:identifier"/>
18
+ <style bold="true" foreground="#F92672" name="def:keyword"/>
19
+ <style background="#FD971F" bold="true" foreground="#000000" name="bracket-match"/>
20
+ <style foreground="#A6E22E" name="def:preprocessor"/>
21
+ <style background="#455354" foreground="#FFFFFF" name="search-match"/>
22
+ <style background="#bg" foreground="#66D9EF" italic="true" name="def:specials"/>
23
+ <style bold="true" foreground="#F92672" name="def:statement"/>
24
+ <style foreground="#66D9EF" name="def:type"/>
25
+ <style background="#272822" foreground="#F8F8F2" name="text"/>
26
+ <style foreground="#75715E" name="def:comment"/>
27
+ <style background="#3E3D32" name="current-line"/>
28
+ <style background="#272822" foreground="#F8F8F2" name="text"/>
29
+ <style foreground="#465457" name="def:comment"/>
30
+ <style background="#3e3d32" name="current-line"/>
31
+ <style background="#3b3a32" foreground="#bcbca7" name="line-numbers"/>
32
+ </style-scheme>
33
+
data/styles/dark.xml ADDED
@@ -0,0 +1,152 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+
4
+ This file is part of GtkSourceView
5
+
6
+ Copyright (C) 2007 GtkSourceView team
7
+ Author: Paolo Borelli <pborelli@gnome.org>
8
+
9
+ GtkSourceView is free software; you can redistribute it and/or
10
+ modify it under the terms of the GNU Lesser General Public
11
+ License as published by the Free Software Foundation; either
12
+ version 2.1 of the License, or (at your option) any later version.
13
+
14
+ GtkSourceView is distributed in the hope that it will be useful,
15
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ Lesser General Public License for more details.
18
+
19
+ You should have received a copy of the GNU Lesser General Public License
20
+ along with this library; if not, see <http://www.gnu.org/licenses/>.
21
+
22
+ -->
23
+
24
+ <style-scheme id="dark" _name="dark" version="1.0">
25
+
26
+ <author>Paolo Borelli</author>
27
+ <_description>Dark color scheme using the Tango color palette</_description>
28
+
29
+ <!-- Tango Palette -->
30
+ <color name="butter1" value="#fce94f"/>
31
+ <color name="butter2" value="#edd400"/>
32
+ <color name="butter3" value="#c4a000"/>
33
+ <color name="chameleon1" value="#8ae234"/>
34
+ <color name="chameleon2" value="#73d216"/>
35
+ <color name="chameleon3" value="#4e9a06"/>
36
+ <color name="orange1" value="#fcaf3e"/>
37
+ <color name="orange2" value="#f57900"/>
38
+ <color name="orange3" value="#ce5c00"/>
39
+ <color name="lightblue" value="#00FFF8"/>
40
+ <color name="skyblue1" value="#729fcf"/>
41
+ <color name="skyblue2" value="#3465a4"/>
42
+ <color name="skyblue3" value="#204a87"/>
43
+ <color name="plum1" value="#ad7fa8"/>
44
+ <color name="plum2" value="#75507b"/>
45
+ <color name="plum3" value="#5c3566"/>
46
+ <color name="chocolate1" value="#e9b96e"/>
47
+ <color name="chocolate2" value="#c17d11"/>
48
+ <color name="chocolate3" value="#8f5902"/>
49
+ <color name="scarletred1" value="#ef2929"/>
50
+ <color name="scarletred2" value="#cc0000"/>
51
+ <color name="scarletred3" value="#a40000"/>
52
+ <color name="aluminium1" value="#eeeeec"/>
53
+ <color name="aluminium2" value="#d3d7cf"/>
54
+ <color name="aluminium3" value="#babdb6"/>
55
+ <color name="aluminium4" value="#888a85"/>
56
+ <color name="aluminium5" value="#555753"/>
57
+ <color name="aluminium6OLD" value="#2e3436"/>
58
+ <color name="aluminium6" value="#1e1416"/>
59
+ <color name="white" value="#ffffff"/>
60
+ <color name="black" value="#000000"/>
61
+ <color name="heading" value="#CF6A4C"/>
62
+ <color name="aluminium4-3-blend" value="#a1a49e"/>
63
+ <color name="aluminium6-5-blend" value="#34393A"/>
64
+
65
+ <!-- Global Settings -->
66
+ <style name="text" foreground="aluminium2" background="aluminium6"/>
67
+ <style name="selection" foreground="aluminium1" background="aluminium4"/>
68
+ <style name="cursor" foreground="aluminium2"/>
69
+ <style name="secondary-cursor" foreground="aluminium4-3-blend"/>
70
+ <style name="current-line" background="aluminium5"/>
71
+ <style name="line-numbers" foreground="aluminium5" background="black"/>
72
+ <style name="draw-spaces" foreground="aluminium4"/>
73
+ <style name="background-pattern" background="aluminium6-5-blend"/>
74
+
75
+ <!-- Bracket Matching -->
76
+ <style name="bracket-match" foreground="chocolate2"/>
77
+ <style name="bracket-mismatch" foreground="aluminium1" background="scarletred2"/>
78
+
79
+ <!-- Right Margin -->
80
+ <style name="right-margin" foreground="aluminium1" background="aluminium3"/>
81
+
82
+ <!-- Search Matching -->
83
+ <style name="search-match" foreground="aluminium1" background="chameleon3"/>
84
+
85
+ <!-- Comments -->
86
+ <style name="def:comment" foreground="aluminium4"/>
87
+ <style name="def:shebang" foreground="aluminium4" bold="true"/>
88
+ <style name="def:doc-comment-element" italic="true"/>
89
+
90
+ <!-- Constants -->
91
+ <style name="def:constant" foreground="butter2"/>
92
+ <style name="def:string" foreground="butter2"/>
93
+ <style name="def:special-char" foreground="orange3"/>
94
+ <style name="def:special-constant" foreground="orange3"/>
95
+ <style name="def:floating-point" foreground="orange3"/>
96
+
97
+ <!-- Identifiers -->
98
+ <style name="def:identifier" foreground="skyblue1"/>
99
+
100
+ <!-- Statements -->
101
+ <style name="def:statement" foreground="white" bold="true"/>
102
+
103
+ <!-- Types -->
104
+ <style name="def:type" foreground="chameleon1" bold="true"/>
105
+
106
+ <!-- Markup -->
107
+ <style name="def:emphasis" italic="true"/>
108
+ <style name="def:strong-emphasis" foreground="white" bold="true"/>
109
+ <style name="def:inline-code" foreground="skyblue1"/>
110
+ <style name="def:insertion" underline="single"/>
111
+ <style name="def:deletion" strikethrough="true"/>
112
+ <style name="def:link-text" foreground="aluminium4"/>
113
+ <style name="def:link-symbol" foreground="aluminium4" bold="true"/>
114
+ <style name="def:link-destination" italic="true" underline="single"/>
115
+ <style name="def:heading" foreground="chameleon1" bold="true"/>
116
+ <style name="def:thematic-break" foreground="chameleon1" bold="true"/>
117
+ <style name="def:preformatted-section" foreground="skyblue1"/>
118
+ <style name="def:list-marker" foreground="white" bold="true"/>
119
+
120
+ <!-- Others -->
121
+ <style name="def:preprocessor" foreground="plum1"/>
122
+ <style name="def:error" foreground="aluminium1" background="scarletred2" bold="true"/>
123
+ <style name="def:warning" foreground="aluminium1" background="plum1"/>
124
+ <style name="def:note" background="butter1" foreground="aluminium4" bold="true"/>
125
+ <style name="def:net-address" italic="true" underline="single"/>
126
+
127
+ <!-- Heading styles, uncomment to enable -->
128
+
129
+ <style name="def:title" scale="2.0" bold="true" />
130
+ <style name="def:hyperlink" foreground="lightblue" bold="true" />
131
+ <style name="def:heading0" scale="5.0" bold="true" foreground="heading" />
132
+ <style name="def:heading1" scale="1.75" bold="true" foreground="heading" />
133
+ <style name="def:heading2" scale="1.5" bold="true" foreground="heading" />
134
+ <style name="def:heading3" scale="1.25" bold="true" foreground="heading" />
135
+ <style name="def:heading4" scale="1.175" bold="true" foreground="heading" />
136
+ <style name="def:heading5" scale="1.1" bold="true" foreground="heading" />
137
+ <style name="def:heading6" scale="1.0" bold="true" foreground="heading" />
138
+
139
+
140
+ <!-- Language specific -->
141
+ <style name="diff:added-line" foreground="butter2"/>
142
+ <style name="diff:removed-line" foreground="skyblue1"/>
143
+ <style name="diff:changed-line" foreground="plum1"/>
144
+ <style name="diff:diff-file" foreground="chameleon1" bold="true"/>
145
+ <style name="diff:location" foreground="chameleon1"/>
146
+ <style name="diff:special-case" foreground="white" bold="true"/>
147
+
148
+ <style name="latex:command" foreground="chameleon1" bold="true"/>
149
+ <style name="latex:include" use-style="def:preprocessor"/>
150
+
151
+ </style-scheme>
152
+
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" ?>
2
+ <style-scheme id="molokai_edit" name="Molokai_edit" version="1.0">
3
+ <color name="lightblue" value="#00FFF8"/>
4
+
5
+ <author/>
6
+ <_description>
7
+ Port of the Molokai Text Mate Theme to GTKSourceView.
8
+ </_description>
9
+
10
+ <color name="heading" value="#CF6A4C"/>
11
+ <style foreground="#AE81FF" name="def:boolean"/>
12
+ <style foreground="#AE81FF" name="def:number"/>
13
+ <style foreground="#E6DB74" name="def:string"/>
14
+ <style bold="true" foreground="#AE81FF" name="def:constant"/>
15
+ <style background="#F8F8F0" foreground="#ffffff" name="cursor"/>
16
+ <style background="#13354A" name="diff:added-line"/>
17
+ <style background="#4C4745" foreground="#89807D" name="diff:changed-line"/>
18
+ <style background="#1E0010" foreground="#960050" name="diff:removed-line"/>
19
+ <style background="#1E0010" foreground="#960050" name="def:error"/>
20
+ <style foreground="#A6E22E" name="def:function"/>
21
+ <style foreground="#FD971F" name="def:identifier"/>
22
+ <style bold="true" foreground="#F92672" name="def:keyword"/>
23
+ <style background="#FD971F" bold="true" foreground="#000000" name="bracket-match"/>
24
+ <style foreground="#A6E22E" name="def:preprocessor"/>
25
+ <style background="#455354" foreground="#FFFFFF" name="search-match"/>
26
+ <style background="#bg" foreground="#66D9EF" italic="true" name="def:specials"/>
27
+ <style bold="true" foreground="#F92672" name="def:statement"/>
28
+ <style foreground="#66D9EF" name="def:type"/>
29
+ <!--style background="#272822" foreground="#F8F8F2" name="text"/-->
30
+ <style background="#000000" foreground="#F8F8F2" name="text"/>
31
+ <style foreground="#75715E" name="def:comment"/>
32
+ <style background="#3E3D32" name="current-line"/>
33
+ <style background="#222222" foreground="#F8F8F2" name="text"/>
34
+ <!--style foreground="#465457" name="def:comment"/-->
35
+ <style background="#3e3d32" name="current-line"/>
36
+ <style background="#2a2a2a" foreground="#bcbca7" name="line-numbers"/>
37
+
38
+ <style name="def:title" scale="2.0" bold="true" />
39
+ <style name="def:hyperlink" foreground="lightblue" bold="true" />
40
+ <style name="def:heading0" scale="5.0" bold="true" foreground="heading" />
41
+ <style name="def:heading1" scale="1.75" bold="true" foreground="heading" />
42
+ <style name="def:heading2" scale="1.5" bold="true" foreground="heading" />
43
+ <style name="def:heading3" scale="1.25" bold="true" foreground="heading" />
44
+ <style name="def:heading4" scale="1.175" bold="true" foreground="heading" />
45
+ <style name="def:heading5" scale="1.1" bold="true" foreground="heading" />
46
+ <style name="def:heading6" scale="1.0" bold="true" foreground="heading" />
47
+
48
+ </style-scheme>
49
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimamsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sami Sieranoja
@@ -139,7 +139,8 @@ dependencies:
139
139
  description: Vimamsa.
140
140
  email:
141
141
  - sami.sieranoja@gmail.com
142
- executables: []
142
+ executables:
143
+ - vimamsa
143
144
  extensions:
144
145
  - ext/vmaext/extconf.rb
145
146
  extra_rdoc_files: []
@@ -150,12 +151,40 @@ files:
150
151
  - Rakefile
151
152
  - bin/console
152
153
  - bin/setup
154
+ - exe/vimamsa
153
155
  - ext/vimamsa/extconf.rb
154
156
  - ext/vimamsa/vimamsa.c
155
157
  - ext/vmaext/extconf.rb
156
158
  - ext/vmaext/vmaext.c
159
+ - lang/hyperplaintext.lang
157
160
  - lib/vimamsa.rb
161
+ - lib/vimamsa/ack.rb
162
+ - lib/vimamsa/actions.rb
163
+ - lib/vimamsa/buffer.rb
164
+ - lib/vimamsa/buffer_list.rb
165
+ - lib/vimamsa/constants.rb
166
+ - lib/vimamsa/debug.rb
167
+ - lib/vimamsa/default_key_bindings.rb
168
+ - lib/vimamsa/easy_jump.rb
169
+ - lib/vimamsa/editor.rb
170
+ - lib/vimamsa/encrypt.rb
171
+ - lib/vimamsa/file_finder.rb
172
+ - lib/vimamsa/file_history.rb
173
+ - lib/vimamsa/file_manager.rb
174
+ - lib/vimamsa/hook.rb
175
+ - lib/vimamsa/hyper_plain_text.rb
176
+ - lib/vimamsa/key_binding_tree.rb
177
+ - lib/vimamsa/macro.rb
178
+ - lib/vimamsa/main.rb
179
+ - lib/vimamsa/rbvma.rb
180
+ - lib/vimamsa/search.rb
181
+ - lib/vimamsa/search_replace.rb
182
+ - lib/vimamsa/text_transforms.rb
183
+ - lib/vimamsa/util.rb
158
184
  - lib/vimamsa/version.rb
185
+ - styles/134272-molokai.xml
186
+ - styles/dark.xml
187
+ - styles/molokai_edit.xml
159
188
  - vimamsa.gemspec
160
189
  homepage: https://github.com/SamiSieranoja/vimamsa
161
190
  licenses: