Note: This article will only focus on NvChad itself. If you want to simply copy my computer configs (ALL OF THEM), you can refer to How to Set Up on A New Machine.
Nvim-treesitter plugin is used to suport syntax highlighting in NvChad. It can be used for various things such as auto indent etc too.
For knowing correct parser names, do check nvim-treesitter docs
You can also get a list of all available languages and their installation status with :TSInstallInfo
TSInstallInfo
To install parsers:
TSInstall <parser>
Example:
TSInstall lua html
But this may be tedious when you have so many parsers to install and you’d have to repeat this step if you’re re-installing nvchad with your old custom settings.
Telescope
FInd finds in current peoject (aka directory):
<leader> + ff
FInd finds in current buffer:
<leader> + fz
FInd finds in all buffers:
<leader> + fb
Functionalitoes
Cheet sheet:
<Ctrl> + ch
Window Management
window —> buffer
tab —> buffer
Nagivate windows:
<Ctrl> + [hjkl]
Navigate tabs:
<Tab>
Close current buffer:
<leader> + x
Split windows:
:vsp
(vertical split)
Terminal
Open terminal horizontally:
<leader> + h
vertically
<leader> + v
LSP
neovim/nvim-lspconfig
In custom/plugins.lua:
-- In order to modify the \`lspconfig\` configuration:{ "neovim/nvim-lspconfig", config = function() require "plugins.configs.lspconfig" require "custom.configs.lspconfig" end,},
This controls the behavior of LSP.
The file plugins/configs/lspconfi.lua is thr system config, we shouldn’t change it. What we need to modify is custom/configs/lspconfig.lua. We can see its content:
local on_attach = require("plugins.configs.lspconfig").on_attachlocal capabilities = require("plugins.configs.lspconfig").capabilitieslocal lspconfig = require("lspconfig")-- if you just want default config for the servers then put them in a tablelocal servers = { "html", "cssls", "tsserver", "clangd", "pyright" }-- Add attach and capabilities to every lspconfig[<lsp_server>]for _, lsp in ipairs(servers) do lspconfig[lsp].setup { on_attach = on_attach, capabilities = capabilities, }end
It’s clear that the function for loop for _, lsp in ipairs(servers) do ... end add the on_attach and capabilities attributes to every lsp server defined in the list servers.
So if we have a new lsp server, it has to be added to the servers list.
Mason.nvim
The mason.nvim plugin is used to install LSP servers, formatters, linters, and debug adapters.
Note: Packages are installed in Neovim’s data directory (:h standard-path) by default. In Unix, it’s under ~/.local/share/nvim
You can mannualy install lsp packages using :Mason, that will open a window.
However, It’s better to list all your required packages in the config file so they automatically install when running MasonInstallAll command.
First, to install a lsp server, we need to add lsp config in the mason part of custom/configs/overrides.lua. For instance, we add a lsp server “pyright” to it.
Next, we need to add this server to the servers list in custom/configs/lspconfig.lua. For instance, since we already have a pyright server, we add it in the list: