Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"index",
"quickstart",
"installation",
"neovim",
{
"group": "Web editor",
"icon": "mouse-pointer-2",
Expand Down
340 changes: 340 additions & 0 deletions neovim.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,340 @@
---
title: "Neovim"

Check warning on line 2 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L2

Did you really mean 'Neovim'?
description: "Install and set up Neovim for efficient text editing and development"

Check warning on line 3 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L3

Did you really mean 'Neovim'?
icon: "terminal"
---

<img
className="block dark:hidden my-0 pointer-events-none"
src="/images/neovim/neovim-light.png"
/>
<img
className="hidden dark:block my-0 pointer-events-none"
src="/images/neovim/neovim-dark.png"
/>

Neovim is a modern, extensible text editor that builds on the legacy of Vim while adding powerful features for developers. This guide will help you install and configure Neovim for an optimal development experience.

Check warning on line 16 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L16

Did you really mean 'Neovim'?

Check warning on line 16 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L16

Avoid using 'will'.

Check warning on line 16 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L16

Did you really mean 'Neovim'?

## Installation

<Info>
**Prerequisites**: Neovim requires a terminal emulator and works best with a modern shell like Bash, Zsh, or Fish.

Check warning on line 21 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L21

': N' should be in lowercase.

Check warning on line 21 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L21

Did you really mean 'Zsh'?
</Info>

<Steps>
<Step title="Install Neovim">
Choose your preferred installation method based on your operating system:

<CodeGroup>
```bash macOS (Homebrew)
brew install neovim
```

```bash Ubuntu/Debian
sudo apt update
sudo apt install neovim
```

```bash Fedora/CentOS/RHEL
sudo dnf install neovim
```

```bash Arch Linux
sudo pacman -S neovim
```

```bash Windows (Chocolatey)
choco install neovim
```

```bash Windows (Scoop)
scoop install neovim
```
</CodeGroup>
</Step>

<Step title="Verify installation">
Confirm Neovim is installed correctly by checking the version:

Check warning on line 57 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L57

In general, use active voice instead of passive voice ('is installed').

```bash
nvim --version
```

You should see output showing the Neovim version and build information.
</Step>

<Step title="Create configuration directory">
Set up the configuration directory structure:

<CodeGroup>
```bash macOS/Linux
mkdir -p ~/.config/nvim
```

```bash Windows (PowerShell)
mkdir $env:LOCALAPPDATA\nvim
```
</CodeGroup>
</Step>
</Steps>

## Basic configuration

Create a basic configuration file to get started with Neovim:

Check warning on line 83 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L83

Did you really mean 'Neovim'?

<Steps>
<Step title="Create init.lua">
Create the main configuration file:

<CodeGroup>
```bash macOS/Linux
touch ~/.config/nvim/init.lua
```

```bash Windows (PowerShell)
New-Item -Path "$env:LOCALAPPDATA\nvim\init.lua" -ItemType File
```
</CodeGroup>
</Step>

<Step title="Add basic settings">
Open the `init.lua` file and add these essential settings:

```lua init.lua
-- Basic settings
vim.opt.number = true -- Show line numbers
vim.opt.relativenumber = true -- Show relative line numbers
vim.opt.tabstop = 2 -- Number of spaces tabs count for
vim.opt.shiftwidth = 2 -- Size of an indent
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.smartindent = true -- Insert indents automatically
vim.opt.wrap = false -- Disable line wrap
vim.opt.ignorecase = true -- Ignore case in search
vim.opt.smartcase = true -- Don't ignore case with capitals
vim.opt.termguicolors = true -- True color support

-- Key mappings
vim.g.mapleader = " " -- Set leader key to space

-- Basic key mappings
vim.keymap.set("n", "<leader>w", ":w<CR>", { desc = "Save file" })
vim.keymap.set("n", "<leader>q", ":q<CR>", { desc = "Quit" })
vim.keymap.set("n", "<leader>e", ":Ex<CR>", { desc = "File explorer" })
```
</Step>
</Steps>

## Package management

For a more powerful Neovim setup, install a package manager:

Check warning on line 129 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L129

Did you really mean 'Neovim'?

<Steps>
<Step title="Install lazy.nvim">
Add lazy.nvim package manager to your configuration:

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

-- Setup lazy.nvim
require("lazy").setup({
-- Add plugins here
})
```
</Step>

<Step title="Add essential plugins">
Install some useful plugins by updating your lazy.nvim setup:

```lua init.lua
require("lazy").setup({
-- File explorer
{
"nvim-tree/nvim-tree.lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("nvim-tree").setup()
end,
},

-- Syntax highlighting
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "lua", "javascript", "python", "markdown" },
highlight = { enable = true },
})
end,
},

-- Color scheme
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
vim.cmd.colorscheme("catppuccin")
end,
},
})
```
</Step>
</Steps>

## Getting started

<Steps>
<Step title="Launch Neovim">
Start Neovim from your terminal:

Check warning on line 201 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L201

Did you really mean 'Neovim'?

```bash
nvim
```

Or open a specific file:

```bash
nvim filename.txt
```
</Step>

<Step title="Learn basic commands">
Master these essential Neovim commands:

Check warning on line 215 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L215

Did you really mean 'Neovim'?

- `i` - Enter insert mode
- `Esc` - Return to normal mode
- `:w` - Save file
- `:q` - Quit
- `:wq` - Save and quit
- `dd` - Delete current line
- `yy` - Copy current line
- `p` - Paste
</Step>

<Step title="Install plugins">
If you added lazy.nvim, install the plugins:

1. Restart Neovim
2. Run `:Lazy` to open the plugin manager
3. Press `I` to install plugins
</Step>
</Steps>

## Advanced configuration

For a more sophisticated setup, consider these enhancements:

### Language Server Protocol (LSP)

Check warning on line 240 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L240

'Language Server Protocol (LSP)' should use sentence-style capitalization.

Check warning on line 240 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L240

Use parentheses judiciously.

Add LSP support for intelligent code completion and error checking:

```lua init.lua
-- Add to your lazy.nvim plugins
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
},
config = function()
require("mason").setup()

Check warning on line 253 in neovim.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

neovim.mdx#L253

Use parentheses judiciously.
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "tsserver", "pyright" }
})

local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({})
lspconfig.tsserver.setup({})
lspconfig.pyright.setup({})
end,
}
```

### Fuzzy finder

Add telescope for powerful file and text searching:

```lua init.lua
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Live grep" })
end,
}
```

## Troubleshooting

<AccordionGroup>
<Accordion title="Neovim command not found">
If you get a "command not found" error:

1. Verify installation: Check if Neovim is installed correctly
2. Check PATH: Ensure the installation directory is in your PATH
3. Restart terminal: Close and reopen your terminal
4. Try full path: Use the full path to the Neovim executable
</Accordion>

<Accordion title="Configuration not loading">
If your configuration isn't working:

1. Check file location: Ensure `init.lua` is in the correct directory
2. Check syntax: Look for Lua syntax errors in your configuration
3. Start with minimal config: Comment out plugins and add them back gradually
4. Check logs: Run `:messages` in Neovim to see error messages
</Accordion>

<Accordion title="Plugins not installing">
If lazy.nvim plugins aren't installing:

1. Check internet connection: Ensure you can access GitHub
2. Clear cache: Delete the lazy.nvim data directory and restart
3. Check configuration: Verify your lazy.nvim setup is correct
4. Manual install: Try installing plugins manually with `:Lazy install`
</Accordion>

<Accordion title="Colors not displaying correctly">
If colors appear wrong or missing:

1. Enable true colors: Add `vim.opt.termguicolors = true` to your config
2. Check terminal support: Ensure your terminal supports 24-bit colors
3. Try different colorscheme: Test with built-in colorschemes first
4. Update terminal: Use a modern terminal emulator
</Accordion>
</AccordionGroup>

## Next steps

Now that you have Neovim installed and configured, explore these resources:

<Card title="Learn Vim motions" icon="keyboard" href="https://vim-adventures.com/" horizontal>
Master efficient text editing with Vim motions through interactive games and tutorials.
</Card>

<Card title="Explore plugins" icon="puzzle" href="https://github.com/rockerBOO/awesome-neovim" horizontal>
Discover hundreds of plugins to extend Neovim's functionality for your specific needs.
</Card>

<Card title="Join the community" icon="users" href="https://neovim.io/community/" horizontal>
Connect with other Neovim users, get help, and share configurations.
</Card>

<Card title="Advanced configuration" icon="settings" href="https://neovim.io/doc/user/" horizontal>
Dive deeper into Neovim's extensive documentation and advanced features.
</Card>