Permalink
Browse files

add nerdtree keybindings

  • Loading branch information...
1 parent 9ebb49a commit 6904f666667a0234f1cbc5e43f784943b6f33deb Adam Vaughan committed Dec 14, 2011
Showing with 22 additions and 2 deletions.
  1. +22 −2 src/MacVim/MMFileBrowserController.m
View
24 src/MacVim/MMFileBrowserController.m
@@ -300,6 +300,8 @@ - (BOOL) isFlipped {
@end
#define ENTER_KEY_CODE 36
+#define TAB_KEY_CODE 48
+#define ESCAPE_KEY_CODE 53
#define LEFT_KEY_CODE 123
#define RIGHT_KEY_CODE 124
#define DOWN_KEY_CODE 125
@@ -394,7 +396,7 @@ - (void)keyDown:(NSEvent *)event {
[self sendSelectionChangedNotification];
}
return;
- } else {
+ } else if (event.keyCode != TAB_KEY_CODE && event.keyCode != ESCAPE_KEY_CODE) {
switch ([[event.characters uppercaseString] characterAtIndex:0]) {
case 'H':
LEFT_KEY_CHAR = [NSString stringWithFormat:@"%C", 0xf702];
@@ -412,9 +414,27 @@ - (void)keyDown:(NSEvent *)event {
UP_KEY_CHAR = [NSString stringWithFormat:@"%C", 0xf700];
event = [self keyEventWithEvent:event character:UP_KEY_CHAR code:UP_KEY_CODE];
break;
+ case 'T':
+ [(MMFileBrowserController *)[self delegate] openSelectedFilesInCurrentWindowWithLayout:MMLayoutTabs];
+ event = nil;
+ break;
+ case 'I':
+ [(MMFileBrowserController *)[self delegate] openSelectedFilesInCurrentWindowWithLayout:MMLayoutHorizontalSplit];
+ event = nil;
+ break;
+ case 'S':
+ [(MMFileBrowserController *)[self delegate] openSelectedFilesInCurrentWindowWithLayout:MMLayoutVerticalSplit];
+ event = nil;
+ break;
+ default:
+ event = nil;
+ break;
}
}
- [super keyDown:event];
+
+ if (event != nil) {
+ [super keyDown:event];
+ }
}
- (NSMenu *)menuForEvent:(NSEvent *)event {

0 comments on commit 6904f66

Please sign in to comment.