Vim 腳本 Gundo 無法正常運作

Vim 腳本 Gundo 無法正常運作

我的 vim 在使用“python”支援時遇到問題。

我在 Ubuntu 11.04 中安裝了 gnome-vim,理論上它有「python」支持,但如果我安裝病原軍多,當我按F5時,會顯示以下訊息:

Error detected while processing /home/perseus/Coding/LinuxConfigFiles/.vim/bundle/gundo/autoload/gundo.vim:
line   22:
E837: This Vim cannot execute :py3 after using :python
line   30:
E121: Undefined variable: s:has_supported_python
E15: Invalid expression: !s:has_supported_python
Error detected while processing function gundo#GundoToggle..<SNR>26_GundoToggle..<SNR>26_GundoOpen:
line    2:
E121: Undefined variable: s:has_supported_python
E15: Invalid expression: s:has_supported_python == 2
line   10:
E121: Undefined variable: s:has_supported_python
"__Gundo_Preview__" [New File]
Error detected while processing function gundo#GundoToggle..<SNR>26_GundoToggle..<SNR>26_GundoOpen..<SNR>26_GundoRenderGraph:
line    1:
E121: Undefined variable: s:has_supported_python
E15: Invalid expression: s:has_supported_python == 2
Error detected while processing function gundo#GundoToggle..<SNR>26_GundoToggle..<SNR>26_GundoOpen..<SNR>26_GundoRenderPreview:
line    1:
E121: Undefined variable: s:has_supported_python
E15: Invalid expression: s:has_supported_python == 2

誰知道怎麼修它?

答案1

為了讓它正常工作(支援 python3),您需要將以下變數新增至您的.vimrc

let g:gundo_prefer_python3 = 1

否則你會遇到以下錯誤:“E117:未知功能:gundo#GundoShow”

答案2

我假設有一個類似 Debian 的環境

  1. 得到vim來源。我使用mercurial下載了原始碼。如果您沒有安裝它:

    apt-get 安裝 Mercurial

    然後,使用 Mercurial 取得原始碼

    hg clone https://vim.googlecode.com/hg/ ~/vimpy2.7

  2. 安裝了 python 2.7 和 python 函式庫

    apt-get 安裝 python python-dev

  3. 使用以下命令編譯

    cd ~/vimpy2.7
    ./configure --with-features=huge --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config

  4. 安裝

    進行
    安裝

觀察:必須是 root 才能運行make install

如果一切正常,vim 必須安裝在 /usr/local/vim 中。輸入 ./usr/local/vim,在 vim 中輸入:version並驗證+python

答案3

我和你有同樣的錯誤。

顯然,一個最近的變化Gundo 啟用 Python 3 支援已經破壞了它。

斯特拉辛賈·馬爾科維奇已經分岔了 Steve Losh 的倉庫並且請求修復。至少在史蒂夫修復錯誤之前,我建議你使用Strahinja 的倉庫相反,它對我來說效果很好。

相關內容