ubuntu-neovim(nvim)最新版本安装

Endless_daydream Lv4

安装

以下方法选一个即可。

ppa 安装

1
2
3
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install neovim

下载安装

https://github.com/neovim/neovim/releases 下载最新的linux zip压缩包

1
2
3
4
5
6
7
8
# 压缩
cd ~/Download
tar xvf nvim-linux64.tar.gz

cd nvim-linux64/bin
ln -s $(realpath nvim) /usr/local/bin/nvim # 或者其他位置

nvim # 验证是否可用

如果没加-s,创建成了硬连接会无法读取配置文件。

1
2
# 使得 ubuntu 的 select-editor 能找到 nvim
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim 100

Lazy-nvim

1
2
3
git clone https://github.com/LazyVim/starter ~/.config/nvim --depth 1

nvim # 打开就会开始下载lazy nvim的相关内容

字体

nerd-font

lazy nvim 的图标如果有显示问题,说明需要下载字体,这里用github讨论区 的一个脚本完成配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

declare -a fonts=(
# BitstreamVeraSansMono
# CodeNewRoman
# DroidSansMono
FiraCode
# FiraMono
# Go-Mono
# Hack
# Hermit
JetBrainsMono
# Meslo
# Noto
# Overpass
# ProggyClean
# RobotoMono
# SourceCodePro
# SpaceMono
# Ubuntu
# UbuntuMono
)

fonts_dir="${HOME}/.local/share/fonts"

if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi

echo -e "\e[0;32mScript:\e[0m \e[0;34mClonning\e[0m \e[0;31mNerdFonts\e[0m \e[0;34mrepo (sparse)\e[0m"
git clone --filter=blob:none --sparse git@github.com:ryanoasis/nerd-fonts
cd nerd-fonts

for font in "${fonts[@]}"; do
echo -e "\e[0;32mScript:\e[0m \e[0;34mClonning font:\e[0m \e[0;31m${font}\e[0m"
git sparse-checkout add "patched-fonts/${font}"
echo -e "\e[0;32mScript:\e[0m \e[0;34mInstalling font:\e[0m \e[0;31m${font}\e[0m"
./install.sh "${font}"
done

echo -e "\e[0;32mScript:\e[0m \e[0;34mCleaning the mess...\e[0m"
cd ../
rm -rf nerd-fonts

执行完以上命令,然后打开 ubuntu 的终端的设置->配置文件首选项->当前的方案,在字体中选择nerd font即可。

vscode 终端字体设置

打开设置,搜索 font,左侧栏选择 功能->终端 ,填入上面的字体名字,重新启动vscode即可。

  • Title: ubuntu-neovim(nvim)最新版本安装
  • Author: Endless_daydream
  • Created at : 2024-09-26 19:06:11
  • Updated at : 2024-09-26 22:20:33
  • Link: https://endless_daydream.gitee.io/2024/09/26/linux/ubuntu-neovim-nvim-最新版本安装/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
ubuntu-neovim(nvim)最新版本安装