Neovim
Back to Development
NeovimAdvanced20 min

Neovim LSP Setup Guide: Autocomplete, Diagnostics, and Code Intelligence in Terminal

LSP Brings the IDE to Terminal

Neovim LSP setup tutorial with mason.nvim and nvim-cmp. Configure autocomplete, diagnostics, go-to-definition, code actions, and format-on-save for a full IDE in terminal.

Neovim's Lua API means your editor config is a real program — not a pile of Vimscript variables. You get functions, loops, conditionals, and lazy loading for free.

By the end of this 20 min guide, you'll have a working Neovim setup and practical Neovim workflows you can use immediately.

Installing Language Servers

Install Neovim:

brew install neovim ripgrep
Tip: Verify the installation with neovim --version or neovim -V after installing.

nvim-lspconfig Basics

Structure your config into modular files under lua/. Each file handles one concern: options, keymaps, plugins, autocmds.

Here's a foundational configuration to start with:

-- keymaps.lua
vim.keymap.set("n", "w", ":w", { desc = "Save" })
vim.keymap.set("n", "q", ":q", { desc = "Quit" })
vim.keymap.set("n", "e", ":NvimTreeToggle", { desc = "Toggle file tree" })

Autocomplete with nvim-cmp

With Neovim configured, these Neovim-specific workflows will save you time every day:

Pro tip: Don't try to adopt everything at once. Start with <leader>ff find files with Telescope and add more as it becomes habit.

Diagnostics, Formatting & Hover

Once you're comfortable with Neovim basics, these advanced techniques will transform your Neovim workflow:

LSP Not Attaching? Debugging

Here are the most common Neovim issues and how to fix them:

IDE-Quality Editing

Congratulations — you now have a solid Neovim foundation. Here's where to go next:

← PreviousObsidian Dataview Plugin Guide: Query Your Notes with DQL and Dynamic TablesNext →Raycast Extension Development Tutorial: Build and Publish with TypeScript and React