1
我在我的.vimrc,我得到了here爲什麼這個Vim命令會擦除我終端上的所有字符?
function! SetExecutableBit()
let fname = expand("%:p")
checktime
execute "au FileChangedShell " . fname . " :echo"
silent !chmod a+x %
checktime
execute "au! FileChangedShell " . fname
endfunction
command! Xbit call SetExecutableBit()
當我運行:call SetExecutableBit()
這個功能,它按預期工作。但是當我運行:Xbit
時,所有角色都從我的角度消失(但不在Gvim中)。我已經在gnome-terminal和urxvt上重現了這一點。如果我嘗試用鼠標或ggVG
突出顯示某些文本,該文本將重新出現。
截圖:運行:Xbit
後
術語的截圖:
「之前」 的截圖
更新,因爲該錯誤與--noplugin
發生,但確實不發生與-u NONE
,它必須是東西在我的.vimrc文件:https://gist.github.com/dbb/5373175
不幸的是,':redraw'似乎並沒有做任何事情。另外,當我直接調用函數時(即':callSetExecutableBit()'),錯誤不會發生;只有當我運行命令':Xbit'時纔會調用該函數,因此即使重繪是問題, – Daniel
@丹尼爾肯定不是問題,但它可以解決問題。如果將它追加到命令定義中,會怎樣?':command!Xbit call SetExecutableBit() redraw' –
sidyll
對不起,我搞砸了,當我在函數的結尾使用'redraw!'的時候,它真的起作用了(我第一次忘了!) 它仍然讓我困惑,爲什麼它只發生在調用命令時。 – Daniel