From c9087515165f84b5bda98d2e0df0b54c1272ca0f Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 10 Aug 2008 21:16:31 +0200 Subject: [PATCH] Change pwd if file is opening in an "unused" editor When opening a file from Finder, set the pwd to the directory the file resides in but only if the editor window is unused (e.g. it doesn't already have files open in it). --- src/MacVim/MMBackend.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index d399c8aa..c162655f 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -2269,8 +2269,10 @@ static NSString *MMSymlinkWarningString = BOOL openFiles = ![[args objectForKey:@"dontOpen"] boolValue]; int layout = [[args objectForKey:@"layout"] intValue]; - // Change to directory of first file to open, unless editing remotely. - if (openFiles && numFiles > 0 && ![args objectForKey:@"remoteID"]) { + // Change to directory of first file to open if this is an "unused" editor + // (but do not do this if editing remotely). + if (openFiles && numFiles > 0 && ![args objectForKey:@"remoteID"] + && (starting || [self unusedEditor]) ) { char_u *s = [[filenames objectAtIndex:0] vimStringSave]; vim_chdirfile(s); vim_free(s); -- 2.11.4.GIT