From ebfe0e13c79ec9b01d9283c87fcdd75e45d2eb3f Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Tue, 1 Aug 2023 15:21:03 -0500 Subject: [PATCH] git stuff and tab helpers --- lua/keymaps.lua | 5 +++++ lua/options.lua | 3 +++ lua/plugins/git.lua | 14 +++++++++----- lua/plugins/lazygit.lua | 2 +- lua/plugins/lsp.lua | 4 ++-- lua/plugins/null-ls.lua | 2 +- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index a282601..d95cc5d 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -22,6 +22,8 @@ require("util").keymaps({ ["w"] = { "w", desc = "Save" }, ["q"] = { "confirm q", desc = "Quit" }, ["cq"] = { "bd", desc = "Close current buffer" }, + ["tn"] = { "tabnew", desc = "" }, + ["tq"] = { "tabclose", desc = "Close current tab" }, ["|"] = { "vsplit", desc = "Vertical Split" }, ["\\"] = { "split", desc = "Horizontal Split" }, [""] = { "zz", desc = "Vertical half page down and center cursor" }, @@ -35,6 +37,9 @@ require("util").keymaps({ [""] = { "j", desc = "Move window below current" }, [""] = { "k", desc = "Move window above current" }, [""] = { "l", desc = "Move window right current" }, + -- tab navigation + [""] = { "tabprevious", desc = "Move to previous tab" }, + [""] = { "tabnext", desc = "Move to next tab" }, -- reformat LSP ["lf"] = { function() diff --git a/lua/options.lua b/lua/options.lua index 4d8baa7..79b29a9 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -49,3 +49,6 @@ vim.o.completeopt = "menuone,noselect" vim.diagnostic.config({ float = { border = "single" }, }) + +-- Turn on new diff +vim.opt.diffopt:append("linematch:20") diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index b28c41e..a048a68 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -19,10 +19,11 @@ return { delay = 0, ignore_whitespace = false, }, - -- on_attach = function() - -- local gs = package.loaded.gitsigns - -- set_nmap('tb', gs.toggle_current_line_blame) - -- end + on_attach = function() + vim.keymap.set("n", "gb", function() + package.loaded.gitsigns.toggle_current_line_blame() + end, { desc = "Toggle git blame on current line" }) + end } }, { @@ -93,6 +94,9 @@ return { height = 16, }, }, - } + }, + keys = { + { "gd", "DiffviewOpen", desc = "Opens git diff view." }, + }, } } diff --git a/lua/plugins/lazygit.lua b/lua/plugins/lazygit.lua index 325a3c5..4ee0284 100644 --- a/lua/plugins/lazygit.lua +++ b/lua/plugins/lazygit.lua @@ -1,4 +1,4 @@ -function prereqs() +local function prereqs() local output = vim.fn.system({ "which", "lazygit", diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 3d3d534..9cd7e11 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,4 +1,4 @@ -function prereqs() +local function prereqs() local output = vim.fn.system({ "which", "rust-analyzer", @@ -172,7 +172,7 @@ return { dependencies = { "nvim-telescope/telescope.nvim" }, config = function() local config = require("lspconfig") - local util = require("lspconfig/util") + -- local util = require("lspconfig/util") local mason_lspconfig = require("mason-lspconfig") local cmp = require("cmp") local luasnip = require("luasnip") diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua index 5706b9c..4e98361 100644 --- a/lua/plugins/null-ls.lua +++ b/lua/plugins/null-ls.lua @@ -1,4 +1,4 @@ -function prereqs() +local function prereqs() local output_cspell = vim.fn.system({ "which", "cspell",