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 Mar 31, 2024
1 parent 93fde05 commit 1175f6d
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 @@ -600,6 +600,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 1175f6d

Please sign in to comment.