Search

Neovim running on Fedora – Fedora Magazine

Share it

For those using Fedora and seeking efficiency, flexibility, and productivity in their coding endeavors, Neovim provides an exceptional solution that goes beyond conventional text editing. Whether you’re a developer, data scientist, sysadmin, or student, the power and adaptability of Neovim create a seamless coding experience in languages like Rust, Python, Go, and TypeScript. Let’s delve into the steps to optimize your coding workflow and take it to the next level!

Acquiring Neovim

To kick off, installing Neovim on your Fedora system can be achieved effortlessly using the package manager dnf:

sudo dnf install neovim

If you prefer building from the source for a customized setup, here’s a quick guide:

# Install dependencies
sudo dnf -y install ninja-build cmake gcc make unzip gettext curl glibc-gconv-extra

# Clone the repository
git clone https://github.com/neovim/neovim &&
cd neovim

# Build and install the package
make CMAKE_BUILD_TYPE=Release
sudo make install

Upon installation completion, kickstart Neovim by typing nvim in your terminal or accessing the application through the menu.

Note: If you opt for the source build approach, the application icon might not appear in the menu.

Now that Neovim is up and running, let’s move on to configuring your local setup to streamline your coding environment.

Structuring the Local Configuration Directory

When Neovim is launched, it looks for the ~/.config/nvim directory. Here’s the expected layout within this directory:

~/.config/nvim/
├─ init.lua                 <-- init file
├─ after/plugin/            <-- directory for plugin configurations
├─ lua/config/
   └─lazy.lua               <-- plugin manager file

The following script helps in establishing the basic directory structure and sourcing the lazy.lua file:

mkdir -p ~/.config/nvim/after/plugin/ ~/.config/nvim/lua/config &&
touch ~/.config/nvim/lua/config/lazy.lua &&
touch ~/.config/nvim/init.lua &&
echo "require('config.lazy')" >> ~/.config/nvim/init.lua

Introducing the Lazy Plugin Manager

Irrespective of your coding domain, the Lazy.nvim plugin manager simplifies the installation and management of your plugins. Here’s a starter script for your ~/.config/lua/config/lazy.lua file:

-- ~/.config/lua/config/lazy.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

vim.g.mapleader = " " -- setting the leader key

local plugins = {
-- plugin list
}

require("lazy").setup(plugins, {})

After saving the lazy.lua file, restart Neovim and utilize :Lazy on the command line to activate the Lazy plugin manager interface.


Incorporating Plugins

As you venture into specific languages, here are notable plugins to consider adding to Neovim:

  • plenary.nvim – offers additional functions, including asynchronous requests, in Neovim.
  • nvim-treesitter – delivers treesitter support for language parsers, queries, and enhanced features like syntax highlighting.
  • nvim-telescope – a versatile fuzzy finder for navigating projects, repositories, and files.
  • harpoon — aids in quick file navigation and management.
  • undotree — provides a visual representation of file revisions for easy undo branch selection.
  • vim-fugitive — facilitates git repository administration.
  • mason.nvim — manages language servers (lsp) efficiently.
  • nvim-cmp — ensures autocompletion support.
  • LuaSnip — supports snippet engine functionalities.
  • A suitable color scheme like NeoSolarized, tokyonight, or kanagawa.

Ensure to integrate these plugins into the plugins table within your ~/.config/nvim/lua/config/lazy.lua file to allow Lazy to manage and download them seamlessly.


Personalizing Plugin Configurations

Customizing plugin configurations adds a layer of finesse to your Neovim environment. Dividing the configurations either by functionality or plugin name helps streamline the organization. Here’s a breakdown you can follow:

Organization by Functionality

Function File Plugin(s) Configured
File Navigation, Git Repos, Fuzzy Finding nav.lua vim-fugitive, harpoon, telescope
Syntax Parsing, LSP, Autocompletion lsp.lua treesitter, mason, nvim

🤞 Don’t miss these tips!

🤞 Don’t miss these tips!

Solverwp- WordPress Theme and Plugin