diff options
| author | troi <blametroi@gmail.com> | 2025-04-14 08:36:13 -0400 |
|---|---|---|
| committer | troi <blametroi@gmail.com> | 2025-04-14 08:36:13 -0400 |
| commit | f89afb34fc0868dd291b1519a15dfcf0dd441ffa (patch) | |
| tree | d3e11907c9c18dd17326eedb560fdb5065005b17 | |
| parent | 8a20fcbc8c4fa720783320ad9ed7900c2d2cddd8 (diff) | |
update readme for odinvmt-neovim-conform
| -rw-r--r-- | README.md | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -205,7 +205,7 @@ Configuration of the LSP: Neovim has a builtin support for LSP. -There is a plugin that makes the setup easier, called [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig). You can install it with your prefered package manager. +There is a plugin that makes the setup easier, called [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig). You can install it with your preferred package manager. A simple configuration that uses the default `ols` settings would be like this: @@ -226,6 +226,32 @@ require'lspconfig'.ols.setup { } ``` +Neovim can run Odinfmt on save using the [conform](https://github.com/stevearc/conform.nvim) plugin. Here is a sample configuration using the [lazy.nvim](https://github.com/folke/lazy.nvim) package manager: + +```lua +local M = { + "stevearc/conform.nvim", + opts = { + notify_on_error = false, + -- Odinfmt gets its configuration from odinfmt.json. It defaults + -- writing to stdout but needs to be told to read from stdin. + formatters = { + odinfmt = { + -- Change where to find the command if it isn't in your path. + command = "odinfmt", + args = { "-stdin" }, + stdin = true, + }, + }, + -- and instruct conform to use odinfmt. + formatters_by_ft = { + odin = { "odinfmt" }, + }, + }, +} +return M +``` + ### Emacs For Emacs, there are two packages available for LSP; lsp-mode and eglot. |