Comments (4)
That whole build_drop_cmd()
function is a big mess wich dynamically concates some VimScript functionality to perform the actual work. It could benefit from re-doing the whole thing perhaps in VimScript, so it is easier to make adjustments.
Anyhow, I think the following patch should fix the problem:
diff --git a/src/clientserver.c b/src/clientserver.c
index 340add315..f1987743b 100644
--- a/src/clientserver.c
+++ b/src/clientserver.c
@@ -608,7 +608,7 @@ build_drop_cmd(
// Call inputsave() so that a prompt for an encryption key works.
ga_concat(&ga, (char_u *)
- "<CR>:if exists('*inputsave')|call inputsave()|endif|");
+ "<CR><C-\\><C-N>:if exists('*inputsave')|call inputsave()|endif|");
if (tabs)
ga_concat(&ga, (char_u *)"tab ");
ga_concat(&ga, (char_u *)"drop");
@@ -652,7 +652,13 @@ build_drop_cmd(
// endif
// endif
ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|");
+#ifdef MSWIN
+ // undo the effect of 'shellslash', / shouldn't be allowed to be in any valid
+ // path on Windows, so replacing '/' by '\\' should be safe.
+ ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd()->tr('/','\') ==# '");
+#else
ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# '");
+#endif
ga_concat(&ga, cdp);
ga_concat(&ga, (char_u *)"'|cd -|endif|endif<CR>");
vim_free(cdp);
from vim.
Yes, this fixes the problem. In the patch you need to escape the backslash ("... tr('/','\\') ..."
), but still.
On the other hand, it may be more explicit and easier to comprehend to temporarily reset the 'shellslash' setting (if it exists) for the duration of the operation, as is already done with 'wildignore'.
from vim.
On the other hand, it may be more explicit and easier to comprehend to temporarily reset the 'shellslash' setting (if it exists) for the duration of the operation, as is already done with 'wildignore'.
Yeah, but it is already quite complicated and one would need to test that 'shellslash' exists. I think tr()
is easier.
Yes, this fixes the problem. In the patch you need to escape the backslash ("... tr('/','\') ..."), but still.
No, I don't think so. It errors out otherwise: :set shellslash|:cd c:\temp|echo getcwd()->tr('/','\\')
: E475: invalid argument: /
from vim.
To my understaing the Vim snippet tr('/','\')
is fine, it is the C string literal that requires escaping:
ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd()->tr('/','\\') ==# '");
so you can actually get
cd -|lcd -|elseif getcwd()->tr('/','\') ==# '
sent to the server.
from vim.
Related Issues (20)
- `interpolated string` has inconsistent handling of containers HOT 3
- [vim9script] unexpected error accessing items imported through symbolic linked directory HOT 5
- The behavior when specifying 2 for `setcellwidths` is different between the GUI version and the CUI version.
- Add multiple Sessionx support HOT 8
- runtime directories autoload/cargo and autoload/rust are missing from Makefile output
- [vim9script] add `test_override('defcompile', 1)` option
- .astro file extension is not recognised HOT 1
- Error detected while processing... when startup vim with -u option HOT 2
- gvimrc is not sourced from `~/.config/vim/` HOT 2
- ci.yml: test result summary is confusing HOT 2
- GVim 9.1.0085 and later jump the cursor when scrolling HOT 2
- Whole-page scrolling is off by one line HOT 10
- [vim9script] on Windows import in a script sourced from a buffer fails
- narrow character + emoji variation results in wrong(?) width (displays incorrectly in kitty)
- [vim9script] Can not change the value of an exported variable under an autoload directory HOT 3
- err: Test_terminal_vt420 HOT 3
- err: Test_debug_with_lambda & Test_debug_running_out_of_lines HOT 3
- One issue with XDG_CONFIG_HOME/vim/vimrc after merging, using symlinks #14182 HOT 7
- E117: Unknown function: strptime HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim.