Skip to content
Merged
Changes from 1 commit
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
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ or as part of the `lazy.nvim` plugin spec:
},
...
},

```

## ↩️ Events / Callbacks
Expand Down Expand Up @@ -243,6 +242,29 @@ vim.api.nvim_create_autocmd('User', {

If you want more Events, feel free to open an issue.

### Combine with formatting

There are some caveats on how to (auto-)format a buffer, while using this plugin.
Comment thread
primeapple marked this conversation as resolved.
Outdated
Most of the info here comes from the excellent plugin [stevearc/conform.nvim](https://github.com/stevearc/conform.nvim), especially the [recipes](https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md#autoformat-with-extra-features).

The easiest way is to format independent of the `modified` state and therefore independ of the auto-save.
Set up a shortcut for one of the following lua functions and format on demand
```
# When using stevearc/conform.nvim (use your own options)
require('conform').format({ async = true, lsp_format = 'fallback' })

# When using lsp formatting capabilities
vim.lsp.buf.format()
```

It is also possible to hook up formating to saving, which creates an auto-format workflow:
- Setup auto-format via autocommand on `BufWritePre` event or via another plugin (check the `format_on_save` option in `conform.nvim`).

Some tips:
- Set `noautocmd = true` in the options of this plugin, to only save on manual save
Comment thread
primeapple marked this conversation as resolved.
Outdated
- Check the `undojoin` option if you are using `conform.nvim`.
It merges the formatting changes with the previous editing changes, making undo a little smarter.
Comment thread
primeapple marked this conversation as resolved.
Outdated

## 🤝 Contributing

- All pull requests are welcome.
Expand Down