diff --git a/init.lua b/init.lua
index f894f726fb4a36b1d82efeeb354e51302e74badd..8760687a5ba66f96a314a46980cf4ad2645c35a9 100644
--- a/init.lua
+++ b/init.lua
@@ -1,53 +1,67 @@
-local path_package = vim.fn.stdpath('data') .. '/site/'
-local mini_path = path_package .. 'pack/deps/start/mini.nvim'
+local path_package = vim.fn.stdpath("data") .. "/site/"
+local mini_path = path_package .. "pack/deps/start/mini.nvim"
+
if not vim.loop.fs_stat(mini_path) then
- vim.cmd('echo "Installing `mini.nvim`" | redraw')
- local clone_cmd = {
- 'git', 'clone', '--filter=blob:none',
- 'https://github.com/echasnovski/mini.nvim', mini_path
- }
- vim.fn.system(clone_cmd)
- vim.cmd('packadd mini.nvim | helptags ALL')
- vim.cmd('echo "Installed `mini.nvim`" | redraw')
+ vim.cmd('echo "Installing `mini.nvim`" | redraw')
+ local clone_cmd = {
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/echasnovski/mini.nvim",
+ mini_path,
+ }
+ vim.fn.system(clone_cmd)
+ vim.cmd("packadd mini.nvim | helptags ALL")
+ vim.cmd('echo "Installed `mini.nvim`" | redraw')
end
-local mini_deps = require('mini.deps')
+local mini_deps = require("mini.deps")
local add = mini_deps.add
mini_deps.setup({ path = { package = path_package } })
local pkgs = {
- "folke/trouble.nvim", -- diagnostics
- "mfussenegger/nvim-dap", -- add dap support
- "nvim-neotest/nvim-nio", -- async support library
- "nvim-lua/plenary.nvim", -- base lib
- "nvim-telescope/telescope.nvim", -- telescope
- "nvim-telescope/telescope-file-browser.nvim", -- telescope file browser
- "TimUntersberger/neogit", -- magit
- "f-person/git-blame.nvim", -- more git info
- "echasnovski/mini.nvim", -- provides many things
- "mhartington/formatter.nvim", -- provider formatter
- "mfussenegger/nvim-lint", -- general linter
- "nvim-treesitter/nvim-treesitter-context", -- show context of where it is at the code
- "mbbill/undotree", -- keep track of undos
- "simrat39/symbols-outline.nvim", -- symbols tree (lsp aware)
- "caenrique/nvim-toggle-terminal", -- help with toggle from and to terminals [DEPRECATED]
- "RRethy/vim-illuminate", -- hightlight use of the same word (lsp aware)
- "sainnhe/edge", -- light theme
- "ellisonleao/gruvbox.nvim", -- light theme
- "williamboman/mason.nvim", -- manages many things
- "williamboman/mason-lspconfig.nvim", -- glue mason and lspconfig
- "neovim/nvim-lspconfig", -- lsp support
+ "folke/trouble.nvim", -- diagnostics
+ "mfussenegger/nvim-dap", -- add dap support
+ "nvim-neotest/nvim-nio", -- async support library
+ "nvim-lua/plenary.nvim", -- base lib
+ "nvim-telescope/telescope.nvim", -- telescope
+ "nvim-telescope/telescope-file-browser.nvim", -- telescope file browser
+ "TimUntersberger/neogit", -- magit
+ "f-person/git-blame.nvim", -- more git info
+ "echasnovski/mini.nvim", -- provides many things
+ "mhartington/formatter.nvim", -- provider formatter
+ "mfussenegger/nvim-lint", -- general linter
+ "nvim-treesitter/nvim-treesitter-context", -- show context of where it is at the code
+ "mbbill/undotree", -- keep track of undos
+ "simrat39/symbols-outline.nvim", -- symbols tree (lsp aware)
+ "caenrique/nvim-toggle-terminal", -- help with toggle from and to terminals [DEPRECATED]
+ "RRethy/vim-illuminate", -- hightlight use of the same word (lsp aware)
+ "sainnhe/edge", -- light theme
+ "ellisonleao/gruvbox.nvim", -- light theme
+ "williamboman/mason.nvim", -- manages many things
+ "williamboman/mason-lspconfig.nvim", -- glue mason and lspconfig
+ "neovim/nvim-lspconfig", -- lsp support
}
add({
- source = "nvim-treesitter/nvim-treesitter",
- hooks = { post_checkout = function() vim.cmd('TSUpdate') end },
+ source = "nvim-treesitter/nvim-treesitter",
+ hooks = {
+ post_checkout = function()
+ vim.cmd("TSUpdate")
+ end,
+ },
})
add({
- source = "fatih/vim-go",
- hooks = { post_checkout = function() vim.cmd('GoUpdateBinaries') end },
+ source = "fatih/vim-go",
+ hooks = {
+ post_checkout = function()
+ vim.cmd("GoUpdateBinaries")
+ end,
+ },
})
-for _, value in ipairs(pkgs) do add({source = value}) end
+for _, value in ipairs(pkgs) do
+ add({ source = value })
+end
require("gabrielgio")
diff --git a/lua/gabrielgio/dap.lua b/lua/gabrielgio/dap.lua
index 238a1bc531275e1fa6fdc5f9ca573f83f9cb3aed..c5f316b69f09c2c7f1459511d091736a08387093 100644
--- a/lua/gabrielgio/dap.lua
+++ b/lua/gabrielgio/dap.lua
@@ -10,20 +10,20 @@ key.nnoremap("<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))<CR>")
key.nnoremap("<leader>dr", ":lua require'dap'.repl.open()<CR>")
dap.adapters.delve = {
- type = "server",
- host = "127.0.0.1",
- port = 2345,
- }
+ type = "server",
+ host = "127.0.0.1",
+ port = 2345,
+}
dap.configurations.go = {
- {
- type = "delve",
- name = "remote",
- mode = "remote",
- request = "attach",
- connect = {
- host = "127.0.0.1",
- port = "2345",
- },
- },
+ {
+ type = "delve",
+ name = "remote",
+ mode = "remote",
+ request = "attach",
+ connect = {
+ host = "127.0.0.1",
+ port = "2345",
+ },
+ },
}
diff --git a/lua/gabrielgio/formatter.lua b/lua/gabrielgio/formatter.lua
new file mode 100644
index 0000000000000000000000000000000000000000..68c8bacb97a03906ea1fc08c3d359eb5c46b348a
--- /dev/null
+++ b/lua/gabrielgio/formatter.lua
@@ -0,0 +1,17 @@
+local formatter = require("formatter")
+
+formatter.setup({
+ filetype = {
+ nix = { require("formatter.filetypes.nix").alejandra },
+ lua = { require("formatter.filetypes.lua").stylua },
+ },
+ ["*"] = {
+ require("formatter.filetypes.any").remove_trailing_whitespace,
+ },
+})
+
+vim.api.nvim_create_augroup("__formatter__", { clear = true })
+vim.api.nvim_create_autocmd("BufWritePost", {
+ group = "__formatter__",
+ command = ":FormatWrite",
+})
diff --git a/lua/gabrielgio/gitsigns.lua b/lua/gabrielgio/gitsigns.lua
index 306e65014b5f6f41976814bd208f6af0dc841094..a238e525fc50cb72193443babc11d29d5ad2146f 100644
--- a/lua/gabrielgio/gitsigns.lua
+++ b/lua/gabrielgio/gitsigns.lua
@@ -1,4 +1,3 @@
local gitsigns = require("gitsigns")
-
gitsigns.setup()
diff --git a/lua/gabrielgio/go.lua b/lua/gabrielgio/go.lua
index ae442b42a433697d4484c76220047fb239705e8b..e0b27b7e74ca76abcba37f63e3c8f52fa1e29da1 100644
--- a/lua/gabrielgio/go.lua
+++ b/lua/gabrielgio/go.lua
@@ -13,4 +13,4 @@ key.nnoremap("<leader>gb", ":GoBuild<cr>")
key.nnoremap("<leader>gr", ":GoDebugRestart<cr>")
key.nnoremap("<leader>gn", ":GoRun<cr>")
key.nnoremap("<leader>gt", ":GoTest<cr>")
-key.nnoremap("<leader>ge", ":exec \":GoDebugPrint \".input(\"eval: \")<cr>")
+key.nnoremap("<leader>ge", ':exec ":GoDebugPrint ".input("eval: ")<cr>')
diff --git a/lua/gabrielgio/init.lua b/lua/gabrielgio/init.lua
index d2eafa8acda729366fba99039a4d75859a110a2a..2c146cfc6d62fce3b790b5dd24e35d048e145128 100644
--- a/lua/gabrielgio/init.lua
+++ b/lua/gabrielgio/init.lua
@@ -1,17 +1,25 @@
-local mini_deps = require('mini.deps')
+local mini_deps = require("mini.deps")
local now, later = mini_deps.now, mini_deps.later
-now(function() require("gabrielgio.settable") end)
-now(function() require("gabrielgio.lsp") end)
-now(function() require("gabrielgio.lazy") end)
+local function require_func(v)
+ return function()
+ require(v)
+ end
+end
-later(function() require("gabrielgio.treesitter") end)
-later(function() require("gabrielgio.mini") end)
-later(function() require("gabrielgio.go") end)
-later(function() require("gabrielgio.telescope") end)
-later(function() require("gabrielgio.undotree") end)
-later(function() require("gabrielgio.so") end)
-later(function() require("gabrielgio.trouble") end)
-later(function() require("gabrielgio.dap") end)
-later(function() require("gabrielgio.term") end)
-later(function() require("gabrielgio.neovide") end)
+now(require_func("gabrielgio.settable"))
+now(require_func("gabrielgio.lsp"))
+now(require_func("gabrielgio.lazy"))
+
+later(require_func("gabrielgio.linter"))
+later(require_func("gabrielgio.formatter"))
+later(require_func("gabrielgio.treesitter"))
+later(require_func("gabrielgio.mini"))
+later(require_func("gabrielgio.go"))
+later(require_func("gabrielgio.telescope"))
+later(require_func("gabrielgio.undotree"))
+later(require_func("gabrielgio.so"))
+later(require_func("gabrielgio.trouble"))
+later(require_func("gabrielgio.dap"))
+later(require_func("gabrielgio.term"))
+later(require_func("gabrielgio.neovide"))
diff --git a/lua/gabrielgio/key.lua b/lua/gabrielgio/key.lua
index ed683b12bb005a8676106dcaae8612b02af65ffc..9219a3a6a3cec1a794504b7fe78df5a380391c8f 100644
--- a/lua/gabrielgio/key.lua
+++ b/lua/gabrielgio/key.lua
@@ -1,13 +1,13 @@
local function bind(op, outer_opts)
- local outer_opts0 = (outer_opts or {noremap = true})
- local function lo(lhs, rhs, opts)
- local opts0 = vim.tbl_extend("force", outer_opts0, (opts or {}))
- return vim.keymap.set(op, lhs, rhs, opts0)
- end
- return lo
+ local outer_opts0 = (outer_opts or { noremap = true })
+ local function lo(lhs, rhs, opts)
+ local opts0 = vim.tbl_extend("force", outer_opts0, (opts or {}))
+ return vim.keymap.set(op, lhs, rhs, opts0)
+ end
+ return lo
end
-local nmap = bind("n", {noremap = false})
+local nmap = bind("n", { noremap = false })
local nnoremap = bind("n")
local vnoremap = bind("v")
local xnoremap = bind("x")
@@ -15,10 +15,10 @@ local inoremap = bind("i")
local tnoremap = bind("t")
return {
- nmap = nmap,
- nnoremap = nnoremap,
- tnoremap = tnoremap,
- vnoremap = vnoremap,
- xnoremap = xnoremap,
- inoremap = inoremap
+ nmap = nmap,
+ nnoremap = nnoremap,
+ tnoremap = tnoremap,
+ vnoremap = vnoremap,
+ xnoremap = xnoremap,
+ inoremap = inoremap,
}
diff --git a/lua/gabrielgio/lazy.lua b/lua/gabrielgio/lazy.lua
index 42ab56730214e434fbf8c2d0bbb1b188f63d314b..93a7b0aeb3bdae3a6b52a3c2ef8272a118187a05 100644
--- a/lua/gabrielgio/lazy.lua
+++ b/lua/gabrielgio/lazy.lua
@@ -1,35 +1,21 @@
-- this file is an amalgamation of configurations that don't have its own
-- config file and will be lazily loaded
-require('gitblame').setup()
-require('neogit').setup()
-require('formatter').setup()
+require("gitblame").setup()
+require("neogit").setup()
require("mason").setup()
-require("mason-lspconfig").setup {
- ensure_installed = {
- "cssls",
- "emmet_ls",
- "gopls",
- "html",
- "lua_ls",
- "pylsp",
- "rust_analyzer",
- "tsserver",
- "zls"
--- "clangd" not working on alpine
- },
-}
-
-local lint = require('lint')
-
-lint.linters_by_ft = {
- go = {"golangcilint"},
- lua = {"luacheck"},
- javascript = {"prettier"},
-}
-
-vim.api.nvim_create_autocmd({ "BufWritePost" }, {
- callback = function()
- lint.try_lint()
- end,
+require("mason-lspconfig").setup({
+ ensure_installed = {
+ "buf",
+ "cssls",
+ "emmet_ls",
+ "gopls",
+ "html",
+ "lua_ls",
+ "nixd",
+ "pylsp",
+ "rust_analyzer",
+ "tsserver",
+ "zls",
+ -- "clangd" not working on alpine
+ },
})
-
diff --git a/lua/gabrielgio/linter.lua b/lua/gabrielgio/linter.lua
new file mode 100644
index 0000000000000000000000000000000000000000..c2d45034d61f7f71f3b3b6dd783c4833a63d92db
--- /dev/null
+++ b/lua/gabrielgio/linter.lua
@@ -0,0 +1,13 @@
+local lint = require("lint")
+
+lint.linters_by_ft = {
+ go = { "golangcilint" },
+ lua = { "luacheck" },
+ javascript = { "prettier" },
+}
+
+vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+ callback = function()
+ lint.try_lint()
+ end,
+})
diff --git a/lua/gabrielgio/lsp.lua b/lua/gabrielgio/lsp.lua
index 5ce2ed5666fa9130d23e912f41ceec9472fb1a1d..d8488590766534bc272323f789779bc19068a93c 100644
--- a/lua/gabrielgio/lsp.lua
+++ b/lua/gabrielgio/lsp.lua
@@ -1,55 +1,57 @@
local lsp_config = require("lspconfig")
local function set_key(mode, keys, v, opts)
- return vim.keymap.set(mode, keys, v, opts)
+ return vim.keymap.set(mode, keys, v, opts)
end
local function on_attach(client, bufnr)
- do
- local bufopts = {noremap = true, silent = true, buffer = bufnr}
- set_key("n", "gD", vim.lsp.buf.declaration, bufopts)
- set_key("n", "gd", vim.lsp.buf.definition, bufopts)
- set_key("n", "K", vim.lsp.buf.hover, bufopts)
- set_key("n", "gi", vim.lsp.buf.implementation, bufopts)
- set_key("n", "<C-s>", vim.lsp.buf.signature_help, bufopts)
- set_key("n", "<space>rn", vim.lsp.buf.declaration, bufopts)
- set_key("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
- set_key("n", "<space>f", vim.lsp.buf.formatting, bufopts)
- end
- return bufnr
+ do
+ local bufopts = { noremap = true, silent = true, buffer = bufnr }
+ set_key("n", "gD", vim.lsp.buf.declaration, bufopts)
+ set_key("n", "gd", vim.lsp.buf.definition, bufopts)
+ set_key("n", "K", vim.lsp.buf.hover, bufopts)
+ set_key("n", "gi", vim.lsp.buf.implementation, bufopts)
+ set_key("n", "<C-s>", vim.lsp.buf.signature_help, bufopts)
+ set_key("n", "<space>rn", vim.lsp.buf.declaration, bufopts)
+ set_key("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
+ set_key("n", "<space>f", vim.lsp.buf.formatting, bufopts)
+ end
+ return bufnr
end
local function setup(f)
- return f({on_attach = on_attach})
+ return f({ on_attach = on_attach })
end
local function load_all(l)
- for _, v in ipairs(l) do setup(v) end
- return nil
+ for _, v in ipairs(l) do
+ setup(v)
+ end
+ return nil
end
load_all({
- lsp_config.rust_analyzer.setup,
- lsp_config.clangd.setup,
- lsp_config.cssls.setup,
- lsp_config.html.setup,
- lsp_config.emmet_ls.setup,
- lsp_config.pylsp.setup,
- lsp_config.zls.setup,
- lsp_config.tsserver.setup
+ lsp_config.rust_analyzer.setup,
+ lsp_config.clangd.setup,
+ lsp_config.cssls.setup,
+ lsp_config.html.setup,
+ lsp_config.emmet_ls.setup,
+ lsp_config.pylsp.setup,
+ lsp_config.zls.setup,
+ lsp_config.tsserver.setup,
})
lsp_config.gopls.setup({
- cmd_env = {GOFLAGS = "-tags=unit,integration,e2e"},
- on_attach = on_attach
+ cmd_env = { GOFLAGS = "-tags=unit,integration,e2e" },
+ on_attach = on_attach,
})
lsp_config.lua_ls.setup({
- settings = {
- Lua = {
- diagnostics = {
- globals = {'vim'}
- }
- }
- }
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { "vim" },
+ },
+ },
+ },
})
diff --git a/lua/gabrielgio/mini.lua b/lua/gabrielgio/mini.lua
index d3f8567d5d2bb0b05854a05a6989ace283489483..2c853cbb3edb3333e80c7e3d1c061fd9b031da50 100644
--- a/lua/gabrielgio/mini.lua
+++ b/lua/gabrielgio/mini.lua
@@ -1,10 +1,10 @@
local diff = require("mini.diff")
local cmp = require("mini.completion")
local status = require("mini.statusline")
-local icons = require('mini.icons')
-local tabline = require('mini.tabline')
+local icons = require("mini.icons")
+local tabline = require("mini.tabline")
-diff.setup({view = {style = 'sign'}})
+diff.setup({ view = { style = "sign" } })
cmp.setup()
status.setup()
icons.setup()
diff --git a/lua/gabrielgio/neovide.lua b/lua/gabrielgio/neovide.lua
index cb712435cfda1705851324d3ae66d8d0ed89f823..5e7e5fae30ab9311f91c89854e09815ee6130291 100644
--- a/lua/gabrielgio/neovide.lua
+++ b/lua/gabrielgio/neovide.lua
@@ -1,7 +1,7 @@
local key = require("gabrielgio.key")
if not vim.g.neovide then
- return
+ return
end
vim.g.neovide_scale_factor = 1
@@ -9,13 +9,13 @@ vim.g.neovide_cursor_antialiasing = true
vim.o.guifont = "iosevka:h20:#e-subpixelantialias"
local function change_scale_factor(delta)
- vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
+ vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
end
key.nnoremap("<leader>-", function()
- change_scale_factor(1.10)
+ change_scale_factor(1.10)
end)
key.nnoremap("<leader>=", function()
- change_scale_factor(1/1.10)
+ change_scale_factor(1 / 1.10)
end)
diff --git a/lua/gabrielgio/settable.lua b/lua/gabrielgio/settable.lua
index 5096d3f0c0f878db7d19d2e181525927279e594f..1307c72cf0473f07e3a49b9f10916dbc57668fd3 100644
--- a/lua/gabrielgio/settable.lua
+++ b/lua/gabrielgio/settable.lua
@@ -26,17 +26,17 @@ vim.opt.showmode = false
vim.opt.colorcolumn = "80"
vim.opt.signcolumn = "yes"
vim.opt.background = "light"
-vim.opt.completeopt = {"menu", "menuone", "noselect"}
+vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.clipboard = (vim.opt.clipboard + "unnamedplus")
-vim.opt.spelllang = {"en", "pt_br", "de"}
+vim.opt.spelllang = { "en", "pt_br", "de" }
vim.opt.list = true
vim.opt.listchars = {
- eol = "\194\172",
- tab = ">\194\183",
- trail = "~",
- extends = ">",
- precedes = "<",
- space = "."
+ eol = "\194\172",
+ tab = ">\194\183",
+ trail = "~",
+ extends = ">",
+ precedes = "<",
+ space = ".",
}
vim.opt.wildignore = (vim.opt.wildignore + "**/.git/*")
vim.g.mapleader = " "
@@ -45,10 +45,10 @@ vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldenable = false
vim.o.background = "light"
-if 1==1 then
- vim.cmd("colorscheme edge")
+if 1 == 1 then
+ vim.cmd("colorscheme edge")
else
- vim.cmd("colorscheme gruvbox")
+ vim.cmd("colorscheme gruvbox")
end
vim.g.loaded = 1
vim.g.loaded_netrwPlugin = 1
@@ -57,7 +57,6 @@ vim.g.maplocalleader = ";"
vim.g.cmake_build_dir = "build"
vim.g.cmake_build_type = "Debug"
-
key.nnoremap("<leader>w", "<C-w>w")
key.nnoremap("<TAB>", ":bnext<CR>")
diff --git a/lua/gabrielgio/telescope.lua b/lua/gabrielgio/telescope.lua
index 50e07b8830ef0a5d85fbe6e22f65286658fc2d70..b1e6cbe6079c114eec0b55e98fdf4a5f6bef9c1a 100644
--- a/lua/gabrielgio/telescope.lua
+++ b/lua/gabrielgio/telescope.lua
@@ -2,24 +2,24 @@ local key = require("gabrielgio.key")
local builtins = require("telescope.builtin")
local telescope = require("telescope")
-telescope.setup{
- defaults = {
- file_ignore_patterns = {
- "vendor/",
- ".git/"
- },
- vimgrep_arguments = {
- "rg",
- "--color=never",
- "--no-heading",
- "--with-filename",
- "--line-number",
- "--column",
- "--smart-case",
- "--hidden"
- }
- },
-}
+telescope.setup({
+ defaults = {
+ file_ignore_patterns = {
+ "vendor/",
+ ".git/",
+ },
+ vimgrep_arguments = {
+ "rg",
+ "--color=never",
+ "--no-heading",
+ "--with-filename",
+ "--line-number",
+ "--column",
+ "--smart-case",
+ "--hidden",
+ },
+ },
+})
telescope.load_extension("file_browser")
diff --git a/lua/gabrielgio/treesitter.lua b/lua/gabrielgio/treesitter.lua
index 409180542a950f11ac939916d761c2b9515834ad..d15aa0549edaf30b4ea58b0710250b1ae0fb1715 100644
--- a/lua/gabrielgio/treesitter.lua
+++ b/lua/gabrielgio/treesitter.lua
@@ -1,6 +1,6 @@
local tree_sitter = require("nvim-treesitter.configs")
tree_sitter.setup({
- ensure_installed = {"c", "go"},
- highlight = {enable = true}
+ ensure_installed = { "c", "go" },
+ highlight = { enable = true },
})
diff --git a/lua/gabrielgio/trouble.lua b/lua/gabrielgio/trouble.lua
index f48fec40ad2a5af00c1a4d1091ba77f7a045bc26..9249c07ef5741728f60cec602c9a3968d9959ee6 100644
--- a/lua/gabrielgio/trouble.lua
+++ b/lua/gabrielgio/trouble.lua
@@ -1,18 +1,18 @@
local key = require("gabrielgio.key")
local trouble = require("trouble")
-trouble.setup{
- modes = {
- test = {
- mode = "diagnostics",
- preview = {
- type = "split",
- relative = "win",
- position = "right",
- size = 0.3,
- },
- },
- },
-}
+trouble.setup({
+ modes = {
+ test = {
+ mode = "diagnostics",
+ preview = {
+ type = "split",
+ relative = "win",
+ position = "right",
+ size = 0.3,
+ },
+ },
+ },
+})
key.nnoremap("<leader>t", ":Trouble test toggle<cr>")