Thu, 11 Apr 2024 13:19:24 -0400
add .luarc.jsonc
1016 | 1 | vim.diagnostic.config({ |
1099
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
2 | float = { |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
3 | close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
4 | focusable = false, |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
5 | header = "", |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
6 | max_width = 72, |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
7 | source = "if_many", |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
8 | style = "minimal", |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
9 | }, |
1032
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
10 | severity_sort = true, |
1099
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
11 | underline = true, |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
12 | virtual_text = false, |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
13 | }) |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
14 | |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
15 | -- Some options are more chill in text mode, this unchills them if a LSP is in |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
16 | -- play. Note they're global |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
17 | vim.api.nvim_create_autocmd("LspAttach", { |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
18 | once = true, |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
19 | group = "lsp_attach", |
1101 | 20 | callback = function() |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
21 | vim.opt.number = true |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
22 | vim.opt.updatetime = 250 |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
23 | end, |
1016 | 24 | }) |
25 | ||
26 | vim.api.nvim_create_autocmd("LspAttach", { | |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
27 | group = "lsp_attach", |
1016 | 28 | callback = function(args) |
1032
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
29 | vim.api.nvim_create_autocmd("CursorHold", { |
1064 | 30 | group = vim.api.nvim_create_augroup("lsp_buf_diags", { clear = true }), |
1099
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
31 | buffer = args.buf, |
28f3c3900576
clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents:
1083
diff
changeset
|
32 | callback = vim.diagnostic.open_float, |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
33 | }) |
1064 | 34 | end, |
1016 | 35 | }) |
1059
dc0095e5bbc8
disable rubocop and formatting in solargraph, add standardrb glue
Meredith Howard <mhoward@roomag.org>
parents:
1032
diff
changeset
|
36 | |
1062
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
37 | -- Format on write, but only certain languages |
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
38 | local autoformat_filetypes = { elixir = true, go = true } |
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
39 | |
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
40 | vim.api.nvim_create_autocmd("BufWritePre", { |
1064 | 41 | group = vim.api.nvim_create_augroup("lsp_autoformat", { clear = true }), |
1101 | 42 | callback = function() |
1062
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
43 | if autoformat_filetypes[vim.bo.filetype] then |
1069
0e871a1b59e3
use current format function
Meredith Howard <mhoward@roomag.org>
parents:
1064
diff
changeset
|
44 | vim.lsp.buf.format({ timeout_ms = 100 }) |
1062
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
45 | end |
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
46 | end, |
77bf3b44f6f9
Add format-on-write for elixir and go
Meredith Howard <mhoward@roomag.org>
parents:
1061
diff
changeset
|
47 | }) |