1diff --git a/lua/gabrielgio/formatter.lua b/lua/gabrielgio/formatter.lua
2index ca0ebc774d368ff618d64aae4d6c00f906fcb633..bf882bcbd25a10888d3d25f5ddd86d1add3c9c05 100644
3--- a/lua/gabrielgio/formatter.lua
4+++ b/lua/gabrielgio/formatter.lua
5@@ -2,6 +2,21 @@ local formatter = require("formatter")
6 local go = require("formatter.filetypes.go")
7 local util = require("formatter.util")
8
9+local function yamlfmt()
10+ return { exe = "yamlfmt" }
11+end
12+
13+local function terraformfmt()
14+ return {
15+ exe = "terraform",
16+ args = {
17+ "fmt",
18+ "-",
19+ },
20+ stdin = true,
21+ }
22+end
23+
24 formatter.setup({
25 filetype = {
26 nix = { require("formatter.filetypes.nix").alejandra },
27@@ -9,31 +24,19 @@ lua = { require("formatter.filetypes.lua").stylua },
28 fish = { require("formatter.filetypes.fish").fishindent },
29 javascript = { require("formatter.filetypes.javascript").prettier },
30 go = { go.gofumpt, go.goimports },
31- terraform = {
32- function()
33- return {
34- exe = "terraform",
35- args = {
36- "fmt",
37- "-",
38- },
39- stdin = true,
40- }
41- end,
42- },
43- yaml = {
44- function()
45- return { exe = "yamlfmt" }
46- end,
47- },
48+ terraform = { terraformfmt },
49+ yaml = { yamlfmt },
50 },
51 ["*"] = {
52 require("formatter.filetypes.any").remove_trailing_whitespace,
53 },
54 })
55
56-vim.api.nvim_create_augroup("__formatter__", { clear = true })
57-vim.api.nvim_create_autocmd("BufWritePost", {
58+local augroup = vim.api.nvim_create_augroup
59+local autocmd = vim.api.nvim_create_autocmd
60+
61+augroup("__formatter__", { clear = true })
62+autocmd("BufWritePost", {
63 group = "__formatter__",
64 command = ":FormatWrite",
65 })
66diff --git a/lua/gabrielgio/lsp.lua b/lua/gabrielgio/lsp.lua
67index dc617d5ede62c01b35b1ccf2e0ead20de8136dc9..5eb3908c707337fbbfcfce25f7c9a9e4c59d50d8 100644
68--- a/lua/gabrielgio/lsp.lua
69+++ b/lua/gabrielgio/lsp.lua
70@@ -5,17 +5,14 @@ return vim.keymap.set(mode, keys, v, opts)
71 end
72
73 local function on_attach(client, bufnr)
74- do
75- local bufopts = { noremap = true, silent = true, buffer = bufnr }
76- set_key("n", "gD", vim.lsp.buf.declaration, bufopts)
77- set_key("n", "gd", vim.lsp.buf.definition, bufopts)
78- set_key("n", "K", vim.lsp.buf.hover, bufopts)
79- set_key("n", "gi", vim.lsp.buf.implementation, bufopts)
80- set_key("n", "<C-s>", vim.lsp.buf.signature_help, bufopts)
81- set_key("n", "<space>rn", vim.lsp.buf.declaration, bufopts)
82- set_key("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
83- set_key("n", "<space>f", vim.lsp.buf.formatting, bufopts)
84- end
85+ local bufopts = { noremap = true, silent = true, buffer = bufnr }
86+ set_key("n", "gD", vim.lsp.buf.declaration, bufopts)
87+ set_key("n", "gd", vim.lsp.buf.definition, bufopts)
88+ set_key("n", "K", vim.lsp.buf.hover, bufopts)
89+ set_key("n", "gi", vim.lsp.buf.implementation, bufopts)
90+ set_key("n", "<C-s>", vim.lsp.buf.signature_help, bufopts)
91+ set_key("n", "<space>rn", vim.lsp.buf.declaration, bufopts)
92+ set_key("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
93 return bufnr
94 end
95
96@@ -48,6 +45,7 @@ on_attach = on_attach,
97 })
98
99 lsp_config.lua_ls.setup({
100+ on_attach = on_attach,
101 settings = {
102 Lua = {
103 diagnostics = {
104diff --git a/lua/gabrielgio/trouble.lua b/lua/gabrielgio/trouble.lua
105index 9249c07ef5741728f60cec602c9a3968d9959ee6..37ade3e286e0f02c2c8eea4c3d55891bda3dcc00 100644
106--- a/lua/gabrielgio/trouble.lua
107+++ b/lua/gabrielgio/trouble.lua
108@@ -1,18 +1,6 @@
109 local key = require("gabrielgio.key")
110 local trouble = require("trouble")
111
112-trouble.setup({
113- modes = {
114- test = {
115- mode = "diagnostics",
116- preview = {
117- type = "split",
118- relative = "win",
119- position = "right",
120- size = 0.3,
121- },
122- },
123- },
124-})
125+trouble.setup()
126
127-key.nnoremap("<leader>t", ":Trouble test toggle<cr>")
128+key.nnoremap("<leader>t", ":Trouble diagnostics toggle<cr>")