Open In App

Install and Use Neovim on Ubuntu

Last Updated : 07 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Exploring Neovim can completely change how you edit text, making it more powerful and customizable. Think of Neovim as a modern version that builds on the popular Vim text editor. It’s like a new and improved edition, designed to fix the limitations of the old one and bring in lots of cool features. This guide is like a roadmap to help you understand Neovim better, showing you its standout features, helping you install it on Ubuntu, and guiding you through the steps to use Neovim like a pro. Whether you’re new to text editing or familiar with Vim, this article will make Neovim easy to understand and use.

Features of Neovim

Neovim outshines Vim by boasting an extensive array of features, addressing the shortcomings that Vim may have. This attribute contributes to Neovim’s reputation as a robust text editor. Below, you’ll find a selection of Neovim’s notable features:

  • Modern terminal features such as cursor styling, focus events, bracketed paste
  • Works the same everywhere: one build type, one command
  • Remote plugins run as co-processes, safely and asynchronously.
  • XDG base directories support
  • Compatible with most Vim plugins, including Ruby and Python plugins
  • API access from many languages including (C/C++, C#, Go, Haskell, Java/Kotlin, JavaScript/Node.js, Lua, Perl, Python, Ruby, and Rust to name a few)

Installation of Neovim on Ubuntu and other Linux distributions

There are several methods of installing Neovim on Ubuntu and other Linux distributions. The methods are listed below:

Method 1: Installing Neovim from the Ubuntu software center

1) Open the Ubuntu software center

Screenshot-from-2023-10-11-20-33-44

Ubuntu software center

2) Search ‘Neovim’ in the search bar and press enter, after this you will Neovim-snap editor

Screenshot-from-2023-10-11-20-36-37-min

Neovim-snap

3) Click on the install button and install the Neovim text editor on your Linux operating system.

Method 2: Using the command line to install Neovim

Neovim can be installed on Linux distributions using a command line which makes it very convenient. To install Neovim on Linux follow the below steps:

1) To install on Ubuntu and Debian-based distributions

open your terminal and write the following command:

sudo apt install neovim

Screenshot-from-2023-10-11-20-48-39

Copy the command and press enter

Copy and paste the above command and then press enter. After it press ‘y’ to permit you to download Neovim on your Ubuntu system.

Screenshot-from-2023-10-11-20-51-01-min

Installation process

2) To Install Neovim on Fedora, write the following command

sudo dnf install -y neovim

3) To install Neovim on Manjaro and Arch Linux, write the following command

sudo pacman -Syu neovim

4) To install Neovim using the snap package, use the following command

sudo snap install nvim --classic
Screenshot-from-2023-10-11-20-55-03

Paste the command

After entering the above command press enter and the installation will start automatically.

Screenshot-from-2023-10-11-20-55-58

Neovim installed

Using Neovim

If you have ever used Vim text editor you will find Neovim familiar as Neovim has the same commands as Vim. But, it has more features than Vim.

If you don’t know how to use Vim, don’t worry in this article you will learn how to use Neovim so that you can get work done using a powerful Neovim text editor.

1) Create a file using Neovim

To create a file using Neovim you have to first open your terminal, and then write the following command to create the file, and then press enter:

nvim geeksforgeeks.txt

you can give any name or extension you want to work with. But in this example, we have created a file with the name ‘geeksforgeeks.txt’ and using the ‘.txt’ extension.

Screenshot-from-2023-10-11-21-47-21

Enter the command and replace the filename if you want

After you enter the above command and press enter, vim will open a text editor where you can write all the stuff and the stuff will be saved in that particular filename.

Screenshot-from-2023-10-11-21-47-52

2) Insert text in Vim editor

After creating a file using Neovim, we have to enter some lines or text. To enter text we have to press the key:

  • ‘i’ : after you press the key ‘i’ , you will be able to enter text.
Screenshot-from-2023-10-11-22-00-08

Enter text

After you see the insert, you can write text and all the data you want to write.

3) Saving the file and exit

After you are done with writing text using Neovim editor, it’s time to save the file and quit the editor. To do the following

  • ESC: press ‘ESC’ to enter into command mode where you will write a command to save the file
Screenshot-from-2023-10-11-22-21-11

Command mode

After that, you can enter the command here.

To save the file enter the below command:

  • :w’ – Enter ‘:w’ which is a semicolon followed by the letter ‘w’ which means to write and then press enter. You will see the output like this
Screenshot-from-2023-10-11-22-25-17

Enter the command

Press enter and then your file will be saved with the content you have written in the file.

Screenshot-from-2023-10-11-22-23-41

After entering the command press enter

4) Exit the editor

After writing the text and then saving the file it is time to exit the Neovim text editor. To do this first make sure in Command mode, you can enter command mode by clicking on ‘esc’.

  • ‘:q’ – enter semicolon followed by letter ‘q’ which means quit, after entering this command press enter. you will quit the neovim editor and come back to the terminal window.
Screenshot-from-2023-10-11-22-29-50

:q to exit the editor

Press enter and then neovim editor will close and you will return to the terminal window.

Screenshot-from-2023-10-11-22-29-55

Exited Neovim editor

Now, you have successfully created a file using Neovim editor and now you can work with Neovim editor.

Frequently Asked Questions:

Q1. What are the main differences between Neovim and Vim?

Neovim is a fork of Vim, designed to improve upon Vim’s limitations. It offers a range of modern features such as built-in terminal support, improved plugin management, a built-in terminal emulator, better support for asynchronous plugins, and an enhanced API for scripting in multiple programming languages. These features make Neovim more versatile and extensible compared to Vim.

Q2. How can I migrate my Vim configuration to Neovim?

Migrating your Vim configuration to Neovim is relatively straightforward. You can often reuse your existing Vim configuration files, like ~/.vimrc or ~/.vim/, in Neovim. Neovim provides compatibility for Vim plugins and settings, but it’s recommended to create a separate init.vim or ~/.config/nvim/init.vim for Neovim-specific settings while preserving your Vim configuration.

Q3. What are some popular Neovim plugins or extensions?

Neovim has a thriving plugin ecosystem. Some popular Neovim plugins include:

  • Dein.vim: A highly versatile and performant plugin manager for Neovim.
  • coc.nvim: A language server protocol (LSP) client for autocompletion and more.
  • NerdTree: A file explorer plugin for navigating your project’s directory structure.
  • Lightline: A status line plugin that displays helpful information.
  • Fugitive: A Git wrapper that allows you to interact with Git directly from Neovim.

Q4. Can I use Neovim as an IDE for programming languages?

Yes, many developers use Neovim as a highly customizable and powerful Integrated Development Environment (IDE). With the help of plugins and configuration, you can set up features like code autocompletion, linting, debugging, and project navigation for various programming languages. Neovim’s extensibility makes it suitable for a wide range of development tasks.

Q5. How do I contribute to the Neovim project?

Neovim is an open-source project, and contributions are welcome. You can contribute in various ways:

  • Code Contributions: If you’re a developer, you can contribute code, bug fixes, or new features by forking the repository on GitHub and creating pull requests.
  • Documentation: Help improve the project’s documentation to make it more accessible to users.
  • Testing: You can help by testing the software, reporting bugs, and providing feedback.
  • Support: Providing support to other users on forums and communities can be a valuable contribution.

Conclusion

In this article we discussed Neovim which stands out as a robust text editor with advanced features, surpassing Vim. The article guides users through installing Neovim on Linux, covering methods like the Ubuntu Software Center and command-line installations. It also explains how to use Neovim for tasks like creating files, inserting text, saving, and exiting. Common questions about the differences between Neovim and Vim, migrating configurations, popular plugins, using Neovim as an IDE, and contributing to the project are addressed. Overall, the article provides a user-friendly guide to making the most of Neovim’s capabilities in development workflows.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads