diff --git a/nvim/.config/nvim/lua/plugins/data_analysis.lua b/nvim/.config/nvim/lua/plugins/data_analysis.lua index f52b327..95180e3 100644 --- a/nvim/.config/nvim/lua/plugins/data_analysis.lua +++ b/nvim/.config/nvim/lua/plugins/data_analysis.lua @@ -236,7 +236,6 @@ return { require_confirmation = false, eval_options = {}, }, - lazy = false, }, -- Open ipynb Jupyter notebooks as if they're quarto files diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua index e227f6a..550008e 100644 --- a/nvim/.config/nvim/lua/plugins/git.lua +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -1,29 +1,43 @@ return { { "akinsho/git-conflict.nvim", - event = { "InsertEnter", "CursorHold" }, - config = function() - require("git-conflict").setup({ - default_mappings = false, - disable_diagnostics = true, - }) + event = { "InsertEnter", "CursorHold", "VeryLazy" }, + init = function() if require("core.util").is_available("which-key") then require("which-key").add({ "h", group = "git" }) end + end, + config = function() + require("git-conflict").setup({ + debug = false, + default_mappings = false, -- disable buffer local mapping created by this plugin + default_commands = true, -- disable commands created by this plugin + disable_diagnostics = false, -- This will disable the diagnostics in a buffer whilst it is conflicted + list_opener = "copen", -- command or function to open the conflicts list + highlights = { -- They must have background color, otherwise the default color will be used + incoming = "DiffAdd", + current = "DiffText", + }, + }) local map = vim.keymap.set - map("n", "ho", "(git-conflict-ours)", { desc = "Conflict use ours" }) - map("n", "hO", "(git-conflict-theirs)", { desc = "Conflict use theirs" }) + map("n", "ho", "(git-conflict-ours)", { desc = "Conflict use current" }) + map("n", "hO", "(git-conflict-theirs)", { desc = "Conflict use incoming" }) map("n", "hm", "(git-conflict-both)", { desc = "Conflict use both" }) map("n", "hM", "(git-conflict-none)", { desc = "Conflict use none" }) - map("n", "[H", "(git-conflict-prev-conflict)", { desc = "Prev git conflict" }) - map("n", "]H", "(git-conflict-next-conflict)", { desc = "Next git conflict" }) + map("n", "[H", "(git-conflict-prev-conflict)", { desc = "git conflict backward" }) + map("n", "]H", "(git-conflict-next-conflict)", { desc = "git conflict forward" }) end, - lazy = false, -- TODO needs to be force refreshed in lazy loaded mode unfortunately + lazy = false, -- TODO: needs to be force refreshed in lazy loaded mode unfortunately }, { "lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter - event = { "InsertEnter", "CursorHold" }, + event = { "InsertEnter", "CursorHold", "VeryLazy" }, cmd = "Gitsigns", + init = function() + if require("core.util").is_available("which-key") then + require("which-key").add({ "h", group = "git" }) + end + end, config = function() require("gitsigns").setup({ numhl = true, @@ -46,7 +60,7 @@ return { gs.next_hunk() end) return "" - end, { expr = true, desc = "Next git hunk" }) + end, { expr = true, desc = "git hunk forward" }) map("n", "[h", function() if vim.wo.diff then @@ -56,12 +70,8 @@ return { gs.prev_hunk() end) return "" - end, { expr = true, desc = "Previous git hunk" }) + end, { expr = true, desc = "git hunk backward" }) - -- Actions - if require("core.util").is_available("which-key") then - require("which-key").add({ "h", group = "git" }) - end map({ "n", "v" }, "hs", ":Gitsigns stage_hunk", { desc = "stage hunk" }) map({ "n", "v" }, "hr", ":Gitsigns reset_hunk", { desc = "reset hunk" }) map("n", "hS", gs.stage_buffer, { desc = "stage buffer" }) diff --git a/nvim/.config/nvim/lua/plugins/pickers.lua b/nvim/.config/nvim/lua/plugins/pickers.lua index 0ab8c6b..f10af48 100644 --- a/nvim/.config/nvim/lua/plugins/pickers.lua +++ b/nvim/.config/nvim/lua/plugins/pickers.lua @@ -21,6 +21,25 @@ return { "nvim-lua/plenary.nvim", { "nvim-tree/nvim-web-devicons", optional = true }, }, + init = function() + -- ensure neo-tree gets loaded if we start vim with a directory + -- netrw-like. See https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326 + vim.api.nvim_create_autocmd("BufEnter", { + group = vim.api.nvim_create_augroup("load_neo_tree", {}), + desc = "Loads neo-tree when opening a directory", + callback = function(args) + local stats = vim.uv.fs_stat(args.file) + + if not stats or stats.type ~= "directory" then + return + end + + require("neo-tree") + + return true + end, + }) + end, cmd = "Neotree", opts = { source_selector = { winbar = true }, @@ -28,9 +47,8 @@ return { keys = { { "se", "Neotree toggle left", desc = "filetree", silent = true }, }, - lazy = false, }, - { "MagicDuck/grug-far.nvim", lazy = false, opts = {} }, + { "MagicDuck/grug-far.nvim", opts = {}, cmd = "GrugFar" }, -- fuzzy matching picker { "nvim-telescope/telescope.nvim",