Skip to content

Commit

Permalink
Add a keymap space-f to format buffer using conform (nvim-lua#817)
Browse files Browse the repository at this point in the history
This works also for visual range selection
Copied from conform recipe:
https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md
  • Loading branch information
dam9000 authored and Charlie Batten committed Apr 10, 2024
1 parent 1026b4e commit fc850d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,16 @@ require('lazy').setup({

{ -- Autoformat
'stevearc/conform.nvim',
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_fallback = true }
end,
mode = '',
desc = '[F]ormat buffer',
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
Expand Down

0 comments on commit fc850d9

Please sign in to comment.