Skip to content

Instantly share code, notes, and snippets.

@AlanJui
Last active June 21, 2024 00:54
Show Gist options
  • Save AlanJui/9f4b278858eb0e55ebba20a808722308 to your computer and use it in GitHub Desktop.
Save AlanJui/9f4b278858eb0e55ebba20a808722308 to your computer and use it in GitHub Desktop.
使用原始碼安裝 Neovim 0.10

使用原始碼安裝 Neovim 0.10

【問】:如何使用 Neovim 的原始程式碼安裝 Neovim 0.10?

使用者在 Windows 10 作業系統,安裝了 WSL 2 for Ubuntu,想用 Neovim Source Code 安裝 Neovim 0.10 該怎麼做?

Neovim 在 GitHub 的網址:git@github.com:neovim/neovim.git

【答】

在 Windows 10 的 WSL 2 for Ubuntu 的 Linux 作業平台,可用以下方法,完成 Neovim 0.10 之安裝:

  1. 更新作業系统及安装作業所需之套件: 打開 WSL 終端機,更新作業系統套件,及安装構建(Build)作業所需之 Neovim 套件(原始碼編譯、程式館模組):

    sudo apt update
    sudo apt upgrade -y
    sudo apt install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl doxygen
  2. 自 GitHub 下載 Neovim 原始程式碼: 使用 git 下載 Neovim 原始程式碼:

    cd ~/tmp
    git clone https://github.com/neovim/neovim.git
    cd neovim
  3. 切換到 0.10 分支: 透過 checkout 指令,切換到 0.10 版本所屬分支:

    git checkout release-0.10
  4. 構建 Neovim: 在終端機使用以下指令,啟動構建作業,完成 Neovim 原始程式碼之編譯工作:

    make CMAKE_BUILD_TYPE=Release
  5. 安装 Neovim: 將構建作業産出之 Neovim 執行檔,安装到作業系统中:

    sudo make install
  6. 驗證安装結果: 透過以下指令,借由 Neovim 之版本查閱功能是否可正常執行,用以驗證 Neovim 已完成安裝:

    nvim --version

上述步骤若能完成無誤,使用者應該已能在 WSL 2 for Ubuntu 上使用 Neovim 0.10 了。


【問】:如何解除安裝

【答】:

以下的 Neovim 解除安裝作業程序,適用於透過 Neovim Source Code 及使用指令 sudo make install 安裝之狀況。

  1. 刪除已安裝之檔案
sudo rm /usr/local/bin/nvim
sudo rm -rf /usr/local/share/nvim/
sudo rm -rf /usr/local/lib/nvim/
sudo rm /usr/local/share/man/man1/nvim.1
  1. 刪除原始碼檔案
cd ~/tmp/neovim  # 假设你在用户主目录下克隆了 neovim
sudo rm -rf build/
  1. 刪除編譯原始碼的建置工具
cd ~/neovim  # 假设你在用户主目录下克隆了 neovim
sudo rm -rf build/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment