Skip to content

Commit

Permalink
Merge pull request #1310 from ychin/macvim-file-close-terminal
Browse files Browse the repository at this point in the history
Add File.Close support for terminal which also makes it work for Cmd-W
  • Loading branch information
ychin committed Oct 9, 2022
2 parents 09d44aa + f8462bd commit bb4c48a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions runtime/menu.vim
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ if has("gui_macvim")
an <silent> 10.330 &File.Close\ Window<Tab>:qa :conf qa<CR>
tln <silent> 10.330 &File.Close\ Window<Tab>:qa <C-W>:conf qa<CR>
an <silent> 10.332 &File.Close<Tab>:q :conf q<CR>
tln <silent> 10.332 &File.Close<Tab>:q <C-W>:conf q<CR>
an <silent> 10.341 &File.Save\ All :browse conf wa<CR>
an 10.350 &File.Save\ As…<Tab>:sav :browse confirm saveas<CR>
else
Expand Down
13 changes: 12 additions & 1 deletion src/MacVim/MMAppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
#endif


@interface MMAppController : NSObject <MMAppProtocol, NSUserInterfaceItemSearching> {
@interface MMAppController : NSObject <
MMAppProtocol,
NSUserInterfaceItemSearching
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
, NSMenuItemValidation
#endif
> {
NSConnection *connection;
NSMutableArray *vimControllers;
NSString *openSelectionString;
Expand Down Expand Up @@ -63,6 +69,11 @@
- (void)refreshAllResizeConstraints;
- (void)refreshAllTextViews;

//
// NSMenuItemValidation
//
- (BOOL)validateMenuItem:(NSMenuItem *)item;

- (IBAction)newWindow:(id)sender;
- (IBAction)newWindowAndActivate:(id)sender;
- (IBAction)fileOpen:(id)sender;
Expand Down
8 changes: 8 additions & 0 deletions src/MacVim/MMAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,14 @@ - (void)refreshAllTextViews
}
}

- (BOOL)validateMenuItem:(NSMenuItem *)item
{
// For the actions defined in this class we do want them to always be
// enabled since they are usually app functionality and independent of
// each Vim's state.
return YES;
}

- (IBAction)newWindow:(id)sender
{
ASLogDebug(@"Open new window");
Expand Down

0 comments on commit bb4c48a

Please sign in to comment.