Clone this repository under ~/.config (the result will look like ~/.config/nvim) If you want nvim to support a new language please do the following.
Post Install config steps:
- Install FZF, Ripgrep for telescope to work correctly and to ignore gitignored paths.
- Install a LSP for the language using Mason. Update the mason.lua file to add the server. Mason-lspconfig plugin is used to setup the lsp servers.
- If you need additional settings for your lsp config, looks into this place https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md and add that to config section under LSP/ folder
- Install treesitter for your specific language to get good syntax highlighting
- Manually install a formatter and a diagnostics tool(linter) for that language and update null-ls.lua with that information. You can find the information on available formatter and diagnostics from here -> https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
- We need to install rg and gnu-sed for nvim spectre to work.
- We need to install xclip in linux for neovim to be able to copy to clipboard
- install hack nerd fonts for proper display of special characters.
- Also install powerline fonts in linux and mac for special characters to be visible.
Auto completions is handled by nvim cmp. It has the rules on how the variables/functions/methods appear in the drop down menu.
After installing a plugin using packer, you need to initialise the package by setting it up. check the corresponding plugin files to see how the setup method is invoked.
Mason installs lsp servers and other binaries here in your local machine $HOME/.local/share/nvim/mason
Commands:
- :Lazy -> To update the plugins
- :Mason -> Mason Dashboard
- :TSUpdate -> Update Tree sitter for languages.
- :LspInfo -> Shows information about the attached LSP clients in the current buffer.
- :NullLsInfo -> Shows information about the attached null-ls clients in the current buffer.
A bit more context on how vim lsp and mason work together
vim.lsp (Neovim's built-in LSP client, enhanced in v0.11): This is the core engine within Neovim that understands the Language Server Protocol. It allows Neovim to communicate with language servers (once they are running and Neovim knows how to talk to them). It provides the APIs for features like go-to-definition, hover, diagnostics, etc. However, vim.lsp itself does not install or manage the language server programs/binaries.
nvim-lspconfig (a community plugin, but very widely used): This plugin provides a collection of default configurations for a vast number of language servers. It tells vim.lsp how to start and communicate with specific servers (e.g., "for pyright, use this command: pyright-langserver --stdio"). It standardizes the setup for many servers. It also does not install the server binaries themselves.
mason.nvim: This is a package manager. Its job is to download, install, and manage external tools like language servers, linters, formatters, and debug adapters. It ensures the actual server programs (e.g., the lua-language-server executable, ts_ls executable) are available on your system in a predictable location.
mason-lspconfig.nvim: This plugin acts as a bridge. It tells nvim-lspconfig where mason.nvim has installed the server binaries. It also often handles the ensure_installed logic, triggering Mason to install servers if they're missing.