VIM get E488:尾随字符错误
我想实现一个函数,该函数可以从名为.env的文件中获取VirtualEnv名称,然后执行CondaChangeEnv VirtualEnvNameVIM get E488:尾随字符错误,vim,Vim,我想实现一个函数,该函数可以从名为.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 end
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()
但是,似乎有什么不对劲
E488: Trailing characters: CondaChangeEnv G
G是.env的内容,由echo-n'G'>.env生成
有人能帮我吗?提前感谢:)如果您检查了插件的源代码:
command! CondaChangeEnv call s:CondaChangeEnv()
condachangeev
命令不需要任何参数,但您向其传递了一个G
。这就是你问题的原因。这是你的答案。任何解决方案都可以帮助我做到这一点,打开vim,然后在命令行模式下键入“:CondaChangeEnv G”