From 9b360075c9b039c1dc7dd7e2ea1672b07fc51216 Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Mon, 15 Jan 2024 15:27:33 -0500 Subject: [PATCH] [neovim] A few things - LSPSaga x fugitive: :Gvdiffsplit : now aligned - Killed hlsearch - remapped - conditional idelayout --- neovim/init.lua | 51 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index adb8435..c3fcf9f 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -31,6 +31,9 @@ vim.opt.termguicolors = true -- Minimal number of lines kept above and below the cursor vim.opt.scrolloff = 5 +-- Turn off highlight search +vim.opt.hlsearch = false + -- Temporary file locations vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//" vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//" @@ -40,29 +43,26 @@ vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//" vim.g.netrw_winsize = 25 -- width of the file explorer vim.g.netrw_liststyle = 3 -- tree style listing --- Escape exits terminal mode --- vim.keymap.set("t", "", "", { noremap = true }) - -- Sane vim split naviagation (via Gaslight blog) vim.keymap.set("n", "", "j", { noremap = true, desc = 'Go to window below' }) vim.keymap.set("n", "", "k", { noremap = true, desc = 'Go to window above' }) vim.keymap.set("n", "", "h", { noremap = true, desc = 'Go to window to the left' }) +-- N.B. This conflicts with the NetRW directory refresh command. Use the alternative `:e .`. +vim.keymap.set("n", "", "l", { noremap = true, desc = 'Go to window to the right' }) --- N.B. This conflicts with the NetRW directory refresh command. --- vim.keymap.set("n", "", "l", { noremap = true, desc = 'Go to window to the right' }) vim.keymap.set("t", "", "j", { noremap = true, desc = 'Go to window below' }) vim.keymap.set("t", "", "k", { noremap = true, desc = 'Go to window above' }) vim.keymap.set("t", "", "h", { noremap = true, desc = 'Go to window to the left' }) --- vim.keymap.set("t", "", "l", { noremap = true, desc = 'Go to window to the right' }) +vim.keymap.set("t", "", "l", { noremap = true, desc = 'Go to window to the right' }) vim.keymap.set( {"n", "t"}, "z", function () - -- This restores the UI to the saved layout 'idelayout' (if saved on command line) - -- TODO: Wrap the function body in an if statement to verify existence of idelayout - -- (This depends on command line commands' being executed before this $VIMRC is loaded - vim.cmd("exec idelayout") + -- This restores the UI to the saved layout 'idelayout' (if it exists) + if vim.fn.exists("idelayout") ~= 0 then + vim.cmd("exec idelayout") + end end, { desc = "Revert window layout" } ) @@ -212,14 +212,35 @@ require("lazy").setup({ function() require("dap").step_out() end, - desc = "Step Out", + desc = "DAP: Step Out", }, { "do", function() require("dap").step_over() end, - desc = "Step Over", + desc = "DAP: Step Over", + }, + { + "db", + function() + require("dap").toggle_breakpoint() + end, + desc = "DAP: Toggle breakpoint", + }, + { + "dc", + function() + require("dap").continue() + end, + desc = "DAP: Continue", + }, + { + "di", + function() + require("dap").step_into() + end, + desc = "DAP: Step Into", }, { "da", @@ -234,7 +255,7 @@ require("lazy").setup({ end require("dap").continue() end, - desc = "Run with Args", + desc = "DAP: Run with Args", }, }, dependencies = { @@ -672,10 +693,10 @@ vim.api.nvim_create_autocmd( local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true }) vim.api.nvim_create_autocmd( - 'BufAdd', + 'BufReadCmd', { group = diffgroup, - pattern = "fugitive://*", -- TODO: This doesn't seem to work + pattern = "fugitive://*", callback = function() vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' }) end,