[neovim] A few things

- LSPSaga x fugitive: :Gvdiffsplit : now aligned
- Killed hlsearch
- <c-l> remapped
- conditional idelayout
This commit is contained in:
Adam Cooper 2024-01-15 15:27:33 -05:00
parent 8e8ace0109
commit 9b360075c9

View file

@ -31,6 +31,9 @@ vim.opt.termguicolors = true
-- Minimal number of lines kept above and below the cursor -- Minimal number of lines kept above and below the cursor
vim.opt.scrolloff = 5 vim.opt.scrolloff = 5
-- Turn off highlight search
vim.opt.hlsearch = false
-- Temporary file locations -- Temporary file locations
vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//" vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//"
vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/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_winsize = 25 -- width of the file explorer
vim.g.netrw_liststyle = 3 -- tree style listing vim.g.netrw_liststyle = 3 -- tree style listing
-- Escape exits terminal mode
-- vim.keymap.set("t", "<Esc>", "<c-\\><c-n>", { noremap = true })
-- Sane vim split naviagation (via Gaslight blog) -- Sane vim split naviagation (via Gaslight blog)
vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true, desc = 'Go to window below' }) vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true, desc = 'Go to window below' })
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' }) vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' })
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true, desc = 'Go to window to the left' }) vim.keymap.set("n", "<c-h>", "<c-w>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", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
-- N.B. This conflicts with the NetRW directory refresh command.
-- vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' }) vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' })
vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { noremap = true, desc = 'Go to window above' }) vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { noremap = true, desc = 'Go to window above' })
vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true, desc = 'Go to window to the left' }) vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true, desc = 'Go to window to the left' })
-- vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' }) vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' })
vim.keymap.set( vim.keymap.set(
{"n", "t"}, {"n", "t"},
"<leader>z", "<leader>z",
function () function ()
-- This restores the UI to the saved layout 'idelayout' (if saved on command line) -- This restores the UI to the saved layout 'idelayout' (if it exists)
-- TODO: Wrap the function body in an if statement to verify existence of idelayout if vim.fn.exists("idelayout") ~= 0 then
-- (This depends on command line commands' being executed before this $VIMRC is loaded vim.cmd("exec idelayout")
vim.cmd("exec idelayout") end
end, end,
{ desc = "Revert window layout" } { desc = "Revert window layout" }
) )
@ -212,14 +212,35 @@ require("lazy").setup({
function() function()
require("dap").step_out() require("dap").step_out()
end, end,
desc = "Step Out", desc = "DAP: Step Out",
}, },
{ {
"<leader>do", "<leader>do",
function() function()
require("dap").step_over() require("dap").step_over()
end, end,
desc = "Step Over", desc = "DAP: Step Over",
},
{
"<leader>db",
function()
require("dap").toggle_breakpoint()
end,
desc = "DAP: Toggle breakpoint",
},
{
"<leader>dc",
function()
require("dap").continue()
end,
desc = "DAP: Continue",
},
{
"<leader>di",
function()
require("dap").step_into()
end,
desc = "DAP: Step Into",
}, },
{ {
"<leader>da", "<leader>da",
@ -234,7 +255,7 @@ require("lazy").setup({
end end
require("dap").continue() require("dap").continue()
end, end,
desc = "Run with Args", desc = "DAP: Run with Args",
}, },
}, },
dependencies = { dependencies = {
@ -672,10 +693,10 @@ vim.api.nvim_create_autocmd(
local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true }) local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true })
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
'BufAdd', 'BufReadCmd',
{ {
group = diffgroup, group = diffgroup,
pattern = "fugitive://*", -- TODO: This doesn't seem to work pattern = "fugitive://*",
callback = function() callback = function()
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' }) vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
end, end,