VimMate 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +53 -0
- data/COPYING +20 -0
- data/README +198 -0
- data/Rakefile +72 -0
- data/TODO +9 -0
- data/bin/vimmate +179 -0
- data/lib/vimmatelib/config.rb +124 -0
- data/lib/vimmatelib/dummy_window.rb +39 -0
- data/lib/vimmatelib/file.png +0 -0
- data/lib/vimmatelib/file_green.png +0 -0
- data/lib/vimmatelib/file_orange.png +0 -0
- data/lib/vimmatelib/file_red.png +0 -0
- data/lib/vimmatelib/files.rb +230 -0
- data/lib/vimmatelib/files_menu.rb +325 -0
- data/lib/vimmatelib/files_window.rb +395 -0
- data/lib/vimmatelib/folder.png +0 -0
- data/lib/vimmatelib/folder_green.png +0 -0
- data/lib/vimmatelib/folder_orange.png +0 -0
- data/lib/vimmatelib/folder_red.png +0 -0
- data/lib/vimmatelib/icons.rb +104 -0
- data/lib/vimmatelib/main_window.rb +59 -0
- data/lib/vimmatelib/nice_singleton.rb +53 -0
- data/lib/vimmatelib/requirer.rb +68 -0
- data/lib/vimmatelib/search_window.rb +220 -0
- data/lib/vimmatelib/subversion.rb +157 -0
- data/lib/vimmatelib/terminals_window.rb +115 -0
- data/lib/vimmatelib/version.rb +29 -0
- data/lib/vimmatelib/vim_window.rb +84 -0
- data/lib/vimmatelib/vimmate16.png +0 -0
- data/lib/vimmatelib/vimmate32.png +0 -0
- data/lib/vimmatelib/vimmate48.png +0 -0
- data/setup.rb +1586 -0
- metadata +77 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
= Changelog
|
2
|
+
|
3
|
+
=== Version 0.6.2
|
4
|
+
- # 7028: It's now possible to install VimMate using the provided setup.rb
|
5
|
+
or with Ruby Gems.
|
6
|
+
- Two layouts are now available. The old layout, with big terminals:
|
7
|
+
-------------
|
8
|
+
| F | |
|
9
|
+
| i | |
|
10
|
+
| l | Vim |
|
11
|
+
| e | |
|
12
|
+
| s | |
|
13
|
+
-------------
|
14
|
+
| Terminals |
|
15
|
+
-------------
|
16
|
+
And the new layout, with a big file list:
|
17
|
+
-------------
|
18
|
+
| | |
|
19
|
+
| F | |
|
20
|
+
| i | Vim |
|
21
|
+
| l | |
|
22
|
+
| e | |
|
23
|
+
| s ---------
|
24
|
+
| | Term |
|
25
|
+
-------------
|
26
|
+
The new layout is now the default. You can change this by setting the
|
27
|
+
:layout_big_terminals option to true.
|
28
|
+
- # 6761: A new way of opening files is now available. A new list of files
|
29
|
+
allows you to type only a part of a file name to see the possible files
|
30
|
+
filtered instantly. You can then select the file from the list or type
|
31
|
+
<tt>Enter</tt> directly if the file you are searching for is selected.
|
32
|
+
You can remove this new list by setting the option :files_use_search
|
33
|
+
to false. You can also specify if the search is case sensitive or not
|
34
|
+
with the option :files_search_ignore_case. The case is ignored by default.
|
35
|
+
- Long file names in the file list are now shorten with ellipsis. You can
|
36
|
+
disable ellipsis by setting the option :files_use_ellipsis to false.
|
37
|
+
- Files or directories can now be excluded on the command line. You can specify
|
38
|
+
a comma separated list of names that will be matched against the end of the
|
39
|
+
path of each files of directories. So <tt>vimmate -x html,pkg,README</tt>
|
40
|
+
will exclude any files with the names html, pkg or README. But,
|
41
|
+
<tt>vimmate -x bin/README</tt> will only exclude the file README in the bin
|
42
|
+
directory. Note that <tt>vimmate -x ME</tt> will only exclude files or
|
43
|
+
directories named ME and not files ending with ME like README.
|
44
|
+
|
45
|
+
=== Version 0.6.1
|
46
|
+
- # 6721: Added "Tab Open" in the menu. "Tab Open" is the default when opening
|
47
|
+
a file not from the menu. This can be changed by setting the option
|
48
|
+
:files_default_open_in_tabs to false.
|
49
|
+
- Better Subversion integration: Add a new menu Subversion with Add, Rename,
|
50
|
+
Delete and Revert as sub-menus.
|
51
|
+
|
52
|
+
=== Version 0.6.0
|
53
|
+
- First release
|
data/COPYING
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= VimMate: Vim graphical add-on
|
2
|
+
Copyright (c) 2006 Guillaume Benny
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
this software and associated documentation files (the "Software"), to deal in
|
6
|
+
the Software without restriction, including without limitation the rights to
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
8
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
9
|
+
so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
12
|
+
copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
+
SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
= Description
|
2
|
+
|
3
|
+
VimMate is a graphical add-on to Vim with IDE-like features: it does more
|
4
|
+
than the plain Vim while still being lightweight. Even with the additional
|
5
|
+
features, it stays out of the way for it's main task: editing files with Vim.
|
6
|
+
VimMate adds functionality to Vim by embedding Vim GTK GUI (gVim) within
|
7
|
+
VimMate.
|
8
|
+
|
9
|
+
Some of the ideas of VimMate comes from PIDA[http://pida.berlios.de/]
|
10
|
+
and others from TextMate[http://macromates.com/] (although I've never
|
11
|
+
used TextMate).
|
12
|
+
|
13
|
+
VimMate's homepage: http://vimmate.rubyforge.org
|
14
|
+
|
15
|
+
= Features
|
16
|
+
|
17
|
+
VimMate has the following features:
|
18
|
+
- Uses Vim[http://www.vim.org/] for the text editor so it has all of
|
19
|
+
Vim's qualities.
|
20
|
+
- Written in Ruby[http://www.ruby-lang.org/] so the code is nice and clean.
|
21
|
+
- Integrated, hideable and searchable file tree with filter for easy
|
22
|
+
project viewing.
|
23
|
+
- Multiple integrated terminals <i>(Optional)</i>.
|
24
|
+
- Basic Subversion[http://subversion.tigris.org/] integration: <i>(Optional)</i>
|
25
|
+
- The file status is displayed in the file tree.
|
26
|
+
- You can add, rename, delete and revert a file from the file tree.
|
27
|
+
|
28
|
+
= Installation
|
29
|
+
VimMate has only been tested under Linux (in fact,
|
30
|
+
{Gentoo Linux}[http://www.gentoo.org/]). It might work under other OSs,
|
31
|
+
although I do not know. I think only the file list will work under
|
32
|
+
Windows because Vim does not use GTK under Windows so it cannot be embedded.
|
33
|
+
I know nothing about MacOSX so I cannot say if it works or not.
|
34
|
+
|
35
|
+
To install:
|
36
|
+
- Make sure Vim[http://www.vim.org/] is installed and compiled with the
|
37
|
+
graphical interface. Try running +gvim+ to see if it works. Only Vim
|
38
|
+
version 7.0 has been tested.
|
39
|
+
- Make sure Ruby[http://www.ruby-lang.org/] version 1.8 or more is installed.
|
40
|
+
Try running <tt>ruby --version</tt> in a terminal.
|
41
|
+
- Install the Ruby bindings to GTK and GNOME (for the VTE terminal). See
|
42
|
+
{Ruby-GNOME2 website}[http://ruby-gnome2.sourceforge.jp/]. Only
|
43
|
+
Ruby-GNOME2 version 0.15 has been tested. You don't need VTE: if it's
|
44
|
+
not installed, VimMate will not have terminals but will run anyway.
|
45
|
+
- If you want to use the Subversion integration feature, you must install
|
46
|
+
the subversion bindings for Ruby. Check if it's available for your OS
|
47
|
+
or get the sources from
|
48
|
+
{Subversion's website}[http://subversion.tigris.org/] and compile them.
|
49
|
+
- Download the latest VimMate on
|
50
|
+
{VimMate's homepage}[http://vimmate.rubyforge.org/].
|
51
|
+
- You now have 3 choices to install VimMate: manually, with Ruby Gems or with
|
52
|
+
<tt>setup.rb</tt>:
|
53
|
+
- With Ruby Gems
|
54
|
+
- Simply run <tt>gem install VimMate</tt> .
|
55
|
+
- With <tt>setup.rb</tt>
|
56
|
+
- Simply run <tt>ruby setup.rb</tt> . Run <tt>ruby setup.rb --help</tt> for
|
57
|
+
more information.
|
58
|
+
- Manually
|
59
|
+
- Copy the file <tt>bin/vimmate</tt> and the directory
|
60
|
+
<tt>lib/vimmatelib</tt> to a directory somewhere in your path.
|
61
|
+
- Make sure +vimmate+ is executable: <tt>chmod u+x vimmate</tt>
|
62
|
+
- cd to a directory where your project is. (Watch out for directories
|
63
|
+
with too many files. See <i>Limitations</i> below.)
|
64
|
+
- Run +vimmate+
|
65
|
+
|
66
|
+
Run <tt>vimmate --help</tt> for more information.
|
67
|
+
|
68
|
+
= Configuration
|
69
|
+
Note that you don't have to do what's described in this section:
|
70
|
+
everything will work anyway. It's just filled with nice tricks.
|
71
|
+
|
72
|
+
VimMate doesn't need any special configuration to run. But, when VimMate is
|
73
|
+
first run, it creates a file named <tt>.vimmaterc</tt> in your HOME directory.
|
74
|
+
You can edit this file at your own risk. If anything goes wrong, you can
|
75
|
+
always delete this file and it will be recreated with the default
|
76
|
+
configuration.
|
77
|
+
|
78
|
+
Most variables are self explanatory. One variable deserves a special
|
79
|
+
explanation because it can be useful to change. It's the line that
|
80
|
+
starts with <tt>:terminals_autoexec:</tt>. This line specifies a string
|
81
|
+
that is automatically executed by every terminals that are created by
|
82
|
+
VimMate. I'm sure you can think about a way to use this, but the idea
|
83
|
+
of this configuration line is to initialize the terminal so that it can
|
84
|
+
execute Vim (the console <tt>vim</tt>) without weird warnings about
|
85
|
+
escape characters. Here is how to configure it so that it works without
|
86
|
+
warnings with the bash shell:
|
87
|
+
|
88
|
+
# Other configurations before...
|
89
|
+
# (Because of a small quirk in rdoc, I put a space between the
|
90
|
+
# colon (:) and terminals_autoexec but there must be no space.)
|
91
|
+
: terminals_autoexec: |
|
92
|
+
export TERM="gnome"
|
93
|
+
clear
|
94
|
+
|
95
|
+
# Other configurations after...
|
96
|
+
|
97
|
+
You can adapt those commands for your shell. If you wonder about the
|
98
|
+
syntax of this file, it's a Ruby hash with Ruby symbols as keys dumped
|
99
|
+
with YAML[http://www.yaml.org/].
|
100
|
+
|
101
|
+
If you have problems getting it to work, watch out for whitespace because
|
102
|
+
YAML is whitespace sensitive (like python). If you still can't get it to
|
103
|
+
work, try running this in a shell:
|
104
|
+
|
105
|
+
ruby -ryaml -e 'puts({:terminals_autoexec => %{export TERM="gnome"\nclear}}.to_yaml)'
|
106
|
+
|
107
|
+
You can redirect the output of this command to overwrite your .vimmaterc file
|
108
|
+
and then run VimMate: it should work this time.
|
109
|
+
|
110
|
+
An other nice trick is to add a special alias that exists only within
|
111
|
+
VimMate's terminals:
|
112
|
+
|
113
|
+
# Other configurations before...
|
114
|
+
# (Because of a small quirk in rdoc, I put a space between the
|
115
|
+
# colon (:) and terminals_autoexec but there must be no space.)
|
116
|
+
: terminals_autoexec: |
|
117
|
+
alias vm='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-tab'
|
118
|
+
export TERM="gnome"
|
119
|
+
clear
|
120
|
+
|
121
|
+
# Other configurations after...
|
122
|
+
|
123
|
+
Again, you have to adapt for your shell because this is for bash. This
|
124
|
+
will also only works if you have only one VimMate running. This will allow
|
125
|
+
you to type
|
126
|
+
|
127
|
+
vm a_file
|
128
|
+
|
129
|
+
to edit <tt>a_file</tt> with the running VimMate. This can be handy for those
|
130
|
+
who prefer the command line to the file tree.
|
131
|
+
|
132
|
+
If you use Subversion (SVN), you can add yet an other line to be able to
|
133
|
+
edit your commit messages within VimMate:
|
134
|
+
|
135
|
+
# Other configurations before...
|
136
|
+
# (Because of a small quirk in rdoc, I put a space between the
|
137
|
+
# colon (:) and terminals_autoexec but there must be no space.)
|
138
|
+
: terminals_autoexec: |
|
139
|
+
alias vm='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-tab'
|
140
|
+
export SVN_EDITOR='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-wait'
|
141
|
+
export TERM="gnome"
|
142
|
+
clear
|
143
|
+
|
144
|
+
# Other configurations after...
|
145
|
+
|
146
|
+
Then, when you run:
|
147
|
+
|
148
|
+
svn commit
|
149
|
+
|
150
|
+
the commit message will be edited within VimMate and Subversion will wait for
|
151
|
+
the buffer containing the file to be deleted with the command
|
152
|
+
|
153
|
+
:bd
|
154
|
+
|
155
|
+
within Vim.
|
156
|
+
|
157
|
+
= Interesting Vim scripts
|
158
|
+
Here are some of the Vim scripts that I think are useful with VimMate to
|
159
|
+
make Vim more powerful:
|
160
|
+
- matchit[http://www.vim.org/scripts/script.php?script_id=39]:
|
161
|
+
Extends the Vim command <tt>%</tt> to easily navigate in
|
162
|
+
matching language constructs for many languages.
|
163
|
+
- rails[http://www.vim.org/scripts/script.php?script_id=1567]:
|
164
|
+
Easy navigation for {Ruby on Rails}[http://www.rubyonrails.org/]
|
165
|
+
- grep[http://www.vim.org/scripts/script.php?script_id=311]:
|
166
|
+
Nice grep integration. I frequently use the command <tt>:Rgrep</tt>.
|
167
|
+
- dbext[http://www.vim.org/scripts/script.php?script_id=356]:
|
168
|
+
Database access within Vim. Integrates well with <tt>rails.vim</tt>.
|
169
|
+
- SimpleFold[http://eigenclass.org/hiki.rb?simplefold+plugin+0.4.0]:
|
170
|
+
Nicely folds classes and methods for easy navigation.
|
171
|
+
- snippetsEmu[http://www.vim.org/scripts/script.php?script_id=1318]:
|
172
|
+
TextMate-like snippet expansion.
|
173
|
+
- vcscommand[http://www.vim.org/scripts/script.php?script_id=90]:
|
174
|
+
Integration for CVS and Subversion (SVN). Supports lots of things like
|
175
|
+
viewing the version control system log, integrated Vim diff, etc.
|
176
|
+
- surround[http://www.vim.org/scripts/script.php?script_id=1697]:
|
177
|
+
A nice script to add, change or remove "surroundings", like
|
178
|
+
parentheses, brackets, quotes, XML tags...
|
179
|
+
- ruby-block-conv[http://eigenclass.org/hiki.rb?Ruby+block+conversion+macros+for+Vim]:
|
180
|
+
Convert single line blocks from {} into do/end and the other way around.
|
181
|
+
|
182
|
+
There are a lot of other nice script out there so check
|
183
|
+
{Vim's web site}[http://www.vim.org/] for more scripts.
|
184
|
+
|
185
|
+
= Limitations
|
186
|
+
- VimMate cannot handle well a directory tree with thousands of files,
|
187
|
+
although it has no problems with hundreds of files.
|
188
|
+
- Vim loads after VimMate is started. If you close VimMate or open a file
|
189
|
+
before Vim starts and is connected to VimMate, this can lead to weird
|
190
|
+
things. You should wait for Vim before you start playing with VimMate.
|
191
|
+
Weird things can also happen if you close VimMate without saving in
|
192
|
+
Vim before.
|
193
|
+
|
194
|
+
= Author and Copyright
|
195
|
+
|
196
|
+
VimMate was written and is Copyright (C) 2006 Guillaume Benny
|
197
|
+
|
198
|
+
See COPYING[link:files/COPYING.html] for more information.
|
data/Rakefile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
=begin
|
2
|
+
= VimMate: Vim graphical add-on
|
3
|
+
Copyright (c) 2006 Guillaume Benny
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'rake/gempackagetask'
|
25
|
+
require 'rake/rdoctask'
|
26
|
+
|
27
|
+
require './lib/vimmatelib/version.rb'
|
28
|
+
|
29
|
+
task :default => :package
|
30
|
+
|
31
|
+
# Documentation Task
|
32
|
+
Rake::RDocTask.new("rdoc") do |t|
|
33
|
+
t.rdoc_files.include('README',
|
34
|
+
'COPYING',
|
35
|
+
'TODO',
|
36
|
+
'CHANGELOG',
|
37
|
+
'bin/**',
|
38
|
+
'lib/**/*.rb')
|
39
|
+
t.main = 'README'
|
40
|
+
t.title = "VimMate #{VimMate::VERSION} documentation"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Gem Specification
|
44
|
+
gem_specification = Gem::Specification.new do |s|
|
45
|
+
s.name = 'VimMate'
|
46
|
+
s.version = VimMate::VERSION
|
47
|
+
s.author = 'Guillaume Benny'
|
48
|
+
s.homepage = 'http://vimmate.rubyforge.org'
|
49
|
+
s.summary = 'VimMate is a graphical add-on to Vim with IDE-like features.'
|
50
|
+
|
51
|
+
s.executables = ['vimmate']
|
52
|
+
|
53
|
+
s.files = FileList['README',
|
54
|
+
'COPYING',
|
55
|
+
'TODO',
|
56
|
+
'CHANGELOG',
|
57
|
+
'Rakefile',
|
58
|
+
'setup.rb',
|
59
|
+
'bin/**/*',
|
60
|
+
'lib/**/*']
|
61
|
+
end
|
62
|
+
|
63
|
+
# Gem Task
|
64
|
+
Rake::GemPackageTask.new(gem_specification) do |pkg|
|
65
|
+
pkg.need_zip = false
|
66
|
+
pkg.need_tar = true
|
67
|
+
end
|
68
|
+
task :package => [:rdoc]
|
69
|
+
|
70
|
+
desc 'Remove rdoc and package'
|
71
|
+
task :clobber => [:clobber_rdoc, :clobber_package]
|
72
|
+
|
data/TODO
ADDED
data/bin/vimmate
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
=begin
|
3
|
+
= VimMate: Vim graphical add-on
|
4
|
+
Copyright (c) 2006 Guillaume Benny
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
+
this software and associated documentation files (the "Software"), to deal in
|
8
|
+
the Software without restriction, including without limitation the rights to
|
9
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
10
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
11
|
+
so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
#
|
27
|
+
# VimMate is a graphical add-on to Vim that was written and
|
28
|
+
# is Copyright (C) 2006 Guillaume Benny
|
29
|
+
#
|
30
|
+
module VimMate
|
31
|
+
end
|
32
|
+
|
33
|
+
# Find the lib directory based on the path of this file
|
34
|
+
lib_dir = File.join(File.dirname(File.expand_path($0)), "../lib")
|
35
|
+
vimmate_lib_dir = File.join(lib_dir, "vimmatelib")
|
36
|
+
# Add the lib directory in Ruby's search path
|
37
|
+
if File.directory? vimmate_lib_dir
|
38
|
+
$:.unshift(lib_dir)
|
39
|
+
end
|
40
|
+
|
41
|
+
require 'rubygems'
|
42
|
+
|
43
|
+
# Require the version
|
44
|
+
require 'vimmatelib/version'
|
45
|
+
|
46
|
+
# Parse the command line arguments
|
47
|
+
require 'optparse'
|
48
|
+
exclude_file_list = []
|
49
|
+
OptionParser.new do |opts|
|
50
|
+
opts.banner = "Usage: #{File.basename($0)} [options] [files or directories]"
|
51
|
+
|
52
|
+
opts.separator ""
|
53
|
+
opts.separator "VimMate #{VimMate::VERSION}: Vim graphical add-on"
|
54
|
+
opts.separator "Copyright (C) 2006 Guillaume Benny"
|
55
|
+
opts.separator ""
|
56
|
+
opts.separator "If files or directories are omitted, the current directory is shown"
|
57
|
+
|
58
|
+
opts.on("-x",
|
59
|
+
"--exclude file1,file2,file3",
|
60
|
+
Array,
|
61
|
+
"Comma separated list of files or directory to exclude.") do |file_list|
|
62
|
+
exclude_file_list = file_list
|
63
|
+
end
|
64
|
+
|
65
|
+
opts.on_tail("-h", "--help", "Show this help screen") do |string|
|
66
|
+
puts opts
|
67
|
+
exit
|
68
|
+
end
|
69
|
+
end.parse!
|
70
|
+
|
71
|
+
require 'vimmatelib/requirer'
|
72
|
+
|
73
|
+
VimMate::Requirer.require_exit('gtk2')
|
74
|
+
|
75
|
+
# We fork to give back the shell to the user, like Vim
|
76
|
+
fork do
|
77
|
+
require 'vimmatelib/config'
|
78
|
+
require 'vimmatelib/dummy_window'
|
79
|
+
require 'vimmatelib/files_menu'
|
80
|
+
require 'vimmatelib/files_window'
|
81
|
+
require 'vimmatelib/main_window'
|
82
|
+
require 'vimmatelib/vim_window'
|
83
|
+
|
84
|
+
# Create the main objects
|
85
|
+
main = VimMate::MainWindow.new
|
86
|
+
files = VimMate::FilesWindow.new(exclude_file_list)
|
87
|
+
vim = VimMate::VimWindow.new
|
88
|
+
menu = VimMate::FilesMenu.new(main)
|
89
|
+
|
90
|
+
terminals = VimMate::Requirer.require_if('vimmatelib/terminals_window', VimMate::DummyWindow.new) do
|
91
|
+
VimMate::TerminalsWindow.new
|
92
|
+
end
|
93
|
+
|
94
|
+
# Set the signals for the file list
|
95
|
+
files.add_open_signal do |path, kind|
|
96
|
+
vim.open(path, kind)
|
97
|
+
end
|
98
|
+
files.add_menu_signal do |path|
|
99
|
+
menu.open(path)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Set the signals for the file menu
|
103
|
+
menu.add_open_signal do |path, kind|
|
104
|
+
vim.open(path, kind)
|
105
|
+
end
|
106
|
+
menu.add_refresh_signal do
|
107
|
+
files.refresh
|
108
|
+
end
|
109
|
+
|
110
|
+
# When there are no files, add the current directory to the file list.
|
111
|
+
# If files are specified on the command line, use them
|
112
|
+
if ARGV.empty?
|
113
|
+
files.add_path(File.expand_path('.'))
|
114
|
+
files.expand_first_row
|
115
|
+
else
|
116
|
+
ARGV.each do |file|
|
117
|
+
files.add_path(File.expand_path(file))
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Create the pane for each part of the UI
|
122
|
+
if VimMate::Config[:layout_big_terminals]
|
123
|
+
# -------------
|
124
|
+
# | F | |
|
125
|
+
# | i | |
|
126
|
+
# | l | Vim |
|
127
|
+
# | e | |
|
128
|
+
# | s | |
|
129
|
+
# -------------
|
130
|
+
# | Terminals |
|
131
|
+
# -------------
|
132
|
+
gtk_top_pane = Gtk::HPaned.new
|
133
|
+
gtk_top_pane.add(files.gtk_window)
|
134
|
+
gtk_top_pane.add(vim.gtk_window)
|
135
|
+
gtk_file_expander = gtk_top_pane
|
136
|
+
|
137
|
+
gtk_full_pane = Gtk::VPaned.new
|
138
|
+
gtk_full_pane.add(gtk_top_pane)
|
139
|
+
gtk_full_pane.pack2(terminals.gtk_window, false, false)
|
140
|
+
else
|
141
|
+
# -------------
|
142
|
+
# | | |
|
143
|
+
# | F | |
|
144
|
+
# | i | Vim |
|
145
|
+
# | l | |
|
146
|
+
# | e | |
|
147
|
+
# | s ---------
|
148
|
+
# | | Term |
|
149
|
+
# -------------
|
150
|
+
gtk_right_pane = Gtk::VPaned.new
|
151
|
+
gtk_right_pane.add(vim.gtk_window)
|
152
|
+
gtk_right_pane.pack2(terminals.gtk_window, false, false)
|
153
|
+
|
154
|
+
gtk_full_pane = Gtk::HPaned.new
|
155
|
+
gtk_full_pane.pack1(files.gtk_window, false, true)
|
156
|
+
gtk_full_pane.add(gtk_right_pane)
|
157
|
+
gtk_file_expander = gtk_full_pane
|
158
|
+
end
|
159
|
+
|
160
|
+
main.gtk_window.add(gtk_full_pane)
|
161
|
+
|
162
|
+
# React when the file list is expanded or closed
|
163
|
+
previous_separator_position = VimMate::Config[:files_opened_width]
|
164
|
+
files.add_expander_signal do |expanded|
|
165
|
+
if expanded
|
166
|
+
gtk_file_expander.position = previous_separator_position
|
167
|
+
else
|
168
|
+
previous_separator_position = gtk_file_expander.position
|
169
|
+
gtk_file_expander.position = VimMate::Config[:files_closed_width]
|
170
|
+
end
|
171
|
+
end
|
172
|
+
unless VimMate::Config[:files_expanded]
|
173
|
+
gtk_file_expander.position = VimMate::Config[:files_closed_width]
|
174
|
+
end
|
175
|
+
|
176
|
+
# Go!
|
177
|
+
main.start(vim)
|
178
|
+
end
|
179
|
+
|