瀏覽代碼

Add a keymap space-f to format buffer using conform (#817)

This works also for visual range selection
Copied from conform recipe:
https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md
Damjan 9000 2 年之前
父節點
當前提交
1175f6d25a
共有 1 個文件被更改,包括 10 次插入 和 0 次删除
  1. 10 0
      init.lua

+ 10 - 0
init.lua

@@ -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)