From 459fe1cd9079bc4c91eaa8448b7423815b6fe55c Mon Sep 17 00:00:00 2001 From: Gabriel Crispino Date: Sun, 31 Mar 2024 04:38:34 +0100 Subject: [PATCH 1/2] Add LSP keymap to format current buffer in --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.lua b/init.lua index db55a9e8fd..8b662a4c31 100644 --- a/init.lua +++ b/init.lua @@ -501,6 +501,11 @@ require('lazy').setup({ -- For example, in C this would take you to the header. map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- Formats the current buffer + map('f', function() + vim.lsp.buf.format { async = true } + end, '[F]ormat code') + -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed From c36d32979a9c059f460b7d3b2b4d352ed51ca30e Mon Sep 17 00:00:00 2001 From: Gabriel Crispino Date: Sun, 31 Mar 2024 06:16:14 +0100 Subject: [PATCH 2/2] replace f with f --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 8b662a4c31..ea40301bb6 100644 --- a/init.lua +++ b/init.lua @@ -502,7 +502,7 @@ require('lazy').setup({ map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- Formats the current buffer - map('f', function() + map('f', function() vim.lsp.buf.format { async = true } end, '[F]ormat code')