From 4cbbfea1893c802345a45654a7cdbb224e104d25 Mon Sep 17 00:00:00 2001 From: Steven Spencer Date: Tue, 6 Sep 2022 08:11:54 -0500 Subject: [PATCH] Edit 838 - Null ls plugin * Added remaining meta * read for content * sentence structure altered where applicable to simplify and/or improve points * checked for spelling * viewed in web format and checked again Looks good! --- docs/books/nvchad/custom/plugins/null_ls.md | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/books/nvchad/custom/plugins/null_ls.md b/docs/books/nvchad/custom/plugins/null_ls.md index 7f18b7e66f..b1847319b5 100644 --- a/docs/books/nvchad/custom/plugins/null_ls.md +++ b/docs/books/nvchad/custom/plugins/null_ls.md @@ -1,16 +1,20 @@ --- title: Null-ls +author: Franco Colussi +contributors: Steven Spencer +tested with: 8.6, 9.0 tags: - nvchad - coding - editor + - plugins --- # Null-ls -The `jose-elias-alvarez/null-ls.nvim` plugin although not essential to the operation of the IDE is definitely one to have in your configuration, it allows you to use language server features to insert LSPs dedicated to diagnostics, formatting and other operations. +The `jose-elias-alvarez/null-ls.nvim` plugin, although not essential to the operation of the IDE, is definitely one to have in your configuration. It allows you to use language server features to insert LSPs dedicated to diagnostics, formatting, and other operations. -Null-ls aims to simplify the creation, sharing, and setting up of LSP sources; it also enables improved performance by eliminating any external processes. +Null-ls aims to simplify the creation, sharing, and setting up of LSP sources. It enables improved performance by eliminating any external processes. ## Plugin Insertion @@ -25,11 +29,11 @@ Inserting the plugin consists of editing the file `custom/plugins/init.lua` and }, ``` -As also evidenced by the code, the entry must be made after the _neovim/nvim-lspconfig_ plugin, the configuration function is then called and then our configuration file _null-ls.lua_ is requested. +As also evidenced by the code, the entry must be made after the _neovim/nvim-lspconfig_ plugin. The configuration function is then called and our configuration file _null-ls.lua_ is requested. ### LSP Installation Required -For proper operation of language servers these must be installed separately with _Mason_, for installation one can use the interface callable with the command `:Mason` or installation from _statusline_ with the command `:MasonInstall name_lsp`, e.g.: +For proper operation, language servers must be installed separately with _Mason_. For installation, one can use the interface callable with the command `:Mason`, or installation from _statusline_ with the command `:MasonInstall name_lsp`, e.g.: ```text :MasonInstall markdownlint @@ -37,7 +41,7 @@ For proper operation of language servers these must be installed separately with ![Mason UI](../../images/mason_install_ui.png) -The LSPs to be installed are `prettierd`, `markdownlint` and `stylua`. The first two LSPs will provide formatting and diagnostic capabilities for Markdown code, the third provides support for formatting Lua code. +The LSPs to be installed are `prettierd`, `markdownlint` and `stylua`. The first two LSPs will provide formatting and diagnostic capabilities for Markdown code, while the third provides support for formatting Lua code. !!! attention "Markdownlint setting" @@ -45,13 +49,13 @@ The LSPs to be installed are `prettierd`, `markdownlint` and `stylua`. The first ## Creating null-ls.lua -Once we have installed the necessary language servers we can move on to creating the `custom/plugins/null-ls.lua` file. For creation we can use our NvChad: +Once we have installed the necessary language servers, we can move on to creating the `custom/plugins/null-ls.lua` file. To do this we can simply use our NvChad: ```bash nvim ~/.config/nvim/lua/custom/plugins/null-ls.lua ``` -We copy the code below, bring ourselves into our IDE, making sure we are in the NORMAL state and with the p (paste) key we copy it, at which point we save it and close it with the `:wq` command. +We copy the code below, bring ourselves into our IDE making sure we are in the NORMAL state, and with the p (paste) key we insert it. Then we simply save it and close with the `:wq` command. ```lua local present, null_ls = pcall(require, "null-ls") @@ -93,7 +97,7 @@ null_ls.setup { } ``` -Once the changes are finished to instruct NvChad we have to perform a `:PackerSync`, it is advisable to exit the editor and re-enter before doing the sync. +Once the changes are finished, to instruct NvChad we have to perform a `:PackerSync`. It is advisable to exit the editor and re-enter before doing the sync. ### LSP sources @@ -111,19 +115,19 @@ local sources = { ``` -This is where local sources are set up, using the `b.formatting` and `b.diagnostic` functions provided by _null-ls_ followed by our chosen LSPs. For a complete list of the functions included in the plugin, see the [Project Page](https://github.com/jose-elias-alvarez/null-ls.nvim). +Our local sources are set up using the `b.formatting` and `b.diagnostic` functions provided by _null-ls_ followed by our chosen LSPs. For a complete list of the functions included in the plugin, see the [Project Page](https://github.com/jose-elias-alvarez/null-ls.nvim). -For formatting Markdown documents you also have other LSPs available, the setting used here provides excellent support but for a complete list you can consult the [Dedicated Page](https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md). +For formatting Markdown documents you also have other LSPs available. The setting used here provides excellent support but, for a complete list, you can consult the [Dedicated Page](https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md). ### Markdownlint setting _Markdownlint_ works by comparing the code we write with rules set by the project that can be found at [this page](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md). -Once activated each time a Markdown file is modified and the editor return in NORMAL mode, a message should appear in the middle part of the _statusline_ that first informs us of the check with `diagnostic markdown` and then once the check is finished the message of errors founded `diagnostic (0%)`, the percentage refers to the number of errors found and not to the progress in the file. +Once activated each time a Markdown file is modified and the editor return in NORMAL mode, a message should appear in the middle part of the _statusline_. This first informs us of the check with `diagnostic markdown`, and once the check is finished the message of errors found: `diagnostic (0%)`. The percentage refers to the number of errors found and not to the progress in the file. -The rules set by `markdownlint` are very stringent and include, for example, a maximum line length of 80 words, which in writing documentation may not be adequate. To get around these limitations, it is possible to change the settings passed to the executable by placing a `rc` file in the _workspace_directory_ for a project-level override or in one's _home_ for a user-level one. The file should be named `.markdownlintrc` if placed in your own _home_ or `.markdownlint.jsonc` if placed in the project's _workspace_directory_. For working on a fork of the Rocky documentation, the first solution is preferable as it does not interfere with the _Git repository_. +The rules set by `markdownlint` are very stringent and include, for example, a maximum line length of 80 words, which in writing documentation may not be adequate. To get around these limitations, it is possible to change the settings passed to the executable by placing a `rc` file in the _workspace_directory_ for a project-level override, or in one's _home_ for a user-level override. The file should be named `.markdownlintrc` if placed in your own _home_ or `.markdownlint.jsonc` if placed in the project's _workspace_directory_. For working on a fork of the Rocky documentation, the first solution is preferable as it does not interfere with the _Git repository_. -The comments are explanatory of the checks performed by the various rules, in particular the _MD013_ rule on maximum line length (customizable length) if not modified is particularly tedious, the _MD033_ rule is needed to avoid warnings when entering keyboard keys `` and can be integrated in array form with other keys, the _MD025_ rule prevents the interpretation of the title present in the _frontmatter_ giving the `H1` double header error signaling and the _MD046_ rule changes the default (consistent) to _fenced_ this is because in the documentation on Rocky Linux admonitions (indent) are commonly used with block codes (fenced) and this would give an inconsistency error. +The comments are explanatory of the checks performed by the various rules. In particular, the _MD013_ rule on maximum line length (customizable length), if not modified, is particularly tedious. The _MD033_ rule is needed to avoid warnings when entering keyboard keys `` and can be integrated in array form with other keys. The _MD025_ rule prevents the interpretation of the title, present in the _frontmatter_, of generating the `H1` double header error. The _MD046_ rule changes the default (consistent) to _fenced_. This is because in the documentation on Rocky Linux admonitions (indent) are commonly used with block codes (fenced), which would give an inconsistency error. The complete excellently commented example can be found on the [related pages](https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc). @@ -183,6 +187,6 @@ Here, then, is the proposed `.markdownlintrc` file: } ``` -The inclusion of the file should eliminate flags regarding aspects of code control that we want or need to include to write documentation on Rocky Linux, exceptions that would violate the default rules. +The inclusion of the file should eliminate flags regarding aspects of code control that we want or need to include to write documentation on Rocky Linux. These exceptions would otherwise violate the default rules. -In summary, although not indispensable, the _null-ls_ plugin makes a significant contribution to our documentation work, if installed it will help to write correct and consistent code. +In summary, although not indispensable, the _null-ls_ plugin makes a significant contribution to our documentation work. If installed, it will help to write correct and consistent code.