问题
On a new windows 7 build vim commands don't actually run, but gvim echo's the command attempted to run.
in vim the command :!dir
opens a vimrun.exe terminal and shows the following:
C:\WINDOWS\system32\cmd.exe --login -c "dir"
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\USERNAME>
The window sits like this, until i type exit
and return control back to vim.
C:\Users\USERNAME>exit
Hit any key to close this window...
How can i have vim run commands like this on windows 7? I had no issues on windows xp previously.
It effects multiple programs such as diff.exe and others.
Additional info is it's a recently compiled version of vim with python and ruby support built in.
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 18 2013 13:15:06)
MS-Windows 32-bit GUI version with OLE support
Compiled by J4ROCH@ACEINA
Huge version with GUI.
Thanks in advance,
回答1:
The --login -c
arguments passed to cmd.exe
are wrong. It has to be /c
. Something is changing the 'shellcmdflag'
. Also, that Vim 7.4 version should wrap the dir
command in parentheses, not quotes, so the 'shellxquote'
flag is off, too.
This is either due to an explicit misconfiguration (in ~/.vimrc
, or by a plugin), or because the various heuristics that Vim uses to detect the correct shell environment fail. Check with
:verbose set shell? shellcmdflag? shellxquote?
and read :help 'shell'
to learn more about the heuristics.
来源:https://stackoverflow.com/questions/20910924/gvim-on-windows-7-vimrun-exe-doesnt-run-command