1
Fork 0

Removed the need for my own augroup helper

This commit is contained in:
Matei Adriel 2022-08-24 14:54:19 +03:00
parent 7c77d3a8dd
commit c610d1ce1a
8 changed files with 12 additions and 113 deletions
dotfiles/neovim/lua/my/plugins

View file

@ -1,7 +1,6 @@
local M = {}
local function map(buf, mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
@ -11,14 +10,14 @@ function M.on_attach(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
if client.server_capabilities.documentFormattingProvider then
print("Initializing formatter...")
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
augroup END
]])
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormatting", {}),
callback = vim.lsp.buf.formatting_sync
})
end
print("Setting up keybinds...")