目录
Neovim出现的原因
- neovim代码库不需要向后兼容,方便开发维护
- 解决vim插件编写困难,特别是异步操作
- 解决vim插件编写困难,不再要求插件开发者需要熟悉vimscript
- 默认配置适应现代开发需求
- 更容易增加新功能
优化点
- 重构vim代码库,使用统一编码风格
- 放弃对旧系统的支持
- 适应现代开发的默认配置
- 提供丰富的查看开发API,例如python,lua,javascript等
- 支持与外部程序的通信
安装
1.源代码安装
由于需要github支持,在国内不容易安装
bash
#1.安装
make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/neovim"
make install
export PATH="$HOME/neovim/bin:$PATH"
#2.卸载
cmake --build build/ --target uninstall
2.管理包安装
安装的版本比较低
bash
#1.安装neovim
sudo apt install -y neovim
3.下载安装包安装
推荐这种方式安装
bash
#1.根据操作系统下载安装包
https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-download
#2.解压
tar -xf nvim-linux64.tar.gz
#3.移动到安装位置
sudo mv nvim-linux64 /opt/
#4.设置环境变量
sudo vim /etc/profile
export PATH="/opt/nvim-linux64/bin/bin:$PATH"
#5.环境变量起作用
source /etc/profile
配置
bash
#遵守XDG基本目录结构
~/.config/nvim/init.vim 对应于 ~/.vimrc
~/.config/nvim 对应于 ~/.vim/
#查看默认设置
:help nvim-defaults
运行
bash
#1.运行neovim
nvim
#2.实现neovim对python3的支持
#启用功能不需要重新编译
python3 -m pip install neovim
健康检查
bash
#1.健康检查
:checkhealth
#2.解决没有剪切板
sudo apt install xclip
#3.WERNING Missing "neovim" npm(or yarn,pnpm) package.
npm install -g neovim
#4.WARNING ruby and gem must be in $PATH
cd $HOME
sudo apt-get update
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 3.0.1
rbenv global 3.0.1
ruby -v
gem install bundler
rbenv rehash
#5.WARNING "Neovim::Ext" cpan module is not installed
sudo apt install -y cpanminus
sudo cpanm -n Neovim::Ext
sudo cpanm -n App::cpanminus
#6.WARNING Can't write to /usr/local/share/perl/5.34.0 and /usr/local/bin: Install modules to /home/lei/perl5
ADVICE:
To turn offf this warning, you have to do one of the following:
run me as a root or with --sudo option (to install to /usr/local/share/perl/5.34.0 and /usr/local/bin)
Configure local::lib in your existing shell to set PERL_MM_OPT etc.
Install local::lib by running the following commands
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#选择最后一种方法
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
Oni
使用vscode,而不要使用Oni