@@ -1298,31 +1298,39 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item
1298
1298
return YES ;
1299
1299
}
1300
1300
1301
- // / Open a new Vim window, potentially taking from cached (if preload is used).
1302
- // /
1303
- // / @param mode Determine whether to use clean mode or not. Preload will only
1304
- // / be used if using normal mode.
1305
- // /
1306
- // / @param activate Activate the window after it's opened.
1307
- - (void )openNewWindow : (enum NewWindowMode)mode activate : (BOOL )activate
1301
+ - (void )openNewWindow : (enum NewWindowMode)mode activate : (BOOL )activate extraArgs : (NSArray *)extraArgs
1308
1302
{
1309
1303
if (activate)
1310
1304
[self activateWhenNextWindowOpens ];
1311
1305
1312
1306
// A cached controller requires no loading times and results in the new
1313
1307
// window popping up instantaneously. If the cache is empty it may take
1314
1308
// 1-2 seconds to start a new Vim process.
1315
- MMVimController *vc = (mode == NewWindowNormal) ? [self takeVimControllerFromCache ] : nil ;
1309
+ MMVimController *vc = (mode == NewWindowNormal && extraArgs == nil ) ? [self takeVimControllerFromCache ] : nil ;
1316
1310
if (vc) {
1317
1311
[[vc backendProxy ] acknowledgeConnection ];
1318
1312
} else {
1319
1313
NSArray *args = (mode == NewWindowNormal) ? nil
1320
1314
: (mode == NewWindowClean ? @[@" --clean" ]
1321
1315
: @[@" --clean" , @" -u" , @" NONE" ]);
1316
+ if (extraArgs != nil ) {
1317
+ args = [args arrayByAddingObjectsFromArray: extraArgs];
1318
+ }
1322
1319
[self launchVimProcessWithArguments: args workingDirectory: nil ];
1323
1320
}
1324
1321
}
1325
1322
1323
+ // / Open a new Vim window, potentially taking from cached (if preload is used).
1324
+ // /
1325
+ // / @param mode Determine whether to use clean mode or not. Preload will only
1326
+ // / be used if using normal mode.
1327
+ // /
1328
+ // / @param activate Activate the window after it's opened.
1329
+ - (void )openNewWindow : (enum NewWindowMode)mode activate : (BOOL )activate
1330
+ {
1331
+ return [self openNewWindow: mode activate: activate extraArgs: nil ];
1332
+ }
1333
+
1326
1334
- (IBAction )newWindow : (id )sender
1327
1335
{
1328
1336
ASLogDebug (@" Open new window" );
0 commit comments