简体   繁体   English

VIM获得E488:尾随字符错误

[英]VIM get E488: Trailing characters error

I'd like to implement a function that can get VirtualEnv name from a file named .env and then execute CondaChangeEnv VirtualEnvName. 我想实现一个功能,该功能可以从名为.env的文件中获取VirtualEnv名称,然后执行CondaChangeEnv VirtualEnvName。

function! SetVirtualEnv()
    let cmd = "sed -n '1,1p' ". $PWD . "/.env"
    let result = 'CondaChangeEnv ' . system(cmd)
    if !v:shell_error
        exe result
    endif
endfunction
autocmd FileType python call SetVirtualEnv()

But, it seems like something is wrong 但是,好像出了点问题

E488: Trailing characters: CondaChangeEnv G

G is the content of .env and generated by echo -n 'G' >> .env G是.env的内容,由echo -n 'G' >> .env

So, anybody can help me? 那么,有人可以帮助我吗? Thanks in advance :) 提前致谢 :)

If you check the source codes of your plugin: 如果您检查插件的源代码:

command! CondaChangeEnv call s:CondaChangeEnv()

The CondaChangeEnv command expects no parameter, but you passed a G to it. CondaChangeEnv命令不需要任何参数,但是您向其传递了G That's the cause of your problem. 那就是你问题的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM