projects
/
dotfiles
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
80f8643
)
Added W command that writes and formats
author
Lukas Krickl
<lukas@krickl.dev>
Mon, 21 Aug 2023 16:40:06 +0000
(18:40 +0200)
committer
Lukas Krickl
<lukas@krickl.dev>
Mon, 21 Aug 2023 16:40:06 +0000
(18:40 +0200)
nvim/lua/plugin/lspzero.lua
patch
|
blob
|
history
diff --git
a/nvim/lua/plugin/lspzero.lua
b/nvim/lua/plugin/lspzero.lua
index 4ff81f9631a87fa9f32e75098313178015e19ae7..d80151d05f7a70a4e3655a0a16695cf6348f9ffc 100644
(file)
--- a/
nvim/lua/plugin/lspzero.lua
+++ b/
nvim/lua/plugin/lspzero.lua
@@
-24,9
+24,13
@@
lsp.on_attach(function(client, bufnr)
-- autocmd format on save
-- vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
vim.keymap.set('n', 'gp',
+ vim.lsp.buf.format, { buffer = true })
+
+ vim.api.nvim_create_user_command("W",
function()
vim.lsp.buf.format()
- end, { buffer = true })
+ vim.cmd('w')
+ end, { nargs = 0, desc = 'Write and format' })
end)