@@ -1298,31 +1298,39 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item
12981298 return YES ;
12991299}
13001300
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
13081302{
13091303 if (activate)
13101304 [self activateWhenNextWindowOpens ];
13111305
13121306 // A cached controller requires no loading times and results in the new
13131307 // window popping up instantaneously. If the cache is empty it may take
13141308 // 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 ;
13161310 if (vc) {
13171311 [[vc backendProxy ] acknowledgeConnection ];
13181312 } else {
13191313 NSArray *args = (mode == NewWindowNormal) ? nil
13201314 : (mode == NewWindowClean ? @[@" --clean" ]
13211315 : @[@" --clean" , @" -u" , @" NONE" ]);
1316+ if (extraArgs != nil ) {
1317+ args = [args arrayByAddingObjectsFromArray: extraArgs];
1318+ }
13221319 [self launchVimProcessWithArguments: args workingDirectory: nil ];
13231320 }
13241321}
13251322
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+
13261334- (IBAction )newWindow : (id )sender
13271335{
13281336 ASLogDebug (@" Open new window" );
0 commit comments