2024-安装部署AstroNvim

安装部署AstroNvim

文章首发于博客lino.chat

前提

首先要有科学上网环境,如果没有,请看我另一篇教程。

安装前置

官网的前置:

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 ---执行这一步会自动读取配置文件,然后进行配置文件的安装,所以最好有科学上网的环境

完结撒花,有问题可以留言讨论,至于使用可以看下一篇。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值