Skip to content
Merged
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
6 changes: 3 additions & 3 deletions docs/books/nvchad/additional_software.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Additional Software
author: Franco Colussi
contributors: Steven Spencer
tested with: 9.0
tested with: 8.6, 9.0
tags:
- nvchad
- coding
Expand Down Expand Up @@ -47,7 +47,7 @@ RipGrep is needed for recursive searches with `:Telescope`.

## Lazygit

[LazyGit](https://github.com/jesseduffield/lazygit) is an ncurses-style interface that allows you to perform all `git` operations in a more user-friendly way, it is required by the _lazygit.nvim_ plugin, this plugin makes it possible to use LazyGit directly from NvChad, it opens a floating window from where you can perform all operations on your repositories, thus allowing you to make all changes to the _git repository_ without leaving the editor.
[LazyGit](https://github.com/jesseduffield/lazygit) is an ncurses-style interface that allows you to perform all `git` operations in a more user-friendly way. It is required by the _lazygit.nvim_ plugin. This plugin makes it possible to use LazyGit directly from NvChad, it opens a floating window from where you can perform all operations on your repositories, thus allowing you to make all changes to the _git repository_ without leaving the editor.

To install it we can use the repository for Fedora. On Rocky Linux 9 it works perfectly.

Expand All @@ -64,4 +64,4 @@ with the <kbd>x</kbd> key we can bring up the menu with all available commands.

![LazyGit UI](images/lazygit_menu.png)

Now that we have all the necessary supporting software on our system we can move on to installing the basic software, the editor on which all the configuration is based, [Neovim](install_nvim.md).
Now that we have all the necessary supporting software on our system we can move on to installing the basic software. We will start with the editor on which all the configuration is based, [Neovim](install_nvim.md).
21 changes: 12 additions & 9 deletions docs/books/nvchad/custom/chadrc_lua.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
title: WIP - chadrc.lua
title: chadrc.lua
author: Franco Colussi
contributors: Steven Spencer
tested with: 8.6, 9.0
tags:
- nvhad
- coding
- editor
---

# chadrc.lua
# `chadrc.lua`

The chadrc.lua file in our `custom` folder contains information about where NvChad should look for additional configurations and personal plugins.
The `chadrc.lua` file in our `custom` folder contains information about where NvChad should look for additional configurations and personal plugins.

Special attention must be paid to the file hierarchy as there may be multiple files with the same name (see *init.lua*) but in different locations, the location is what determines the order in which the files are included in the configuration. Respectively `core` -> `custom` -> `plugins`.
Special attention must be paid to the file hierarchy, as there may be multiple files with the same name (see *init.lua*) but in different locations. The location is what determines the order in which the files are included in the configuration. That order is `core` -> `custom` -> `plugins`.

The contents of the `chadrc.lua` file are as follows:

Expand All @@ -37,16 +40,16 @@ M.plugins = {
return M
```

The first call you encounter refers to the inclusion of our *custom/override.lua* file containing the custom settings for the plugins in the *override* table defined in `M.plugins`, in particular the customizations refer to the state of the files with respect to a Git *repository* (if you are working with one), the automatic installation of *treesitter parsers* and the exclusion of the reference lines of nested routines and commands, this functionality in writing documentation in Markdown is not that important, in case you want to have this functionality as well just remove the line:
The first call you encounter refers to the inclusion of our `custom/override.lua` file containing the custom settings for the plugins in the *override* table defined in `M.plugins`. In particular, the customizations refer to the state of the files with respect to a Git *repository* (if you are working with one), the automatic installation of *treesitter parsers*, and the exclusion of the reference lines of nested routines and commands. This functionality in writing documentation in Markdown is not that important. If you want to have this functionality as well, just remove the line:

```lua
["lukas-reineke/indent-blankline.nvim"] = override.blankline,
```

And perform a `:PackerSync`.
And perform a <kbd>SHIFT</kbd> + <kbd>:PackerSync</kbd> from NORMAL mode in the editor.

Then follows the configuration of the default theme with its clear variant and next the `require` call of the *custom/mapping.lua* file that contains the custom commands.
Then follows the configuration of the default theme with its clear variant, followed by the `require` call of the `custom/mapping.lua` file that contains the custom commands.

We then find settings that call up personal configuration files (contained in *custom/plugins*) that will replace the default settings.
Finally, we find settings that call up personal configuration files (contained in *custom/plugins*) that will replace the default settings.

So we can say that the *chadrc.lua* file is the file that takes care of some aspects of the UI and more importantly to include our files in the NvChad configuration.
So we can say that the `chadrc.lua` file is the file that takes care of some aspects of the UI, and more importantly, the inclusion of *our* files in the NvChad configuration.
27 changes: 15 additions & 12 deletions docs/books/nvchad/custom/custom_folder.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
title: WIP -Custom Folder
title: Custom Folder
author: Franco Colussi
contributors: Steven Spencer
tested with: 8.6, 9.0
tags:
- nvchad
- coding
- custom
---

# Advanced configuration of the Custom Folder

## Introduction

NvChad uses the version manager `git` for updates, this implies that at every update part or the whole configuration is overwritten by new commits, consequently it would be useless to make customizations within the default configuration. To solve this problem the NvChad developers have set up the possibility to make your changes in a folder called `custom` which must be mandatorily placed in `.config/nvim/lua/`. Below we have a representation of the basic structure of a standard NvChad installation
NvChad uses the version manager `git` for updates. This implies that at every update, part or the whole configuration is overwritten by new commits. Consequently it would be useless to make customizations within the default configuration. To solve this problem the NvChad developers have set up the possibility to make your changes in a folder called `custom` which **must** be placed in `.config/nvim/lua/`. Below we have a representation of the basic structure of a standard NvChad installation.

```text
nvim/
Expand All @@ -27,7 +31,7 @@ nvim/

### Structure Creation

To start the customization we have to create for first the `custom` folder that will contain all our files, let's take the opportunity to also create the `plugins` folder that will contain the _configuration files_ of our plugins, since surely the folders will not be present we will use the `-p` flag to tell the _mkdir_ command to create the missing folders, the command will be as follows:
To start the customization we have to create the `custom` folder that will contain all our files and also the `plugins` folder that will contain the _configuration files_ of our plugins. Since the folders will not be present, we will use the `-p` flag to tell the `mkdir` command to create the missing folders. The command will be as follows:

```bash
mkdir -p ~/.config/nvim/lua/custom/plugins
Expand All @@ -43,7 +47,7 @@ The structure of the `nvim/lua` folder should now look like this:
│   └── plugins
```

The choice of path is not accidental but responds to the need to preserve this folder from updates, otherwise with each update the folder would simply be deleted as it is not part of the repository. The NvChad developers have prepared a `.gitignore` file for this, which determines its exclusion.
The choice of path is not accidental. It responds to the need to preserve this folder from updates. Without this, with each update the folder would simply be deleted as it is not part of the repository. The NvChad developers have prepared a `.gitignore` file for this, which determines its exclusion.

```bash
cat .config/nvim/.gitignore
Expand All @@ -67,32 +71,31 @@ custom/
└── lspconfig.lua
```

We are going to analyze its contents and briefly describe the files it contains; the files will be analyzed in detail later on the pages dedicated to them.
We are going to analyze its contents, and briefly describe the files it contains. The files will be analyzed in detail later, on the pages dedicated to them.

- `chadrc.lua`: this file allows the override of default configurations. It also allows plugins to be overridden so that they can then be associated with _override.lua_ configurations. For example, it is used to save the interface theme with:
- `chadrc.lua`: This file allows for the override of default configurations. It also allows plugins to be overridden so that they can then be associated with _override.lua_ configurations. For example, it is used to save the interface theme with:

```lua
M.ui = {
theme = "everforest",
}
```

- `init.lua`: this file is executed after the main `init.lua` file contained in `nvim/lua/core/` and allows the execution of personalized commands at NvChad startup.
- `init.lua`: This file is executed after the primary `init.lua` file, contained in `nvim/lua/core/`, and allows the execution of personalized commands at NvChad startup.

- `mappings.lua`: allows the setting of custom commands, these commands are normally used to abbreviate standard commands. An example is the abbreviation of the command `:Telescope find_files` which with this setting in _mapping.lua_:
- `mappings.lua`: Allows for the setting of custom commands. These commands are normally used to abbreviate standard commands. An example is the abbreviation of the command `:Telescope find_files`, which with this setting in _mapping.lua_:

```lua
["\\\\"] = { "<cmd> Telescope find_files<CR>", "file finder" },
```

Allows you to retrieve **:Telescope find_files** by typing two `\\`
allows you to retrieve **:Telescope find_files** by typing two `\\`

![Telescope Find Files](../images/telescope_find_files.png)


- `override.lua`: this file contains the custom configurations that replace the default ones, this is possible thanks to the override effected upstream in _chadrc.lua_.
- `override.lua`: This file contains the custom configurations that replaces the default ones. This is made possible thanks to the override effected upstream in _chadrc.lua_.

Let us now move on to the `plugins` folder, the folder contains all the configuration files of the various plugins installed and most importantly the `init.lua` file. In the `init.lua` file should be inserted the plugins we want to install on our IDE. Once inserted and configured, if necessary, they will be installable via the `:PackerSync` command.
Let us now move on to the `plugins` folder. This folder contains all the configuration files of the various plugins installed. It also contains the `init.lua` file for the customizations. The `init.lua` file should contain the plugins we want to install on our IDE. Once inserted and configured, they will be installable via the `:PackerSync` command.

The only plugin required is _neovim/nvim-lspconfig_, which enables LSP (language server) functionality for advanced editing.

15 changes: 9 additions & 6 deletions docs/books/nvchad/custom/init_lua.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
title: WIP - init.lua
title: init.lua
author: Franco Colussi
contributors: Steven Spencer
tested with: 8.6, 9.0
tags:
- nvchad
- coding
- editor
---

# init.lua
# `init.lua`

The *nvim/lua/custom/init.lua* file is used for overwriting the default NvChad options defined in *lua/core/options.lua* and setting its own options. It is also used for the execution of Auto-Commands.
The `nvim/lua/custom/init.lua` file is used for overwriting the default NvChad options, defined in `lua/core/options.lua`, and setting its own options. It is also used for the execution of Auto-Commands.

Writing documents in Makdown does not require much modification; we are going to set some behaviors such as the number of spaces for tabbing, a setting that makes formatting Markdown files very smooth.
Writing documents in Markdown does not require much modification. We are going to set some behaviors such as the number of spaces for tabbing, a setting that makes formatting Markdown files very smooth.

Our file will look like this:

Expand All @@ -29,6 +32,6 @@ opt.autoindent = true
opt.smartindent = true
```

In our example we used an auto-command for synchronous buffer formatting and formatting options.
In our example we used an auto-command for synchronous buffer formatting and options.

To summarize, the *init.lua* file is used for overwriting the default settings, this is because being read after the *core/init.lua* file replaces all previous options with the new ones we set.
To summarize, the `init.lua` file in our `custom` folder is used for overwriting the default settings. This works because it is being read after the `core/init.lua` file, replacing all previous options with the new ones we have set.
18 changes: 9 additions & 9 deletions docs/books/nvchad/custom/lsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Language Server Protocol
author: Franco Colussi
contributors: Steven Spencer
tested with: 9.0
tested with: 8.6, 9.0
tags:
- NvChad
- coding
Expand Down Expand Up @@ -40,7 +40,7 @@ The combined use of the two plugins allows the required language servers to be d

#### Downloading Language Servers

To download the language server of choice, we open the interface of *Mason* from our editor with the command `:Mason`. Suppose we want to install the language server for *Markdown*. To do so, we type <kbd>2</kbd> to take us to the `LSP` section. Now we go down with the arrow key until we find the language server `marksman`. By pressing the space bar we can get some information about the server as you can see in the screenshot below.
To download the language server of choice, we open the interface of *Mason* from our editor with the command <kbd>SHIFT</kbd> + <kbd>:Mason</kbd>. Suppose we want to install the language server for *Markdown*. To do so, we type <kbd>2</kbd> to take us to the `LSP` section. Now we go down with the arrow key until we find the language server `marksman`. By pressing the space bar we can get some information about the server as you can see in the screenshot below.

![Mason Marksman](../images/mason_marksman.png)

Expand All @@ -59,13 +59,13 @@ The servers to be installed by this procedure are:

Installed servers are not yet configured in NvChad. To perform server registration we need to perform additional configuration.

First we create the `custom/plugins` folder in `~/.local/nvim/lua`:
First we create the `custom/plugins` folder in `~/.local/nvim/lua`. Note that if you are following along completely, this path may already be created:

```bash
mkdir -p ~/.local/nvim/lua/custom/plugins
```

We used the `-p` flag since the _custom_ folder was definitely not present. Once the folder is created, we need to create two files: `init.lua`, which will take care of instructing *Packer* to install the plugin, and `lspconfig.lua`, which will define our servers.
We used the `-p` flag since we want to create the entire path if it doesn't already exist. Once the folder is created, we need to create two files: `init.lua`, which will take care of instructing *Packer* to install the plugin, and `lspconfig.lua`, which will define our servers.

Let's start by creating the two files first:

Expand Down Expand Up @@ -107,7 +107,7 @@ nvim ~/.config/nvim/lua/custom/plugins/init.lua

![NvChad init.lua](../images/init_custom_plugins.png)

Once the changes are finished, we save the file with the command `:wq`.
Once the changes are finished, we save the file with the command <kbd>SHIFT</kbd> + <kbd>:wq</kbd>.

We can now edit the configuration file of our local servers.

Expand Down Expand Up @@ -139,17 +139,17 @@ nvim ~/.config/nvim/lua/custom/plugins/lspconfig.lua

![Custom lspconfig.lua](../images/lspconfig_custom.png)

After finishing the changes we save and close the editor as before with `:wq`
After finishing the changes we save and close the editor as before with <kbd>SHIFT</kbd> + <kbd>:wq</kbd>.

As we can see, we have added in the table of `local servers` the servers we have installed with *Mason*:
As we can see, we have added to the table of `local servers` the servers we have installed with *Mason*:

```lua
local servers = { "html", "marksman", "yamlls"}
```

This gives *nvim-lspconfig* a way to retrieve the configurations needed for their operation in the IDE.

Once we have finished the changes, to make them effective we need to tell *Packer* to synchronize them. This is done with a simple `:PackerSync` at the end of which the new installation of *neovim/nvim-lspconfig* will be highlighted in the log. Now opening a Markdown file should bring up a gear icon in the lower right corner and say `LSP - marksman`.
Once we have finished the changes, to make them effective we need to tell *Packer* to synchronize them. This is done with a simple <kbd>SHIFT</kbd> + <kbd>:PackerSync</kbd> at the end of which the new installation of *neovim/nvim-lspconfig* will be highlighted in the log. Now opening a Markdown file should bring up a gear icon in the lower right corner and say `LSP - marksman`.

![Marksman Enable](../images/marksman_enable.png)

Expand Down Expand Up @@ -193,4 +193,4 @@ Once installed it will spring into action whenever we open a `.yaml` file by mak

The use of LSPs greatly aids the editing process, enriching it with advanced features. It also allows us to keep track of its consistency in real time. It is definitely a tool to have in our IDE.

The introduction of *Mason*, although some manual intervention is still required to configure the environment, has made available an automated procedure for the installation of language servers, and more importantly, allows us to avoid the periodic checks for updates that would have been necessary in the case of manual installation. Once installed and configured, all our servers will be upgradeable from the *Mason GUI* with a simple press of the <kbd>U</kbd> key.
The introduction of *Mason*, although some manual intervention is still required to configure the environment, has made available an automated procedure for the installation of language servers. More importantly, it allows us to avoid the periodic checks for updates that would have been necessary in the case of manual installation. Once installed and configured, all our servers will be upgradeable from the *Mason GUI* with a simple press of the <kbd>U</kbd> key.
Loading