如何安装和使用 Neovim
Neovim Vim
![](/data/attachment/album/202304/01/173733iav3pvd88htv38vt.jpg)



> 
> 你一定已经听说过著名的 Vim 文本编辑器。然而，这篇文章是关于它的复刻 Neovim。
> 
> 
> 


Vim 也是 Vi 的一个复刻，这使得 Neovim 成为复刻的复刻。所以，你最终可以使用任何东西，因为它有一些独特的特征。


如果你决定使用 Neovim，让我帮助你在 Ubuntu 和其他 Linux 发行版上开始使用它。


### Neovim 概述


![](/data/attachment/album/202304/01/173735giaq9b1z6u66diw8.png)


[Neovim](https://neovim.io/?ref=itsfoss.com) 是一个以其简单的维护和社区贡献而闻名的项目。此外，开发工作很好地分配在多个开发人员之间。


对于最终用户而言，Neovim 的可扩展性远超人们的预期。Neovim 的目标是在不损害 Vim 传统功能的情况下提供更好的应用。


使用 [Neovim 的 GUI](https://itsfoss.com/neovim-gui-editors/)，你可以获得增强的编辑体验。


### Neovim 的特点


虽然你可以在其官方网站及其 [GitHub 页面](https://github.com/neovim/neovim?ref=itsfoss.com) 上探索所有相关信息。让我强调一些特点：


* 现代图形界面
* 从多种语言访问 API，包括（C/C++、C#、Go、Haskell、Java/Kotlin、JavaScript/Node.js、Lua、Perl、Python、Ruby、Rust 等等）
* 嵌入式、可编写脚本的终端仿真器
* 异步任务控制
* 多个实例之间的共享数据
* XDG 基本目录支持
* 与大多数 Vim 插件兼容，包括 Ruby 和 Python 插件



> 
> ? 我们建议你在开始使用 Vim 和 Neovim 之前，先了解其用法。
> 
> 
> 


### 在 Ubuntu 和 Linux 上安装 Neovim


由于 Neovim 的流行，安装它很简单。因为 Neovim 在你选择的任何发行版的官方仓库中都可用。



> 
> 如果你需要，我们还有一个 [在 Linux 上安装 Vim](https://itsfoss.com/install-latest-vim-ubuntu/) 的指南。
> 
> 
> 


要在 Ubuntu 上安装 Neovim，只需单击停靠区中的 Ubuntu 软件图标。然后，搜索 Neovim。你可以根据自己的喜好选择 Snap 或 deb 版本。但是，deb 包版本是过时的 Neovim 版本。


![neovim listed on ubuntu software center](/data/attachment/album/202304/01/173736ovjid66hhd9ldv1b.png)


如果你不想要 Snap 版本，你可以从 [Neovim 的 Github 发布页](https://github.com/neovim/neovim/releases/tag/stable?ref=itsfoss.com) 获取最新的 deb 文件。如果你仔细查看发布页面，还有一个 Appimage 文件。


如果你想使用终端而不是 GUI，你可以执行以下操作：


对于基于 **Ubuntu 和 Debian** 的发行版，输入以下命令进行安装：



```
sudo apt install neovim

```

对于 **Manjaro 和 Arch Linux**，使用以下命令更新你的系统并安装 Neovim：



```
sudo pacman -Syu neovim

```

对于 **Fedora**，使用以下命令：



```
sudo dnf install -y neovim

```

要安装 **Flatpak**，你可以使用此命令：



```
flatpak install flathub io.neovim.nvim

```

最后，要安装 **Snap 包**，请使用以下命令：



```
sudo snap install nvim --classic

```

如果你更喜欢从源代码构建软件，请遵循该项目的 Github 页面上给出的 [步骤](https://github.com/neovim/neovim/wiki/Installing-Neovim?ref=itsfoss.com#install-from-source)。


### 如何使用 Neovim


要在安装完成后使用 Neovim，只需从应用菜单启动它，方法是按超级键并输入 `neovim`。这将打开一个带有 Neovim 的终端窗口。


![](/data/attachment/album/202304/01/173736f23pvvzcv3zvwc6n.png)


或者你可以打开你选择的任何终端仿真器并输入以下命令：



```
nvim

```

是的，不是 `neovim`，而是 `nvim`。例如，要编辑 `/etc/fstab`，请输入以下命令：



```
sudo nvim /etc/fstab

```

现在 fstab 文件将被打开，如下面的截图所示：


![](/data/attachment/album/202304/01/173737zs5655ds6507ivod.png)


如果你无法退出编辑器，请不要担心，按下 `Shift+Z+Z`。例如，如果此快捷键令人困惑，请使用你需要的键在任何文本编辑器中输入大写的 `ZZ` 就明白了。


关于这一点，我应该重申，你需要学习 Vim 或 Neovim 并阅读文档才能有效地利用其所有功能。


### 总结


安装和启动 Neovim 非常简单，但学习它肯定需要一些键盘操作。


这只是编辑器的概述。我不是这方面的专家，但我希望这对所有初学者都有好处！


? 你使用 Neovim 吗？ 在下面的评论中分享你的经验。




---


via: <https://itsfoss.com/install-neovim/>


作者：[Anuj Sharma](https://itsfoss.com/author/anuj/) 选题：[lkxed](https://github.com/lkxed/) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

You must have heard about the famous Vim text editor already. However, this article is about its fork, Neovim.

Vim is also a fork of vi which makes Neovim fork of a fork. So, you can end up using anything for some of its unique traits.

If you decide to use Neovim, let me help you get started with it on Ubuntu and other Linux distributions.

## Neovim: Overview

![](https://itsfoss.com/content/images/2023/03/goneovim.png)

[Neovim](https://neovim.io) is a project known for its simple maintenance and community contributions. Moreover, the development effort is distributed well between multiple developers.

For end-users, Neovim is much more extensible than one would expect. The aim of Neovim is to provide better applications of it without compromising the traditional capabilities of Vim.

With a [GUI for Neovim,](https://itsfoss.com/neovim-gui-editors/) you can get an enhanced editing experience.

**Suggested Read 📖**

[Vim vs Nano: What Should You Choose?Vim and Nano are two popular terminal text editors. How are they different? What’s best for you? Let us find out.](https://itsfoss.com/vim-vs-nano/)![](https://itsfoss.com/content/images/wordpress/2022/01/vim-vs-nano.png)


![](https://itsfoss.com/content/images/wordpress/2022/01/vim-vs-nano.png)

## Features of Neovim

While you can explore all about it on its official website and its [GitHub page](https://github.com/neovim/neovim). Let me highlight some features:

- Modern Graphical Interfaces
- API access from many language including (C/C++, C#, Go, Haskell, Java/Kotlin, JavaScript/Node.js, Lua, Perl, Python, Ruby, Rust to name a few)
- Embedded, scriptable terminal emulator
- Asynchronous job control
- Shared data among multiple instances
- XDG base directories support
- Compatible with most Vim plugins, including Ruby and Python plugins

**Suggested Read 📖**

[11 Pro Vim Tips to Get Better Editing ExperienceYou can learn plenty of Vim tips on your own, or you can learn it from others’ experiences.](https://linuxhandbook.com/pro-vim-tips/)![](https://linuxhandbook.com/content/images/2022/08/pro-vim-tips.png)


![](https://linuxhandbook.com/content/images/2022/08/pro-vim-tips.png)

## Installing Neovim on Ubuntu and Linux

Installing Neovim is simple due to its popularity. As Neovim is available in official repos of any distribution you pick.

We also have a guide to [install Vim on Linux](https://itsfoss.com/install-latest-vim-ubuntu/), in case you want that.

To install Neovim on Ubuntu, just click on the Ubuntu Software icon in the dock. Then, search for Neovim. You can select the snap or the deb version as per your preference. However, the deb package version will be an outdated version of Neovim.

![neovim listed on ubuntu software center](https://itsfoss.com/content/images/2023/01/software-center-neovim-snap.png)

And, if you do not want the snap version, you can grab the latest deb file from the [Github releases page for Neovim](https://github.com/neovim/neovim/releases/tag/stable). If you look closer in the releases page, there is an Appimage file as well.

If you want to utilize the terminal instead of the GUI, here's what you can do:

For **Ubuntu and Debian** based distributions, enter the following command to install

```
sudo apt install neovim
```


For **Manjaro and Arch Linux**, use the below command to update your system and install Neovim

```
sudo pacman -Syu neovim
```


For **Fedora**, use the following command

`sudo dnf install -y neovim`


To install the **Flatpak**, you can use this command

```
flatpak install flathub io.neovim.nvim
```


Lastly, to install the **snap package** use the below command

`sudo snap install nvim --classic`


If you prefer building software from source, follow [the steps given on the project's Github page](https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-source).

## How to use Neovim

To use Neovim after installation is complete, just launch it from the application menu by pressing the super key and typing the name "neovim" without quotes. This will open a terminal window with Neovim open.

![](https://itsfoss.com/content/images/2023/01/neovim-default-screen.png)

Or you can just open any Terminal Emulator of your choice and enter the following command

`nvim`


Yes, not "neovim" but just "**nvim**". For example, to edit */etc/fstab* enter the following command.

`sudo nvim /etc/fstab`


Now the fstab file will open as shown in the screenshot below.

![](https://itsfoss.com/content/images/2023/01/neovim-fstab.png)

Don't worry if you cannot exit the editor; press **Shift+Z+Z**. For example, if this shortcut key confuses, use the keys you need to type "ZZ" (uppercase) without quotes in any text editor.

On that note, I should re-iterate that you need to learn Vim or Neovim and go through the documentation to efficiently make use of all its features.

## Conclusion

Installing and launching Neovim is pretty straightforward but learning it will require some keyboard grinding for sure.

This was just an overview of the editor. I am not an expert on this, but I hope this serves well for all the beginners out there!

💬 *Do you use Neovim? Share your experience on it in the comments below.*