安裝neovim
下載最新版本:https://github.com/neovim/neovim/releases/tag/stable
下載成功後,無須安裝,解壓安裝包,放入合適的目錄中,比如 C:\nvim-win64中。
NeoVim有兩個啓動程序,分別是nvim-qt.exe和nvim.exe,前者是基於Gui的客戶端,後者則基於終端Terminal,解壓之後,最好將bin目錄配置到系統的環境變量:C:\nvim-win64\nvim-win64\bin ,如此,我們就可以在系統的任意位置啓動NeoVim。
運行健康檢查:checkhealth
根據警告和提示進行相應配置
設置init.vim文件
"C:\Users{username}\AppData\Local\nvim\init.vim"
安裝插件管理工具vim-plug
安裝要求:https://github.com/junegunn/vim-plug/wiki/requirements
Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
安裝python3
直接在命令行上輸入python3,如果沒有安裝,會打開微軟商店進行安裝。
配置init.vim文件
" Plugins will be downloaded under the specified directory.
call plug#begin('C:\Users\{username}\AppData\Local\nvim-data\plugged')
" Declare the list of plugins.
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
# 配置python3路徑
let g:python3_host_prog = 'C:\Users\{username}\AppData\Local\Microsoft\WindowsApps\python3.exe'
第一個NeoVim插件
第一個NeoVim插件我們從主題入手,
修改init.vim配置:
" Plugins will be downloaded under the specified directory.
call plug#begin('C:\Users\{username}\AppData\Local\nvim-data\plugged')
" Declare the list of plugins.
Plug 'navarasu/onedark.nvim'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
# 配置python3路徑
let g:python3_host_prog = 'C:\Users\{username}\AppData\Local\Microsoft\WindowsApps\python3.exe'
運行安裝插件命令
在neovim的命令行模式下運行:
:PlugInstall
如果報:PlugInstall threw "not an editor command" on Windows,那就是沒有設置對init.vim的路徑,可以運行:checkhealth根據提示進行配置。
參考
https://www.cnblogs.com/v3ucn/p/17070289.html
https://github.com/junegunn/vim-plug
https://github.com/junegunn/vim-plug/wiki/tutorial
https://github.com/navarasu/onedark.nvim
https://github.com/neovim/neovim
注意事項
請將路徑中的{username}替換爲系統登錄的用戶名