From 2333652b475797751f5c860f7fdacaabf1d5c492 Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Fri, 3 Feb 2023 21:12:10 +0100 Subject: Add git related keybinds and colorcolumn to neovim config --- .config/nvim/lua/general.lua | 1 + .config/nvim/lua/keybinds.lua | 6 ++++++ .config/nvim/lua/lsp.lua | 48 ++++++++++++++++++++++--------------------- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua index 17b6885..28b4980 100644 --- a/.config/nvim/lua/general.lua +++ b/.config/nvim/lua/general.lua @@ -8,6 +8,7 @@ vim.opt.undofile = true vim.opt.backupcopy = "yes" vim.opt.undolevels = 1000 vim.opt.wrap = false +vim.opt.colorcolumn = "80,120" -- vim.opt.tabstop = 4 -- vim.opt.softtabstop = -1 diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua index 3d4eac2..97d7548 100644 --- a/.config/nvim/lua/keybinds.lua +++ b/.config/nvim/lua/keybinds.lua @@ -26,6 +26,9 @@ vim.keymap.set("n", "D", telescope.lsp_definitions) vim.keymap.set("n", "R", telescope.lsp_references) vim.keymap.set("n", "m", ":MinimapToggle") +vim.keymap.set("n", "b", ":Gitsigns blame_line") +vim.keymap.set("n", "h", ":Gitsigns preview_hunk") +vim.keymap.set("n", "d", ":Gitsigns diffthis") vim.keymap.set("n", ",", ":TroubleToggle") vim.keymap.set("n", "t", ":belowright split | resize 5 | terminal") vim.keymap.set("n", "s", ":w") @@ -50,6 +53,9 @@ wk.register({ ["r"] = "Rename"; ["n"] = "Show file tree"; ["m"] = "Toggle Minimap"; + ["b"] = "Blame line"; + ["h"] = "Preview hunk"; + ["d"] = "Diff this"; ["d"] = "Show diagnostics"; ["t"] = "Open terminal"; ["s"] = "Save file"; diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index f404e3d..c228893 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -23,23 +23,25 @@ cmp.setup({ { name = "nvim_lsp"; entry_filter = function(entry, ctx) - return require('cmp.types').lsp.CompletionItemKind[entry:get_kind()] ~= 'Text' + return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= + "Text" end; }; { name = "vsnip"; entry_filter = function(entry, ctx) - return require('cmp.types').lsp.CompletionItemKind[entry:get_kind()] ~= 'Text' + return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= + "Text" end; }; - }, - { + }, { { name = "buffer"; entry_filter = function(entry, ctx) - return require('cmp.types').lsp.CompletionItemKind[entry:get_kind()] ~= 'Text' + return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= + "Text" end; - } + }; }); }) @@ -239,23 +241,23 @@ local null_ls = require("null-ls") null_ls.setup({ sources = { - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.formatting.eslint, - -- null_ls.builtins.formatting.lua_format, - -- null_ls.builtins.formatting.prettier, - -- null_ls.builtins.formatting.rustfmt, - -- null_ls.builtins.code_actions.shellcheck, - -- null_ls.builtins.completion.spell, - -- null_ls.builtins.diagnostics.tsc, - -- null_ls.builtins.formatting.deno_fmt, - -- null_ls.builtins.code_actions.gitsigns.with({ - -- config = { - -- filter_actions = function(title) - -- return title:lower():match("blame") == nil -- filter out blame actions - -- end, - -- }, - -- }) - }, + null_ls.builtins.diagnostics.eslint; + null_ls.builtins.formatting.eslint; +-- null_ls.builtins.formatting.lua_format; +-- null_ls.builtins.formatting.prettier; + null_ls.builtins.formatting.rustfmt; +-- null_ls.builtins.code_actions.shellcheck; +-- null_ls.builtins.completion.spell; +-- null_ls.builtins.diagnostics.tsc; +-- null_ls.builtins.formatting.deno_fmt; +-- null_ls.builtins.code_actions.gitsigns.with({ +-- config = { +-- filter_actions = function(title) +-- return title:lower():match("blame") == nil -- filter out blame actions +-- end; +-- }; +-- }); + }; }) vim.diagnostic.config({ -- cgit v1.2.3