.config/nvim/lua/config/lsp.lua

changeset 1101
40419d8e3cbb
parent 1099
28f3c3900576
child 1163
40367220022e
equal deleted inserted replaced
1100:27bf2b97c98f 1101:40419d8e3cbb
15 -- Some options are more chill in text mode, this unchills them if a LSP is in 15 -- Some options are more chill in text mode, this unchills them if a LSP is in
16 -- play. Note they're global 16 -- play. Note they're global
17 vim.api.nvim_create_autocmd("LspAttach", { 17 vim.api.nvim_create_autocmd("LspAttach", {
18 once = true, 18 once = true,
19 group = "lsp_attach", 19 group = "lsp_attach",
20 callback = function(args) 20 callback = function()
21 vim.opt.number = true 21 vim.opt.number = true
22 vim.opt.updatetime = 250 22 vim.opt.updatetime = 250
23 end, 23 end,
24 }) 24 })
25 25
37 -- Format on write, but only certain languages 37 -- Format on write, but only certain languages
38 local autoformat_filetypes = { elixir = true, go = true } 38 local autoformat_filetypes = { elixir = true, go = true }
39 39
40 vim.api.nvim_create_autocmd("BufWritePre", { 40 vim.api.nvim_create_autocmd("BufWritePre", {
41 group = vim.api.nvim_create_augroup("lsp_autoformat", { clear = true }), 41 group = vim.api.nvim_create_augroup("lsp_autoformat", { clear = true }),
42 callback = function(opts, bufnr) 42 callback = function()
43 if autoformat_filetypes[vim.bo.filetype] then 43 if autoformat_filetypes[vim.bo.filetype] then
44 vim.lsp.buf.format({ timeout_ms = 100 }) 44 vim.lsp.buf.format({ timeout_ms = 100 })
45 end 45 end
46 end, 46 end,
47 }) 47 })

mercurial