配置、編譯和安裝 Vim

配置、編譯和安裝 Vim

我已經安裝了 VIM,但我需要使用特定選項來編譯它:

In addition to the most commonly used features, the plugin
       requires: +python or +python3, +clientserver and +conceal.

卸載並使用這些選項重新編譯而不破壞任何內容的步驟是什麼?

答案1

當你編譯 vim 時,你可以傳遞 option/flag --with-features,例如:

--with-features=huge

這將確定安裝中包含哪些功能。所有功能的清單可以在這裡找到(http://vimdoc.sourceforge.net/htmldoc/various.html),並用一個字母指示該功能包含在哪個版本中:

Here is an overview of the features.
            The first column shows the smallest version in which
            they are included:
               T    tiny
               S    small
               N    normal
               B    big
               H    huge
               m    manually enabled or depends on other features
             (none) system dependent
            Thus if a feature is marked with "N", it is included
            in the normal, big and huge versions of Vim.

例如,如果您想要阿拉伯語功能,則必須具有--with-features=big

                            *+feature-list*

   *+ARP*       Amiga only: ARP support included

B  *+arabic*        |Arabic| language support

N  *+autocmd*       |:autocmd|, automatic commands

... etc

答案2

首先,你需要取得原始碼,最簡單的方法是透過 Vim 的水銀儲存庫;看vim.org了解詳情。

然後,您需要一個建置環境和開發者函式庫,尤其是所需的 Python 函式庫。這很大程度上取決於平台。在 Ubuntu / Debian 上,這很簡單

$ sudo apt-get build-dep vim-gnome

網路搜尋會告訴你更多。

若要使用這些功能進行編譯,請將它們傳遞給

$ ./configure --enable-pythoninterp --enable-python3interp

密切觀察其檢測輸出。

最後就可以編譯安裝了:

$ make
$ sudo make install

這將(在 Linux 上)將 Vim 安裝到/usr/local/bin/vim,因此它不會幹擾預設的/usr/bin/vim,並且您不需要卸載任何東西;只需確保前者在您的PATH.

答案3

配置、編譯和安裝 Vim

安裝所需的庫

sudo apt-get build-dep vim

從github下載最新的VIM版本,例如

mkdir -p ./git/vim; cd ./git/vim
git clone https://github.com/vim/vim

最實用的配置方法就是直接在裡面設定配置選項產生檔案。首先複製一份Makefile

cp ./src/Makefile ./src/Makefile.backup

如果您熟悉 git,則不需要最後一步,因為您可以使用 輕鬆恢復所有檔案的原始狀態,git clean -dfX或使用git restore Makefile.

如果您想編譯一個官方的釋放你必須結帳所謂的標籤。若要列出可用標籤,請鍵入git tag --list.要編譯這樣的版本,您必須簽出諸如 之類的標籤git checkout v9.0.1440。根據我的經驗,直接編譯所謂的文件是沒有錯誤的主分支(最新的源代碼)。

然後打開./src/Makefile然後取消註釋(刪除#)您想要編譯和安裝的行。

vi ./src/Makefile

去適應特徵你必須編輯該src/feature.h文件

vi ./src/feature.h

建議unix透過將其添加到configure命令中來進行基本選擇。

基本選擇是:

  • 微小的 - 幾乎沒有啟用任何功能,甚至沒有多個視窗
  • 小的 - 啟用的功能很少,盡可能基本
  • 普通的 - 預設選擇啟用的功能
  • 大的 - 啟用許多功能,盡可能豐富
  • 巨大的 - 啟用所有可能的功能

然後配置 vim 以應用您的設置

./configure --with-features=huge

之後只需編譯即可

make -j `nproc` # compile with max. number of processors

並安裝它

sudo make install

相關內容