比如在 vim 中执行 python 代码可以这么定义快捷键
map <silent> <F5> :call Compile()<CR>
function! Compile()
exec "w"
if &filetype == "python"
exec "!python %"
endif
endfunc
但是如果想在 windows 下执行 powershell 呢? 我尝试过这样
if &filetype == "ps1"
exec "!powershell %"
endif
也尝试过这样
if &filetype == "ps1"
exec "!%"
endif
但是都失败了,具体该怎么写规则呢?