vim函数系统参数无效
我试图使用下面的vim函数在windows上运行我的sas,但我总是收到错误消息说系统参数无效 能找个vim专家帮我吗 myy sas安装在: C:\Program Files\SAS\SAS\9.1\SAS.exevim函数系统参数无效,vim,system,sas,Vim,System,Sas,我试图使用下面的vim函数在windows上运行我的sas,但我总是收到错误消息说系统参数无效 能找个vim专家帮我吗 myy sas安装在: C:\Program Files\SAS\SAS\9.1\SAS.exe function! RunSASonCurrentFile() " Make sure this is a SAS program file (ends with .sas) so that " we don't run SAS on a log file or s
function! RunSASonCurrentFile()
" Make sure this is a SAS program file (ends with .sas) so that
" we don't run SAS on a log file or similar.
:let checkSASpgm=match(expand("%"),"\.sas")
" If we did not match .sas in the file name, end this function with
" a warning msg
if checkSASpgm==-1
:echo "*** Current file is not a SAS program. SAS run has been canceled."
:return
endif
" Ask user if we want to run SAS so we don't accidentally run it.
:let l:answer = input("Run SAS? Y/N ")
:if (l:answer == "Y" || l:answer == "y")
" If file has been modified, save it before running
if exists(&modified)
:echo "*** Saving modified file before SAS run..."
:w
endif
" Run SAS on path/file name (modify to your location of sas)
:echo "*** Running SAS..."
"let returntxt = system("/usr/local/bin/sas -nodms " . shellescape(expand("%:p")))
" The following may work for your Windows system. Comment the line above and uncomment
" the two lines below and make them one long line.
let returntxt = system("\"" . shellescape("C:\\Program\ Files\\SAS\\SAS\9.1\\sas.exe")
". "\ -nosplash" . "\ -sysin" . "\ " . shellescape(expand("%:p")) . "\"")
" Shows the return messages from the SAS commandline (may be useful
" if no log produced)
:echo "*** SAS commandline: " . returntxt
:call LoadSASLogList()
:else
:echo "SAS Run cancelled."
" endif for the Run SAS? check
:endif
endfunction
如果这是函数的确切文本,我认为您在
let returntxt=system(\“”.shellescape(“C:\\Program\Files\\SAS\\SAS\9.1\\SAS.exe”)行中的SAS和9.1之间缺少了一秒钟
如果这是函数的确切文本,我认为您在SAS和9.1之间缺少了一秒钟,让returntxt=system(\”.shellescape(“C:\\Program\Files\\SAS\\SAS\9.1\\SAS.exe”)
Vim patch 7.3.443更改了shell转义的行为(由于神秘的Windows shell转义规则,这仍然是一个问题点)。然而,在之前,如果命令行包含(本身带引号的)可执行文件,并且其中包含空格,则必须将整个命令行用双引号括起来,现在必须删除这些空格。请尝试以下操作:
let returntxt = system(shellescape('C:\Program Files\SAS\SAS\9.1\sas.exe') . ' -nosplash -sysin ' . shellescape(expand('%:p')))
这还可以通过使用单引号字符串避免一些额外的转义。Vim补丁7.3.443更改了shell转义的行为(由于神秘的Windows shell转义规则,它仍然是一个问题点)。然而,在此之前,如果命令行中包含(本身被引用),则必须将整个命令行用双引号括起来可执行文件中有空格,现在必须删除这些空格。请尝试以下操作:
let returntxt = system(shellescape('C:\Program Files\SAS\SAS\9.1\sas.exe') . ' -nosplash -sysin ' . shellescape(expand('%:p')))
这也避免了使用单引号字符串进行额外转义。我试图更正它。不起作用。感谢您回答我。它表示System(..)的argagument无效。恐怕我传递了一个错误的字符串。我试图更正它。不起作用。感谢您回答我。它表示System(..)的argagument无效1.恐怕我传错了。