nvim: Lazy load more plugins
This commit is contained in:
parent
a3a5488dcd
commit
d501688031
3 changed files with 48 additions and 21 deletions
|
|
@ -236,7 +236,6 @@ return {
|
||||||
require_confirmation = false,
|
require_confirmation = false,
|
||||||
eval_options = {},
|
eval_options = {},
|
||||||
},
|
},
|
||||||
lazy = false,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Open ipynb Jupyter notebooks as if they're quarto files
|
-- Open ipynb Jupyter notebooks as if they're quarto files
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,43 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"akinsho/git-conflict.nvim",
|
"akinsho/git-conflict.nvim",
|
||||||
event = { "InsertEnter", "CursorHold" },
|
event = { "InsertEnter", "CursorHold", "VeryLazy" },
|
||||||
config = function()
|
init = function()
|
||||||
require("git-conflict").setup({
|
|
||||||
default_mappings = false,
|
|
||||||
disable_diagnostics = true,
|
|
||||||
})
|
|
||||||
if require("core.util").is_available("which-key") then
|
if require("core.util").is_available("which-key") then
|
||||||
require("which-key").add({ "<localleader>h", group = "git" })
|
require("which-key").add({ "<localleader>h", group = "git" })
|
||||||
end
|
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
|
local map = vim.keymap.set
|
||||||
map("n", "<localleader>ho", "<Plug>(git-conflict-ours)", { desc = "Conflict use ours" })
|
map("n", "<localleader>ho", "<Plug>(git-conflict-ours)", { desc = "Conflict use current" })
|
||||||
map("n", "<localleader>hO", "<Plug>(git-conflict-theirs)", { desc = "Conflict use theirs" })
|
map("n", "<localleader>hO", "<Plug>(git-conflict-theirs)", { desc = "Conflict use incoming" })
|
||||||
map("n", "<localleader>hm", "<Plug>(git-conflict-both)", { desc = "Conflict use both" })
|
map("n", "<localleader>hm", "<Plug>(git-conflict-both)", { desc = "Conflict use both" })
|
||||||
map("n", "<localleader>hM", "<Plug>(git-conflict-none)", { desc = "Conflict use none" })
|
map("n", "<localleader>hM", "<Plug>(git-conflict-none)", { desc = "Conflict use none" })
|
||||||
map("n", "[H", "<Plug>(git-conflict-prev-conflict)", { desc = "Prev git conflict" })
|
map("n", "[H", "<Plug>(git-conflict-prev-conflict)", { desc = "git conflict backward" })
|
||||||
map("n", "]H", "<Plug>(git-conflict-next-conflict)", { desc = "Next git conflict" })
|
map("n", "]H", "<Plug>(git-conflict-next-conflict)", { desc = "git conflict forward" })
|
||||||
end,
|
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
|
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
|
||||||
event = { "InsertEnter", "CursorHold" },
|
event = { "InsertEnter", "CursorHold", "VeryLazy" },
|
||||||
cmd = "Gitsigns",
|
cmd = "Gitsigns",
|
||||||
|
init = function()
|
||||||
|
if require("core.util").is_available("which-key") then
|
||||||
|
require("which-key").add({ "<localleader>h", group = "git" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
require("gitsigns").setup({
|
require("gitsigns").setup({
|
||||||
numhl = true,
|
numhl = true,
|
||||||
|
|
@ -46,7 +60,7 @@ return {
|
||||||
gs.next_hunk()
|
gs.next_hunk()
|
||||||
end)
|
end)
|
||||||
return "<Ignore>"
|
return "<Ignore>"
|
||||||
end, { expr = true, desc = "Next git hunk" })
|
end, { expr = true, desc = "git hunk forward" })
|
||||||
|
|
||||||
map("n", "[h", function()
|
map("n", "[h", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then
|
||||||
|
|
@ -56,12 +70,8 @@ return {
|
||||||
gs.prev_hunk()
|
gs.prev_hunk()
|
||||||
end)
|
end)
|
||||||
return "<Ignore>"
|
return "<Ignore>"
|
||||||
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({ "<localleader>h", group = "git" })
|
|
||||||
end
|
|
||||||
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
|
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
|
||||||
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
|
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
|
||||||
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })
|
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,25 @@ return {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
{ "nvim-tree/nvim-web-devicons", optional = true },
|
{ "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",
|
cmd = "Neotree",
|
||||||
opts = {
|
opts = {
|
||||||
source_selector = { winbar = true },
|
source_selector = { winbar = true },
|
||||||
|
|
@ -28,9 +47,8 @@ return {
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>se", "<cmd>Neotree toggle left<cr>", desc = "filetree", silent = true },
|
{ "<leader>se", "<cmd>Neotree toggle left<cr>", desc = "filetree", silent = true },
|
||||||
},
|
},
|
||||||
lazy = false,
|
|
||||||
},
|
},
|
||||||
{ "MagicDuck/grug-far.nvim", lazy = false, opts = {} },
|
{ "MagicDuck/grug-far.nvim", opts = {}, cmd = "GrugFar" },
|
||||||
-- fuzzy matching picker
|
-- fuzzy matching picker
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue