i use arch btw
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Set up automatic formatting on write

+24
+24
nvim/.config/nvim/lua/plugins.lua
··· 250 250 requires = { 'neovim/nvim-lspconfig', 'b0o/SchemaStore.nvim' }, 251 251 after = { 'coq_nvim', 'neodev.nvim', 'mason.nvim' }, 252 252 config = function() 253 + local lsp_formatting = function(bufnr) 254 + vim.lsp.buf.format({ 255 + filter = function(client) 256 + return client.name ~= 'tsserver' 257 + end, 258 + bufnr = bufnr, 259 + }) 260 + end 261 + local augroup = vim.api.nvim_create_augroup('LspFormatting', {}) 262 + local on_attach = function(client, bufnr) 263 + if client.supports_method('textDocument/formatting') then 264 + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) 265 + vim.api.nvim_create_autocmd('BufWritePre', { 266 + group = augroup, 267 + buffer = bufnr, 268 + callback = function() 269 + if client.name ~= 'clangd' then 270 + lsp_formatting(bufnr) 271 + end 272 + end, 273 + }) 274 + end 275 + end 253 276 local lsp_opts = { 277 + on_attach = on_attach, 254 278 settings = { 255 279 Lua = { 256 280 format = {