VimMate 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,23 @@
1
1
  = Changelog
2
2
 
3
+ === Version 0.6.4
4
+ - VimMate now has shortcut keys to control it's various parts. Here is the
5
+ list of the shortcut keys that where added:
6
+ - CTRL+SHIFT+T: Set focus to current terminal
7
+ - CTRL+SHIFT+N: Create a new terminal
8
+ - CTRL+SHIFT+W: Close current terminal
9
+ - CTRL+PAGEDOWN: Next terminal
10
+ - CTRL+PAGEDOWN: Previous terminal
11
+ - CTRL+SHIFT+L: Set focus to file filter
12
+ - CTRL+SHIFT+F: Set focus to file list
13
+ - CTRL+SHIFT+S: Set focus to search file list
14
+ - CTRL+SHIFT+V: Set focus to Vim
15
+ Setting the focus to Vim doesn't work perfectly. If it doesn't seem to work,
16
+ you can try to press TAB or the Up or Down keys on your keyboard after using
17
+ the CTRL+SHIFT+V shortcut and it works most of the time. Thanks to Florian
18
+ Frank who sent me a patch for the first 5 shortcuts. The other shortcuts
19
+ where also added thanks to this patch by Florian Frank.
20
+
3
21
  === Version 0.6.3
4
22
  - # 13212: VimMate could not be resized properly.
5
23
  - # 7399, partially. A new warning has been added when too many files are
data/README CHANGED
@@ -24,6 +24,7 @@ VimMate has the following features:
24
24
  - Basic Subversion[http://subversion.tigris.org/] integration: <i>(Optional)</i>
25
25
  - The file status is displayed in the file tree.
26
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
27
28
 
28
29
  = Installation
29
30
  VimMate has only been tested under Linux (in fact,
@@ -108,13 +109,15 @@ You can redirect the output of this command to overwrite your .vimmaterc file
108
109
  and then run VimMate: it should work this time.
109
110
 
110
111
  An other nice trick is to add a special alias that exists only within
111
- VimMate's terminals:
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):
112
115
 
113
116
  # Other configurations before...
114
117
  # (Because of a small quirk in rdoc, I put a space between the
115
118
  # colon (:) and terminals_autoexec but there must be no space.)
116
119
  : terminals_autoexec: |
117
- alias vm='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-tab'
120
+ alias vm='gvim --servername $(gvim --serverlist | grep "VIMMATE_$PPID") --remote-tab'
118
121
  export TERM="gnome"
119
122
  clear
120
123
 
@@ -136,7 +139,7 @@ edit your commit messages within VimMate:
136
139
  # (Because of a small quirk in rdoc, I put a space between the
137
140
  # colon (:) and terminals_autoexec but there must be no space.)
138
141
  : terminals_autoexec: |
139
- alias vm='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-tab'
142
+ alias vm='gvim --servername $(gvim --serverlist | grep "VIMMATE_$PPID") --remote-tab'
140
143
  export SVN_EDITOR='gvim --servername `gvim --serverlist | grep VIMMATE_` --remote-wait'
141
144
  export TERM="gnome"
142
145
  clear
@@ -182,6 +185,22 @@ make Vim more powerful:
182
185
  There are a lot of other nice script out there so check
183
186
  {Vim's web site}[http://www.vim.org/] for more scripts.
184
187
 
188
+ = Keyboard shortcuts
189
+ Here is a list of the various shortcut keys:
190
+ - CTRL+SHIFT+T: Set focus to current terminal
191
+ - CTRL+SHIFT+N: 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+S: 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
+
185
204
  = Limitations
186
205
  - VimMate cannot handle well a directory tree with thousands of files,
187
206
  although it has no problems with hundreds of files although it can take
@@ -191,6 +210,9 @@ There are a lot of other nice script out there so check
191
210
  things. You should wait for Vim before you start playing with VimMate.
192
211
  Weird things can also happen if you close VimMate without saving in
193
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.
194
216
 
195
217
  = Author and Copyright
196
218
 
data/Rakefile CHANGED
@@ -70,3 +70,7 @@ task :package => [:rdoc]
70
70
  desc 'Remove rdoc and package'
71
71
  task :clobber => [:clobber_rdoc, :clobber_package]
72
72
 
73
+ desc 'Upload rdoc to Rubyforge'
74
+ task :upload_rdoc => [:rdoc] do
75
+ sh "scp -r html bennygui@rubyforge.org:/var/www/gforge-projects/vimmate"
76
+ end
data/bin/vimmate CHANGED
@@ -91,6 +91,10 @@ fork do
91
91
  VimMate::TerminalsWindow.new
92
92
  end
93
93
 
94
+ main.files_window = files if files
95
+ main.vim_window = vim if files
96
+ main.terminals_window = terminals if terminals
97
+
94
98
  # Set the signals for the file list
95
99
  files.add_open_signal do |path, kind|
96
100
  vim.open(path, kind)
@@ -182,15 +182,15 @@ module VimMate
182
182
  # Create a box to filter the list
183
183
  gtk_filter_box = Gtk::HBox.new
184
184
  gtk_filter_box.pack_start(gtk_filter_button = Gtk::ToggleButton.new("Filter"), false, false)
185
- gtk_filter_box.pack_start(gtk_entry = Gtk::Entry.new, true, true)
185
+ gtk_filter_box.pack_start(@gtk_file_filter_entry = Gtk::Entry.new, true, true)
186
186
  changed_lambda = lambda do
187
187
  if gtk_filter_button.active?
188
- self.filter = gtk_entry.text
188
+ self.filter = @gtk_file_filter_entry.text
189
189
  else
190
190
  self.clear_filter
191
191
  end
192
192
  end
193
- gtk_entry.signal_connect("changed", &changed_lambda)
193
+ @gtk_file_filter_entry.signal_connect("changed", &changed_lambda)
194
194
  gtk_filter_button.signal_connect("toggled", &changed_lambda)
195
195
  gtk_filter_button.active = Config[:files_filter_active]
196
196
  gtk_filter_box.spacing = 10
@@ -208,16 +208,16 @@ module VimMate
208
208
  if Config[:files_use_search]
209
209
  @gtk_paned_box = Gtk::VPaned.new
210
210
  @gtk_paned_box.add(gtk_top_box)
211
- @gtk_paned_box.add((search_window = SearchWindow.new(@file_tree)).gtk_window)
211
+ @gtk_paned_box.add((@search_window = SearchWindow.new(@file_tree)).gtk_window)
212
212
  @gtk_paned_box.position = Config[:files_search_separator_position]
213
213
 
214
214
  # Set the signals for the search window
215
- search_window.add_open_signal do |path, kind|
215
+ @search_window.add_open_signal do |path, kind|
216
216
  @open_signal.each do |signal|
217
217
  signal.call(path, kind)
218
218
  end
219
219
  end
220
- search_window.add_menu_signal do |path|
220
+ @search_window.add_menu_signal do |path|
221
221
  @menu_signal.each do |signal|
222
222
  signal.call(path)
223
223
  end
@@ -280,6 +280,21 @@ module VimMate
280
280
  filter
281
281
  end
282
282
 
283
+ # Set the focus to the file filter
284
+ def focus_file_filter
285
+ @gtk_file_filter_entry.has_focus = true if @gtk_file_filter_entry
286
+ end
287
+
288
+ # Set the focus to the file list
289
+ def focus_file_list
290
+ @gtk_tree_view.has_focus = true if @gtk_tree_view
291
+ end
292
+
293
+ # Set the focus to the search file list
294
+ def focus_file_search
295
+ @search_window.focus_file_search if @search_window
296
+ end
297
+
283
298
  # Expand the first row of the file tree
284
299
  def expand_first_row
285
300
  @gtk_tree_view.collapse_all
@@ -30,6 +30,8 @@ module VimMate
30
30
  # Represents the main window of the application
31
31
  class MainWindow
32
32
 
33
+ attr_accessor :vim_window, :files_window, :terminals_window
34
+
33
35
  # Create the MainWindow
34
36
  def initialize
35
37
  @gtk_main_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
@@ -40,6 +42,59 @@ module VimMate
40
42
  gtk_window.set_default_size(Config[:window_width],
41
43
  Config[:window_height])
42
44
  gtk_window.set_icon_list(Icons.window_icons)
45
+ # Add an event handler for keys events
46
+ gtk_window.signal_connect("key-press-event") do |window, event|
47
+ if event.state & Gdk::Window::ModifierType::CONTROL_MASK != 0
48
+ if event.state & Gdk::Window::ModifierType::SHIFT_MASK != 0
49
+ case event.keyval
50
+ # CTRL+SHIFT+T: Set focus to terminal
51
+ when Gdk::Keyval::GDK_T
52
+ terminals_window.focus_terminal if terminals_window
53
+ next true
54
+ # CTRL+SHIFT+N: New terminal
55
+ when Gdk::Keyval::GDK_N
56
+ terminals_window.add_new_terminal if terminals_window
57
+ next true
58
+ # CTRL+SHIFT+W: Close terminal
59
+ when Gdk::Keyval::GDK_W
60
+ terminals_window.delete_current_terminal if terminals_window
61
+ next true
62
+ # CTRL+SHIFT+L: Set focus to file filter
63
+ when Gdk::Keyval::GDK_L
64
+ files_window.focus_file_filter if files_window
65
+ next true
66
+ # CTRL+SHIFT+F: Set focus to file list
67
+ when Gdk::Keyval::GDK_F
68
+ files_window.focus_file_list if files_window
69
+ next true
70
+ # CTRL+SHIFT+S: Set focus to search file list
71
+ when Gdk::Keyval::GDK_S
72
+ files_window.focus_file_search if files_window
73
+ next true
74
+ # CTRL+SHIFT+V: Set focus to Vim
75
+ when Gdk::Keyval::GDK_V
76
+ vim_window.focus_vim if vim_window
77
+ next true
78
+ else
79
+ next nil
80
+ end
81
+ else
82
+ case event.keyval
83
+ # CTRL+PAGEDOWN: Next terminal
84
+ when Gdk::Keyval::GDK_Page_Down
85
+ terminals_window.next_terminal if terminals_window
86
+ next true
87
+ # CTRL+PAGEDOWN: Previous terminal
88
+ when Gdk::Keyval::GDK_Page_Up
89
+ terminals_window.prev_terminal if terminals_window
90
+ next true
91
+ else
92
+ next nil
93
+ end
94
+ end
95
+ end
96
+ nil
97
+ end
43
98
  end
44
99
 
45
100
  # The "window" for this object
@@ -54,6 +109,7 @@ module VimMate
54
109
  start_window.start
55
110
  Gtk.main
56
111
  end
112
+
57
113
  end
58
114
  end
59
115
 
@@ -202,6 +202,11 @@ module VimMate
202
202
  @gtk_container_box
203
203
  end
204
204
 
205
+ # Set the focus to the entry field in the file search list
206
+ def focus_file_search
207
+ @gtk_entry.has_focus = true if @gtk_entry
208
+ end
209
+
205
210
  # Add a block that will be called when the user choose to open a file
206
211
  # The block take two argument: the path to the file to open, and a
207
212
  # symbol to indicate the kind: :open, :split_open, :tab_open
@@ -33,6 +33,10 @@ module VimMate
33
33
  not Config[:terminals_enabled]
34
34
  end
35
35
 
36
+ class ::Vte::Terminal
37
+ attr_accessor :pid
38
+ end
39
+
36
40
  # The window that contains the terminals
37
41
  class TerminalsWindow
38
42
 
@@ -50,10 +54,7 @@ module VimMate
50
54
  Gtk::Image.new(Gtk::Stock::NEW, Gtk::IconSize::MENU))
51
55
  # When we try to go to the last page, we create a new terminal instead
52
56
  @gtk_notebook.signal_connect_after("switch-page") do |notebook, page, page_num|
53
- if page_num == (@gtk_notebook.n_pages - 1)
54
- @gtk_notebook.insert_page(page_num, new_terminal)
55
- @gtk_notebook.page = page_num
56
- end
57
+ add_new_terminal if page_num == (@gtk_notebook.n_pages - 1)
57
58
  end
58
59
  @gtk_notebook.set_size_request(0, Config[:terminals_height])
59
60
  end
@@ -69,6 +70,46 @@ module VimMate
69
70
  def add_expander_signal(&block)
70
71
  @expander_signal << block
71
72
  end
73
+
74
+ # Set the focus to the current terminal
75
+ def focus_terminal
76
+ page = @gtk_notebook.get_nth_page(@gtk_notebook.page)
77
+ page.has_focus = true if page
78
+ end
79
+
80
+ # Add a new terminal at the left of the tab bar.
81
+ def add_new_terminal
82
+ page_num = @gtk_notebook.n_pages - 1
83
+ @gtk_notebook.insert_page(page_num, new_terminal)
84
+ @gtk_notebook.page = page_num
85
+ end
86
+
87
+ # Deletes terminal with number *page_num*, defaults to current page number.
88
+ def delete_current_terminal
89
+ page = @gtk_notebook.get_nth_page(@gtk_notebook.page)
90
+ prev_terminal
91
+ Process.kill 'HUP', page.pid
92
+ end
93
+
94
+ # Switch the next (right) terminal, if there exists one. Otherwise start
95
+ # again with the first terminal on the left.
96
+ def next_terminal
97
+ if @gtk_notebook.page < @gtk_notebook.n_pages - 2
98
+ @gtk_notebook.next_page
99
+ else
100
+ @gtk_notebook.page = 0
101
+ end
102
+ end
103
+
104
+ # Switch the previous (left) terminal, if there exists one. Otherwise start
105
+ # with again with the last terminal on the right.
106
+ def prev_terminal
107
+ if @gtk_notebook.page > 0
108
+ @gtk_notebook.prev_page
109
+ else
110
+ @gtk_notebook.page = @gtk_notebook.n_pages - 2
111
+ end
112
+ end
72
113
 
73
114
  private
74
115
 
@@ -104,7 +145,7 @@ module VimMate
104
145
  gtk_terminal.signal_connect("window-title-changed") do |terminal|
105
146
  @gtk_notebook.set_tab_label_text(terminal, terminal.window_title)
106
147
  end
107
- gtk_terminal.fork_command
148
+ gtk_terminal.pid = gtk_terminal.fork_command
108
149
  gtk_terminal.feed_child(Config[:terminals_autoexec])
109
150
  gtk_terminal.show
110
151
  gtk_terminal
@@ -24,6 +24,6 @@ SOFTWARE.
24
24
  module VimMate
25
25
 
26
26
  # VimMate's version
27
- VERSION = "0.6.3"
27
+ VERSION = "0.6.4"
28
28
  end
29
29
 
@@ -42,6 +42,8 @@ module VimMate
42
42
  @gtk_socket.signal_connect("destroy") do
43
43
  Gtk.main_quit
44
44
  end
45
+ @gtk_socket.can_focus = true
46
+ @gtk_socket.has_focus = true
45
47
  @vim_started = false
46
48
  end
47
49
 
@@ -79,6 +81,12 @@ module VimMate
79
81
  end
80
82
  self
81
83
  end
84
+
85
+ # Set the focus to Vim
86
+ def focus_vim
87
+ @gtk_socket.can_focus = true
88
+ @gtk_socket.has_focus = true
89
+ end
82
90
  end
83
91
  end
84
92
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: VimMate
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.3
7
- date: 2007-08-20 00:00:00 -04:00
6
+ version: 0.6.4
7
+ date: 2007-09-05 00:00:00 -04:00
8
8
  summary: VimMate is a graphical add-on to Vim with IDE-like features.
9
9
  require_paths:
10
10
  - lib