vimmate 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/.autotest +10 -0
  2. data/CHANGELOG +108 -0
  3. data/COPYING +20 -0
  4. data/README +221 -0
  5. data/Rakefile +31 -0
  6. data/TODO +21 -0
  7. data/bin/vimmate +105 -0
  8. data/config/environment.rb +35 -0
  9. data/controllers/file_filter_controller.rb +101 -0
  10. data/controllers/file_popup_menu_controller.rb +40 -0
  11. data/controllers/vim_controller.rb +28 -0
  12. data/controllers/vim_mate_controller.rb +76 -0
  13. data/images/file.png +0 -0
  14. data/images/file_green.png +0 -0
  15. data/images/file_orange.png +0 -0
  16. data/images/file_red.png +0 -0
  17. data/images/folder.png +0 -0
  18. data/images/folder_green.png +0 -0
  19. data/images/folder_orange.png +0 -0
  20. data/images/folder_red.png +0 -0
  21. data/images/processing.png +0 -0
  22. data/images/svn_added.png +0 -0
  23. data/images/svn_conflict.png +0 -0
  24. data/images/svn_deleted.png +0 -0
  25. data/images/svn_locked.png +0 -0
  26. data/images/svn_modified.png +0 -0
  27. data/images/svn_normal.png +0 -0
  28. data/images/svn_readonly.png +0 -0
  29. data/images/vimmate16.png +0 -0
  30. data/images/vimmate32.png +0 -0
  31. data/images/vimmate48.png +0 -0
  32. data/lib/active_window/active_column.rb +218 -0
  33. data/lib/active_window/active_tree_store/columns.rb +88 -0
  34. data/lib/active_window/active_tree_store/extentions.rb +81 -0
  35. data/lib/active_window/active_tree_store/index.rb +53 -0
  36. data/lib/active_window/active_tree_store.rb +26 -0
  37. data/lib/active_window/application.rb +137 -0
  38. data/lib/active_window/controller.rb +58 -0
  39. data/lib/active_window/dot_file.rb +29 -0
  40. data/lib/active_window/filtered_active_tree_store.rb +113 -0
  41. data/lib/active_window/listed_item.rb +127 -0
  42. data/lib/active_window/signal.rb +46 -0
  43. data/lib/active_window.rb +8 -0
  44. data/lib/config_window.rb +90 -0
  45. data/lib/file_tree_store.rb +74 -0
  46. data/lib/filtered_file_tree_store.rb +34 -0
  47. data/lib/gtk_thread_helper.rb +73 -0
  48. data/lib/listed_directory.rb +45 -0
  49. data/lib/listed_file.rb +67 -0
  50. data/lib/try.rb +9 -0
  51. data/lib/vim/buffers.rb +18 -0
  52. data/lib/vim/integration.rb +38 -0
  53. data/lib/vim/netbeans.rb +154 -0
  54. data/lib/vim/source.vim +18 -0
  55. data/lib/vim_mate/config.rb +132 -0
  56. data/lib/vim_mate/dummy_window.rb +14 -0
  57. data/lib/vim_mate/files_menu.rb +110 -0
  58. data/lib/vim_mate/icons.rb +156 -0
  59. data/lib/vim_mate/nice_singleton.rb +53 -0
  60. data/lib/vim_mate/plugins/inotify/init.rb +4 -0
  61. data/lib/vim_mate/plugins/inotify/lib/INotify.rb +208 -0
  62. data/lib/vim_mate/plugins/inotify/lib/directory.rb +58 -0
  63. data/lib/vim_mate/plugins/subversion/init.rb +7 -0
  64. data/lib/vim_mate/plugins/subversion/lib/file.rb +59 -0
  65. data/lib/vim_mate/plugins/subversion/lib/menu.rb +96 -0
  66. data/lib/vim_mate/plugins/subversion/lib/subversion.rb +157 -0
  67. data/lib/vim_mate/plugins.rb +6 -0
  68. data/lib/vim_mate/requirer.rb +68 -0
  69. data/lib/vim_mate/search_window.rb +227 -0
  70. data/lib/vim_mate/tags_window.rb +167 -0
  71. data/lib/vim_mate/terminals_window.rb +163 -0
  72. data/lib/vim_mate/version.rb +29 -0
  73. data/lib/vim_mate/vim_widget.rb +143 -0
  74. data/spec/active_window/active_column_spec.rb +41 -0
  75. data/spec/active_window/active_tree_store_spec.rb +312 -0
  76. data/spec/active_window/controller_spec.rb +6 -0
  77. data/spec/lib/file_tree_store_spec.rb +40 -0
  78. data/spec/lib/listed_directory_spec.rb +26 -0
  79. data/spec/lib/listed_file_spec.rb +53 -0
  80. data/spec/nice_singleton_spec.rb +23 -0
  81. data/spec/spec.opts +6 -0
  82. data/spec/spec_helper.rb +10 -0
  83. data/views/vim_mate.glade +500 -0
  84. data/vimmate.gemspec +138 -0
  85. metadata +146 -0
data/.autotest ADDED
@@ -0,0 +1,10 @@
1
+ Autotest.add_hook :initialize do |at|
2
+ at.clear_mappings
3
+ at.add_mapping(%r%^lib/.*\.rb$%) {
4
+ at.files_matching %r%^spec/.*_spec\.rb$%
5
+ }
6
+ at.add_mapping(%r%^spec/.*\.rb$%) { |file,_|
7
+ file
8
+ }
9
+ end
10
+
data/CHANGELOG ADDED
@@ -0,0 +1,108 @@
1
+ = Changelog
2
+
3
+ === Version 0.6.6
4
+ - # 15198: After a file was opened in Vim, the focus was not in Vim, so if you
5
+ started typing, you would type in the file list, not in Vim. This has been
6
+ corrected. Thanks to Gerda Shank for the bug report.
7
+ - # 14387: A new option is now available to start a login shell by default in
8
+ the terminal window. The option :terminals_login_shell is set to false by
9
+ default. If set to true, it will launch the $SHELL command if defined, the
10
+ shell defined in /etc/passwd if defined and /bin/sh otherwise. In all cases,
11
+ it will pass the -l option to the shell. Thanks to Pablo Castellazzi for the
12
+ patch.
13
+ - # 14886: When filtering, directories that contain no matching files are now
14
+ automatically hidden. Also, a new option is now available to automatically
15
+ expand the file tree when filtering. The option is
16
+ :files_auto_expand_on_filter and is set to false by default. Thanks to
17
+ Stefan for the original patch.
18
+
19
+ === Version 0.6.5
20
+ - VimMate would crash when VTE was not present when using shortcut keys
21
+ - Changed some shortcut keys:
22
+ - CTRL+SHIFT+S: Set focus to current terminal (shell)
23
+ - CTRL+SHIFT+T: Create a new terminal
24
+ - CTRL+SHIFT+E: Set focus to search file list
25
+ - # 13210: A new option is now available to hide the status of the files. This helps
26
+ when using ellipsis since it leaves more space for the file names. The new
27
+ option is :files_show_status and it's set to true by default. Thanks to
28
+ Stephen Walker who sent me a patch for this.
29
+
30
+ === Version 0.6.4
31
+ - VimMate now has shortcut keys to control it's various parts. Here is the
32
+ list of the shortcut keys that where added:
33
+ - CTRL+SHIFT+T: Set focus to current terminal
34
+ - CTRL+SHIFT+N: Create a new terminal
35
+ - CTRL+SHIFT+W: Close current terminal
36
+ - CTRL+PAGEDOWN: Next terminal
37
+ - CTRL+PAGEDOWN: Previous terminal
38
+ - CTRL+SHIFT+L: Set focus to file filter
39
+ - CTRL+SHIFT+F: Set focus to file list
40
+ - CTRL+SHIFT+S: Set focus to search file list
41
+ - CTRL+SHIFT+V: Set focus to Vim
42
+ Setting the focus to Vim doesn't work perfectly. If it doesn't seem to work,
43
+ you can try to press TAB or the Up or Down keys on your keyboard after using
44
+ the CTRL+SHIFT+V shortcut and it works most of the time. Thanks to Florian
45
+ Frank who sent me a patch for the first 5 shortcuts. The other shortcuts
46
+ where also added thanks to this patch by Florian Frank.
47
+
48
+ === Version 0.6.3
49
+ - # 13212: VimMate could not be resized properly.
50
+ - # 7399, partially. A new warning has been added when too many files are
51
+ loaded by VimMate. The warning asks the user if he wants to continue. The
52
+ default number of files is 300 and can be changed by setting the option
53
+ :files_warn_too_many_files to an other number. The warning is popped every
54
+ multiple of this settings, which means at 300, 600, 900... This can be
55
+ changed by setting the option :files_warn_too_many_files_each_step to
56
+ false.
57
+
58
+ === Version 0.6.2
59
+ - # 7028: It's now possible to install VimMate using the provided setup.rb
60
+ or with Ruby Gems.
61
+ - Two layouts are now available. The old layout, with big terminals:
62
+ -------------
63
+ | F | |
64
+ | i | |
65
+ | l | Vim |
66
+ | e | |
67
+ | s | |
68
+ -------------
69
+ | Terminals |
70
+ -------------
71
+ And the new layout, with a big file list:
72
+ -------------
73
+ | | |
74
+ | F | |
75
+ | i | Vim |
76
+ | l | |
77
+ | e | |
78
+ | s ---------
79
+ | | Term |
80
+ -------------
81
+ The new layout is now the default. You can change this by setting the
82
+ :layout_big_terminals option to true.
83
+ - # 6761: A new way of opening files is now available. A new list of files
84
+ allows you to type only a part of a file name to see the possible files
85
+ filtered instantly. You can then select the file from the list or type
86
+ <tt>Enter</tt> directly if the file you are searching for is selected.
87
+ You can remove this new list by setting the option :files_use_search
88
+ to false. You can also specify if the search is case sensitive or not
89
+ with the option :files_search_ignore_case. The case is ignored by default.
90
+ - Long file names in the file list are now shorten with ellipsis. You can
91
+ disable ellipsis by setting the option :files_use_ellipsis to false.
92
+ - Files or directories can now be excluded on the command line. You can specify
93
+ a comma separated list of names that will be matched against the end of the
94
+ path of each files of directories. So <tt>vimmate -x html,pkg,README</tt>
95
+ will exclude any files with the names html, pkg or README. But,
96
+ <tt>vimmate -x bin/README</tt> will only exclude the file README in the bin
97
+ directory. Note that <tt>vimmate -x ME</tt> will only exclude files or
98
+ directories named ME and not files ending with ME like README.
99
+
100
+ === Version 0.6.1
101
+ - # 6721: Added "Tab Open" in the menu. "Tab Open" is the default when opening
102
+ a file not from the menu. This can be changed by setting the option
103
+ :files_default_open_in_tabs to false.
104
+ - Better Subversion integration: Add a new menu Subversion with Add, Rename,
105
+ Delete and Revert as sub-menus.
106
+
107
+ === Version 0.6.0
108
+ - 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,221 @@
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
+ - Navigate the various part of the interface with the keyboard
28
+
29
+ = Installation
30
+ VimMate has only been tested under Linux (in fact,
31
+ {Gentoo Linux}[http://www.gentoo.org/]). It might work under other OSs,
32
+ although I do not know. I think only the file list will work under
33
+ Windows because Vim does not use GTK under Windows so it cannot be embedded.
34
+ I know nothing about MacOSX so I cannot say if it works or not.
35
+
36
+ To install:
37
+ - Make sure Vim[http://www.vim.org/] is installed and compiled with the
38
+ graphical interface. Try running +gvim+ to see if it works. Only Vim
39
+ version 7.0 has been tested.
40
+ - Make sure Ruby[http://www.ruby-lang.org/] version 1.8 or more is installed.
41
+ Try running <tt>ruby --version</tt> in a terminal.
42
+ - Install the Ruby bindings to GTK and GNOME (for the VTE terminal). See
43
+ {Ruby-GNOME2 website}[http://ruby-gnome2.sourceforge.jp/]. Only
44
+ Ruby-GNOME2 version 0.15 and 0.16 has been tested. You don't need VTE: if
45
+ it's not installed, VimMate will not have terminals but will run anyway.
46
+ - If you want to use the Subversion integration feature, you must install
47
+ the subversion bindings for Ruby. Check if it's available for your OS
48
+ or get the sources from
49
+ {Subversion's website}[http://subversion.tigris.org/] and compile them.
50
+ - Download the latest VimMate on
51
+ {VimMate's homepage}[http://vimmate.rubyforge.org/].
52
+ - You now have 3 choices to install VimMate: manually, with Ruby Gems or with
53
+ <tt>setup.rb</tt>:
54
+ - With Ruby Gems
55
+ - Simply run <tt>gem install VimMate</tt> .
56
+ - With <tt>setup.rb</tt>
57
+ - Simply run <tt>ruby setup.rb</tt> . Run <tt>ruby setup.rb --help</tt> for
58
+ more information.
59
+ - Manually
60
+ - Copy the file <tt>bin/vimmate</tt> and the directory
61
+ <tt>lib/vimmatelib</tt> to a directory somewhere in your path.
62
+ - Make sure +vimmate+ is executable: <tt>chmod u+x vimmate</tt>
63
+ - cd to a directory where your project is. (Watch out for directories
64
+ with too many files. See <i>Limitations</i> below.)
65
+ - Run +vimmate+
66
+
67
+ Run <tt>vimmate --help</tt> for more information.
68
+
69
+ = Configuration
70
+ Note that you don't have to do what's described in this section:
71
+ everything will work anyway. It's just filled with nice tricks.
72
+
73
+ VimMate doesn't need any special configuration to run. But, when VimMate is
74
+ first run, it creates a file named <tt>.vimmaterc</tt> in your HOME directory.
75
+ You can edit this file at your own risk. If anything goes wrong, you can
76
+ always delete this file and it will be recreated with the default
77
+ configuration.
78
+
79
+ Most variables are self explanatory. One variable deserves a special
80
+ explanation because it can be useful to change. It's the line that
81
+ starts with <tt>:terminals_autoexec:</tt>. This line specifies a string
82
+ that is automatically executed by every terminals that are created by
83
+ VimMate. I'm sure you can think about a way to use this, but the idea
84
+ of this configuration line is to initialize the terminal so that it can
85
+ execute Vim (the console <tt>vim</tt>) without weird warnings about
86
+ escape characters. Here is how to configure it so that it works without
87
+ warnings with the bash shell:
88
+
89
+ # Other configurations before...
90
+ # (Because of a small quirk in rdoc, I put a space between the
91
+ # colon (:) and terminals_autoexec but there must be no space.)
92
+ : terminals_autoexec: |
93
+ export TERM="gnome"
94
+ clear
95
+
96
+ # Other configurations after...
97
+
98
+ You can adapt those commands for your shell. If you wonder about the
99
+ syntax of this file, it's a Ruby hash with Ruby symbols as keys dumped
100
+ with YAML[http://www.yaml.org/].
101
+
102
+ If you have problems getting it to work, watch out for whitespace because
103
+ YAML is whitespace sensitive (like python). If you still can't get it to
104
+ work, try running this in a shell:
105
+
106
+ ruby -ryaml -e 'puts({:terminals_autoexec => %{export TERM="gnome"\nclear}}.to_yaml)'
107
+
108
+ You can redirect the output of this command to overwrite your .vimmaterc file
109
+ and then run VimMate: it should work this time.
110
+
111
+ An other nice trick is to add a special alias that exists only within
112
+ VimMate's terminals (Thanks to Jonathan Hankins for this updated tip,
113
+ see {#13432}[http://rubyforge.org/tracker/index.php?func=detail&aid=13432&group_id=2612&atid=10058]
114
+ for details):
115
+
116
+ # Other configurations before...
117
+ # (Because of a small quirk in rdoc, I put a space between the
118
+ # colon (:) and terminals_autoexec but there must be no space.)
119
+ : terminals_autoexec: |
120
+ alias vm='gvim --servername $(gvim --serverlist | grep "VIMMATE_$PPID") --remote-tab'
121
+ export TERM="gnome"
122
+ clear
123
+
124
+ # Other configurations after...
125
+
126
+ Again, you have to adapt for your shell because this is for bash. This
127
+ will also only works if you have only one VimMate running. This will allow
128
+ you to type
129
+
130
+ vm a_file
131
+
132
+ to edit <tt>a_file</tt> with the running VimMate. This can be handy for those
133
+ who prefer the command line to the file tree.
134
+
135
+ If you use Subversion (SVN), you can add yet an other line to be able to
136
+ edit your commit messages within VimMate:
137
+
138
+ # Other configurations before...
139
+ # (Because of a small quirk in rdoc, I put a space between the
140
+ # colon (:) and terminals_autoexec but there must be no space.)
141
+ : terminals_autoexec: |
142
+ alias vm='gvim --servername $(gvim --serverlist | grep "VIMMATE_$PPID") --remote-tab'
143
+ export SVN_EDITOR='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-wait'
144
+ export TERM="gnome"
145
+ clear
146
+
147
+ # Other configurations after...
148
+
149
+ Then, when you run:
150
+
151
+ svn commit
152
+
153
+ the commit message will be edited within VimMate and Subversion will wait for
154
+ the buffer containing the file to be deleted with the command
155
+
156
+ :bd
157
+
158
+ within Vim.
159
+
160
+ = Interesting Vim scripts
161
+ Here are some of the Vim scripts that I think are useful with VimMate to
162
+ make Vim more powerful:
163
+ - matchit[http://www.vim.org/scripts/script.php?script_id=39]:
164
+ Extends the Vim command <tt>%</tt> to easily navigate in
165
+ matching language constructs for many languages.
166
+ - rails[http://www.vim.org/scripts/script.php?script_id=1567]:
167
+ Easy navigation for {Ruby on Rails}[http://www.rubyonrails.org/]
168
+ - grep[http://www.vim.org/scripts/script.php?script_id=311]:
169
+ Nice grep integration. I frequently use the command <tt>:Rgrep</tt>.
170
+ - dbext[http://www.vim.org/scripts/script.php?script_id=356]:
171
+ Database access within Vim. Integrates well with <tt>rails.vim</tt>.
172
+ - SimpleFold[http://eigenclass.org/hiki.rb?simplefold+plugin+0.4.0]:
173
+ Nicely folds classes and methods for easy navigation.
174
+ - snippetsEmu[http://www.vim.org/scripts/script.php?script_id=1318]:
175
+ TextMate-like snippet expansion.
176
+ - vcscommand[http://www.vim.org/scripts/script.php?script_id=90]:
177
+ Integration for CVS and Subversion (SVN). Supports lots of things like
178
+ viewing the version control system log, integrated Vim diff, etc.
179
+ - surround[http://www.vim.org/scripts/script.php?script_id=1697]:
180
+ A nice script to add, change or remove "surroundings", like
181
+ parentheses, brackets, quotes, XML tags...
182
+ - ruby-block-conv[http://eigenclass.org/hiki.rb?Ruby+block+conversion+macros+for+Vim]:
183
+ Convert single line blocks from {} into do/end and the other way around.
184
+
185
+ There are a lot of other nice script out there so check
186
+ {Vim's web site}[http://www.vim.org/] for more scripts.
187
+
188
+ = Keyboard shortcuts
189
+ Here is a list of the various shortcut keys:
190
+ - CTRL+SHIFT+S: Set focus to current terminal (shell)
191
+ - CTRL+SHIFT+T: Create a new terminal
192
+ - CTRL+SHIFT+W: Close current terminal
193
+ - CTRL+PAGEDOWN: Next terminal
194
+ - CTRL+PAGEDOWN: Previous terminal
195
+ - CTRL+SHIFT+L: Set focus to file filter
196
+ - CTRL+SHIFT+F: Set focus to file list
197
+ - CTRL+SHIFT+E: Set focus to search file list
198
+ - CTRL+SHIFT+V: Set focus to Vim
199
+ Thanks to Florian Frank who sent me a patch for the first 5 shortcuts. The
200
+ other shortcuts where also added thanks to this patch by Florian Frank. (Note
201
+ that if there are bugs in the processing of those shortcut keys, it's probably
202
+ my fault and not is.)
203
+
204
+ = Limitations
205
+ - VimMate cannot handle well a directory tree with thousands of files,
206
+ although it has no problems with hundreds of files although it can take
207
+ some time to start.
208
+ - Vim loads after VimMate is started. If you close VimMate or open a file
209
+ before Vim starts and is connected to VimMate, this can lead to weird
210
+ things. You should wait for Vim before you start playing with VimMate.
211
+ Weird things can also happen if you close VimMate without saving in
212
+ Vim before.
213
+ - Setting the focus to Vim with the shortcut key doesn't work perfectly. If it
214
+ doesn't seem to work, you can try to press TAB or the Up or Down keys on
215
+ your keyboard after using the shortcut key and it works most of the time.
216
+
217
+ = Author and Copyright
218
+
219
+ VimMate was written and is Copyright (C) 2006 Guillaume Benny
220
+
221
+ See COPYING[link:files/COPYING.html] for more information.
data/Rakefile ADDED
@@ -0,0 +1,31 @@
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 'rubygems'
25
+ require 'rake'
26
+
27
+ require './lib/vim_mate/version.rb'
28
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |tasks| load tasks }
29
+
30
+ task :default => :install
31
+
data/TODO ADDED
@@ -0,0 +1,21 @@
1
+ = TODO
2
+ List of things to do:
3
+ - Find a better way to hide the file list and use the same way to hide
4
+ the terminals. Patches for this are welcome!
5
+ - Configurable shortcut keys: allow users to change the shortcut keys
6
+ with .vimmaterc. Need to find a way to specify the modifier (shift, ctrl)
7
+ and the key. Probably something like "CONTROL_MASK SHIFT_MASK GDK_S".
8
+ - Icons are missing on move or mkdir -p
9
+
10
+ = Ideas
11
+ - New from file copy
12
+ - Opening many files at once
13
+ - Open in external viewer
14
+
15
+ = TODO from Rewrite
16
+ - re-enable SVN support
17
+
18
+
19
+ /home/niklas/ruby/VimMate/bin/../lib/file_tree_controller.rb: line 150
20
+ Gtk-CRITICAL **:gtk_tree_model_row_has_child_toggled: assertion `path != NULL' failed
21
+
data/bin/vimmate ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # Parse the command line arguments
3
+ require 'optparse'
4
+ excludes = []
5
+ OptionParser.new do |opts|
6
+ opts.banner = "Usage: #{File.basename($0)} [options] [files or directories]"
7
+
8
+ opts.separator ""
9
+ # opts.separator "VimMate #{VimMate::VERSION}: Vim graphical add-on"
10
+ opts.separator "Copyright (C) 2006 Guillaume Benny"
11
+ opts.separator ""
12
+ opts.separator "If files or directories are omitted, the current directory is shown"
13
+
14
+ opts.on("-x",
15
+ "--exclude file1,file2,file3",
16
+ Array,
17
+ "Comma separated list of files or directory to exclude.") do |list|
18
+ excludes = list
19
+ end
20
+
21
+ opts.on_tail("-h", "--help", "Show this help screen") do |string|
22
+ puts opts
23
+ exit
24
+ end
25
+ end.parse!
26
+
27
+
28
+ # Ignore patterns from .vimmate_ignore
29
+ local_ignore_file = File.expand_path('.vimmate_ignore')
30
+ if File.exists?(local_ignore_file)
31
+ File.open(local_ignore_file) do |f|
32
+ while line = f.gets
33
+ line.chomp!.strip!
34
+ excludes << line unless line.empty?
35
+ end
36
+ end
37
+ end
38
+
39
+ # We fork to give back the shell to the user, like Vim
40
+ fork do
41
+ require File.expand_path( File.join( File.dirname(__FILE__), '..', 'config', 'environment' ) )
42
+ Thread.abort_on_exception = true
43
+
44
+ class VimMateApp < ActiveWindow::Application
45
+ def initialize(opts={})
46
+ @excludes = opts.delete(:excludes)
47
+ super
48
+ end
49
+ def file_tree
50
+ files.file_tree
51
+ end
52
+ def files
53
+ controller[:file_filter]
54
+ end
55
+ def vim
56
+ controller[:vim].vim
57
+ end
58
+ def add_path(path)
59
+ file_tree.initial_adding do
60
+ file_tree.add_path(path)
61
+ end
62
+ end
63
+
64
+ def post_setup
65
+ super
66
+
67
+ @excludes.each do |rule|
68
+ file_tree.exclude! rule
69
+ end unless @excludes.blank?
70
+
71
+ # If there are no files given, add the current directory to the file list.
72
+ # If files are specified on the command line, use them
73
+ if ARGV.empty?
74
+ add_path(File.expand_path('.'))
75
+ files.expand_first_row
76
+ else
77
+ ARGV.each do |file|
78
+ path = File.expand_path(file)
79
+ add_path(path)
80
+ #window.vim.open(path, :tab)
81
+ end
82
+ end
83
+ end
84
+
85
+ def run
86
+ GLib::Timeout.add(23) do
87
+ vim.start
88
+ false
89
+ end
90
+ super
91
+ end
92
+ end
93
+
94
+ icon_path = File.join( File.dirname(__FILE__), '..', 'images', 'vimmate48.png' )
95
+ Gtk::Window.set_default_icon(icon_path)
96
+
97
+ app = VimMateApp.new(:title => 'VimMate', :main_window => 'VimMate', :excludes => excludes)
98
+ app.start
99
+
100
+
101
+ ## Create the main objects
102
+ #window = VimMate::Window.new
103
+
104
+ end
105
+
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'activesupport'
3
+
4
+
5
+ APP_ROOT = File.expand_path( File.join( File.dirname(__FILE__), '..' ) )
6
+ PROGRAM_NAME = 'vim_mate'
7
+
8
+ #ActiveSupport::Dependencies::logger = Logger.new( File.expand_path('log/dependencies.log') )
9
+ #ActiveSupport::Dependencies::log_activity = true
10
+ ActiveSupport::Dependencies::load_paths << File.join(APP_ROOT, "lib")
11
+ ActiveSupport::Dependencies::load_paths << File.join(APP_ROOT, "controllers")
12
+ ActiveSupport::Dependencies::load_paths << File.join(APP_ROOT, "lib/vim_mate")
13
+
14
+ VimMate::Requirer.require_exit('gtk2')
15
+ VimMate::Requirer.require_exit('libglade2')
16
+
17
+
18
+ #require 'vimmatelib/file_tree_view'
19
+ require_dependency 'gtk_thread_helper'
20
+ require_dependency 'plugins'
21
+
22
+ require_dependency 'active_window'
23
+
24
+ %w(
25
+ file_created file_modified file_deleted file_opened
26
+ dir_created
27
+ item_opened item_removed item_refreshed
28
+ file_opened
29
+ ).each do |signal|
30
+ ActiveWindow::Signal::define signal
31
+ end
32
+
33
+ Dir[File.join(APP_ROOT, 'controllers', '*_controller.rb' )].each do |controller_path|
34
+ require_dependency File.basename(controller_path)
35
+ end
@@ -0,0 +1,101 @@
1
+ class FileFilterController < ActiveWindow::Controller
2
+ attr_reader :file_tree, :filtered_file_tree
3
+
4
+ def post_setup
5
+ # TODO use ActiveTreeStore derivate
6
+ @file_tree = FileTreeStore.new
7
+ @filtered_file_tree = FilteredFileTreeStore.new(file_tree)
8
+
9
+ filtered_file_tree.apply_to_tree file_tree_view
10
+
11
+ file_tree_view.selection.mode = Gtk::SELECTION_SINGLE
12
+ file_tree_view.headers_visible = VimMate::Config[:file_headers_visible]
13
+ file_tree_view.hover_selection = VimMate::Config[:file_hover_selection]
14
+
15
+ tree_scroller.set_size_request(VimMate::Config[:files_opened_width], -1)
16
+ files_filter_button.active = VimMate::Config[:files_filter_active]
17
+ files_pane.position = VimMate::Config[:files_search_separator_position]
18
+ end
19
+
20
+ # TODO find another poace to put
21
+ def selection_changed
22
+ STDERR.puts "changed selection"
23
+ if row.file_or_directory?
24
+ selected_path_label.text = File.join(row.full_path)
25
+ else
26
+ selected_path_label.text = ""
27
+ end
28
+ end
29
+ def filter
30
+ if files_filter_button.active?
31
+ filter_string = files_filter_term.text
32
+
33
+ if filtered_file_tree.filter_string.blank? && filter_string.length == 1 # begin of filtering
34
+ save_expands if VimMate::Config[:files_auto_expand_on_filter]
35
+ end
36
+
37
+ filtered_file_tree.filter = filter_string
38
+
39
+ if VimMate::Config[:files_auto_expand_on_filter]
40
+ filter_string.blank? ? restore_expands : expand_all
41
+ end
42
+ else
43
+ filtered_file_tree.clear_filter
44
+ restore_expands if VimMate::Config[:files_auto_expand_on_filter]
45
+ end
46
+ end
47
+
48
+ def changed
49
+ stop_filter_timer
50
+ @filter_timer = GLib::Timeout.add(500) { filter; false }
51
+ end
52
+ alias_method :toggle, :changed
53
+
54
+ def stop_filter_timer
55
+ if @filter_timer
56
+ if GLib::Source.respond_to?(:remove)
57
+ GLib::Source.remove(@filter_timer)
58
+ else
59
+ Gtk.timeout_remove(@filter_timer)
60
+ end
61
+ @filter_timer = nil
62
+ end
63
+ end
64
+
65
+ def expand_all
66
+ file_tree_view.expand_all
67
+ end
68
+
69
+ def expand_first_row
70
+ file_tree_view.collapse_all
71
+ file_tree_view.expand_row(Gtk::TreePath.new("0"), false)
72
+ end
73
+
74
+ def button_pressed(given)
75
+ event = given[:event]
76
+ if event.kind_of? Gdk::EventButton and event.button == 3
77
+ path = file_tree_view.get_path_at_pos(event.x, event.y)
78
+ file_tree_view.selection.select_path(path[0]) if path
79
+ if file_tree_view.selection.selected
80
+ file_popup.popup(nil, nil, 0, 0)
81
+ end
82
+ end
83
+ end
84
+
85
+ private
86
+ def save_expands
87
+ @expands = []
88
+ file_tree_view.map_expanded_rows { |tree_view, path| @expands << path }
89
+ @expands
90
+ end
91
+
92
+ def restore_expands
93
+ file_tree_view.collapse_all if VimMate::Config[:files_auto_expand_on_filter]
94
+ unless @expands.nil? || @expands.empty?
95
+ @expands.each do |path|
96
+ file_tree_view.expand_row(path, false)
97
+ end
98
+ end
99
+ end
100
+
101
+ end