
从0带你安装Astrovim
安装部署AstroNvim
前提
首先要有科学上网环境,如果没有,请看我另一篇教程。
安装前置
官网的前置:
Requirements
- Nerd Fonts (Optional with manual intervention: See Recipes/Customizing Icons) [1]
- Neovim v0.9+ (Not including nightly)
- Tree-sitter CLI (Note: This is only necessary if you want to use
auto_install
feature with Treesitter)- **A clipboard tool is necessary for the integration with the system clipboard (see **
:help clipboard-tool
for supported solutions)- **Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) **[2]
- Optional Requirements:
- ripgrep - live grep telescope search (
<Leader>fw
)- lazygit - git ui toggle terminal (
<Leader>tl
or<Leader>gg
)- go DiskUsage() - disk usage toggle terminal (
<Leader>tu
)- bottom - process viewer toggle terminal (
<Leader>tt
)- Python - python repl toggle terminal (
<Leader>tp
)- Node - Node is needed for a lot of the LSPs, and for the node repl toggle terminal (
<Leader>tn
)
这里我们不全部安装,只安装必需的,Nerd Fonts 字体,Neovim9.0+,Tree-sitter CLI,ripgrep,lazygit。
NerdFonts
进入下载页面,找到喜欢的字体,将字体压缩包上传至服务器文件夹(/usr/share/fonts/nerd),
#解压
tar -zxvf F**.tar.gz
#更改文件夹权限
sudo chmod -R 777 /usr/share/fonts/nerd
cd /usr/share/fonts/nerd
# 如果提示 mkfontscale: command not found
# 在Ubuntu下运行如下命令
# sudo apt-get install ttf-mscorefonts-installer
# 在cent os下运行如下命令
# yum install mkfontscale
sudo mkfontscale
sudo mkfontdir
# 如果提示 fc-cache: command not found
# 在Ubuntu下运行如下命令
# sudo apt-get install fontconfig
# 在cent os下运行如下命令
# yum install fontconfig
sudo fc-cache -fv
#最后重启
sudo reboot
#使用fc-list观察是不是存在已安装的字体
fc-list
Neovim9.0+
进入下载界面,按照官网给出的安装方式进行安装即可,按照如下命令行:
Download nvim-linux64.tar.gz
tar -zxvf nvim-linux64.tar.gz
cd /usr/bin/
ln -s ~/nvimm/nvim-linux64/bin/nvim nvim
nvim
Tree-sitter CLI
安装命令:
npm install tree-sitter-cli
ripgrep
apt-get install ripgrep
lazygit
直接按照官网文档上来就可以:
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
安装AstroNvim
本文基于Ubantu,其他系统可以同时参考本篇和官方文档,大同小异。
备份
mv ~/.config/nvim ~/.config/nvim.bak
清理
mv ~/.local/share/nvim ~/.local/share/nvim.bak
mv ~/.local/state/nvim ~/.local/state/nvim.bak
mv ~/.cache/nvim ~/.cache/nvim.bak
克隆
git clone --depth 1 https://github.com/AstroNvim/template ~/.config/nvim
rm -rf ~/.config/nvim/.git
完成
nvim ---执行这一步会自动读取配置文件,然后进行配置文件的安装,所以最好有科学上网的环境
完结撒花,有问题可以留言讨论,至于使用可以看下一篇。
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 Lino
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果