feat(nvim): use rstfmt for rst file formatting

Add `vimPlugins.conform-nvim` to add formatting rst files with `rstfmt`.

This isn't supported as a formatter in `none-ls`, and I wanted to try
and potentially switch to `conform-nvim` and `nvim-lint` in the future,
so this is a potential first step towards that.

`rstfmt` itself is already installed and available within my additional
Vim packages.

This currently needs to be run manually, as I don't want to change my
default keybind for formatting until I've supported all the filetypes and formatters
I have in `none-ls`.

To run the foramt manually, run `:lua require"conform".format()`.

See:

- https://github.com/stevearc/conform.nvim
- https://github.com/mfussenegger/nvim-lint
- https://pypi.org/project/rstfmt
- https://www.youtube.com/watch?v=ybUE4D80XSk
This commit is contained in:
Oliver Davies 2023-11-04 21:42:53 +00:00
parent f97d7008e2
commit 6c610fea29
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,11 @@
local conform = require "conform"
conform.setup {
formatters_by_ft = {
rst = { "rstfmt" },
},
}
conform.formatters.rstfmt = {
command = "rstfmt";
}

View file

@ -595,7 +595,8 @@ in
vimPlugins.nvim-treesitter-context
vimPlugins.nvim-treesitter-textobjects
# LSP
# LSP, linting and formatting
pkgsUnstable.vimPlugins.conform-nvim
pkgsUnstable.vimPlugins.none-ls-nvim
vimPlugins.lsp-status-nvim
vimPlugins.nvim-lspconfig