diff --git a/.config/nvim/lua/tsousa/init.lua b/.config/nvim/lua/tsousa/init.lua index f69e45a..5c9b659 100644 --- a/.config/nvim/lua/tsousa/init.lua +++ b/.config/nvim/lua/tsousa/init.lua @@ -37,23 +37,6 @@ autocmd({ "BufWritePre" }, { end }) -autocmd("LspAttach", { - group = TsousaGroup, - callback = function(e) - local bufopts = {buffer = e.buf } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'fo', function() vim.lsp.buf.format { async = true } end, bufopts) - vim.keymap.set('i', '', vim.lsp.buf.signature_help, bufopts) - end -}) - vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 vim.g.netrw_winsize = 25 diff --git a/.config/nvim/lua/tsousa/plugins/formatter.lua b/.config/nvim/lua/tsousa/plugins/formatter.lua new file mode 100644 index 0000000..eba57f2 --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/formatter.lua @@ -0,0 +1,32 @@ +return { + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + lua = { "stylua" }, + python = { "isort", "blue" }, + javascript = { "prettierd" }, + typescript = { "prettierd" }, + html = { "prettierd" }, + json = { "prettierd" }, + yaml = { "prettierd" }, + markdown = { "prettierd" }, + }) + -- vim.api.nvim_create_autocmd("BufWritePre", { + -- pattern = "*", + -- callback = function(args) + -- require("conform").format { bufnr = args.buf, lsp_fallback = true } + -- end, + -- }) + -- local null_ls = require("null-ls") + -- null_ls.setup({ + -- sources = { + -- null_ls.builtins.formatting.rustfmt, + -- null_ls.builtins.formatting.blue, + -- null_ls.builtins.formatting.shfmt, + -- null_ls.builtins.formatting.prettierd.with({ + -- filetypes = { "html", "json", "yaml", "markdown" }, + -- }), + -- } + -- }) + end +} diff --git a/.config/nvim/lua/tsousa/plugins/lsp.lua b/.config/nvim/lua/tsousa/plugins/lsp.lua index 058c696..3c2256e 100644 --- a/.config/nvim/lua/tsousa/plugins/lsp.lua +++ b/.config/nvim/lua/tsousa/plugins/lsp.lua @@ -188,6 +188,7 @@ return { vim.keymap.set('n', 'vd', vim.diagnostic.open_float) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + vim.keymap.set('n', 've', vim.diagnostic.setloclist) -- external (non mason) lsps lspconfig.rust_analyzer.setup({ @@ -212,7 +213,9 @@ return { vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'wss', vim.lsp.buf.workspace_symbol, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'fo', function() vim.lsp.buf.format { async = true } end, bufopts) + -- vim.keymap.set('n', 'fo', function() vim.lsp.buf.format { async = true } end, bufopts) + vim.keymap.set('n', 'fo', + function() require("conform").format({ lsp_fallback = true }) end, bufopts) vim.keymap.set('i', '', vim.lsp.buf.signature_help, bufopts) end }) diff --git a/.config/nvim/lua/tsousa/plugins/null-ls.lua b/.config/nvim/lua/tsousa/plugins/null-ls.lua deleted file mode 100644 index e889bd1..0000000 --- a/.config/nvim/lua/tsousa/plugins/null-ls.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - "nvimtools/none-ls.nvim", - config = function() - local null_ls = require("null-ls") - - null_ls.setup({ - sources = { - null_ls.builtins.formatting.rustfmt, - null_ls.builtins.formatting.blue, - null_ls.builtins.formatting.shfmt, - null_ls.builtins.formatting.prettierd.with({ - filetypes = { "html", "json", "yaml", "markdown" }, - }), - } - }) - end -} diff --git a/.config/nvim/lua/tsousa/remap.lua b/.config/nvim/lua/tsousa/remap.lua index 60c8fde..fd0fb90 100644 --- a/.config/nvim/lua/tsousa/remap.lua +++ b/.config/nvim/lua/tsousa/remap.lua @@ -1,4 +1,5 @@ vim.g.mapleader = " " + vim.keymap.set("n", "pv", vim.cmd.Ex) vim.keymap.set("v", "J", ":m '>+1gv=gv") @@ -10,10 +11,8 @@ vim.keymap.set("n", "", "zz") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") --- greatest remap ever vim.keymap.set("x", "p", "\"_dP") --- next greatest remap ever : asbjornHaland vim.keymap.set("n", "y", "\"+y") vim.keymap.set("v", "y", "\"+y") vim.keymap.set("n", "Y", "\"+Y") @@ -21,8 +20,13 @@ vim.keymap.set("n", "Y", "\"+Y") vim.keymap.set("n", "d", "\"_d") vim.keymap.set("v", "d", "\"_d") --- This is going to get me cancelled vim.keymap.set("n", "Q", "") -vim.keymap.set("n", "s", ":%s/\\<\\>//gI") +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +vim.keymap.set("n", "s", ":%s/\\<\\>//gI") +--vim.keymap.set("n", "x", "!chmod +x %", { silent = true })