On Sun, Mar 01, 2015 at 08:57:24PM +0100, Ingo Karkat wrote: > haslocaldir() > The result is a Number, which is 1 when the current > window has set a local path via :lcd, and 0 otherwise.
Thanks, Ingo, I didn't see that.
Updated version:
if !exists('+acd') || !&acd
if haslocaldir()
cd -
lcd -
elseif getcwd() ==# "/some/path"
cd -
endif
endif
Comments in the code might need some adjustment and I'm still not sure
about escaping.
Regards,
xaizek
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r eaf81729ef02 src/main.c
--- a/src/main.c Tue Feb 10 20:03:46 2015 +0100
+++ b/src/main.c Sun Mar 01 22:59:17 2015 +0200
@@ -3914,6 +3914,7 @@
int i;
char_u *inicmd = NULL;
char_u *p;
+ char_u *cdp;
char_u *cwd;
if (filec > 0 && filev[0][0] == '+')
@@ -3935,7 +3936,7 @@
vim_free(cwd);
return NULL;
}
- p = vim_strsave_escaped_ext(cwd,
+ cdp = vim_strsave_escaped_ext(cwd,
#ifdef BACKSLASH_IN_FILENAME
"", /* rem_backslash() will tell what chars to escape */
#else
@@ -3943,12 +3944,11 @@
#endif
'\\', TRUE);
vim_free(cwd);
- if (p == NULL)
+ if (cdp == NULL)
return NULL;
ga_init2(&ga, 1, 100);
ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");
- ga_concat(&ga, p);
- vim_free(p);
+ ga_concat(&ga, cdp);
/* Call inputsave() so that a prompt for an encryption key works. */
ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call
inputsave()|endif|");
@@ -3985,7 +3985,11 @@
/* Switch back to the correct current directory (prior to temporary path
* switch) unless 'autochdir' is set, in which case it will already be
* correct after the :drop command. */
- ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|cd -|endif<CR>");
+ ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|cd
-|"
+ "lcd -|elseif getcwd() ==# \"");
+ ga_concat(&ga, cdp);
+ ga_concat(&ga, (char_u *)"\"|cd -|endif|endif<CR>");
+ vim_free(cdp);
if (sendReply)
ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>");
pgp62Tkn_9rHv.pgp
Description: PGP signature
