71 lines
2.0 KiB
Markdown
71 lines
2.0 KiB
Markdown
```lua
|
|
-- Old stuff removed from config, but saving in case it should be added back.
|
|
return { -- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
"lewis6991/gitsigns.nvim",
|
|
opts = {
|
|
signs = {
|
|
add = { text = "+" },
|
|
change = { text = "~" },
|
|
delete = { text = "_" },
|
|
topdelete = { text = "‾" },
|
|
changedelete = { text = "~" },
|
|
},
|
|
},
|
|
-- Keybinds below have been removed in main init.lua
|
|
on_attach = function(bufnr)
|
|
vim.keymap.set("n", "<leader>hp", require("gitsigns").preview_hunk, { buffer = bufnr, desc = "Preview git hunk" })
|
|
|
|
-- don't override the built-in and fugitive keymaps
|
|
local gs = package.loaded.gitsigns
|
|
vim.keymap.set({ "n", "v" }, "]c", function()
|
|
if vim.wo.diff then
|
|
return "]c"
|
|
end
|
|
vim.schedule(function()
|
|
gs.next_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" })
|
|
vim.keymap.set({ "n", "v" }, "[c", function()
|
|
if vim.wo.diff then
|
|
return "[c"
|
|
end
|
|
vim.schedule(function()
|
|
gs.prev_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
|
|
end,
|
|
|
|
config = function()
|
|
local cmp = require "cmp"
|
|
cmp.setup {
|
|
mapping = cmp.mapping.preset.insert {
|
|
["<Tab>"] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.confirm {
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
select = true,
|
|
}
|
|
-- cmp.select_next_item()
|
|
elseif luasnip.expand_or_locally_jumpable() then
|
|
luasnip.expand_or_jump()
|
|
else
|
|
fallback()
|
|
end
|
|
end, { "i", "s" }),
|
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
-- if cmp.visible() then
|
|
-- cmp.select_prev_item()
|
|
if luasnip.locally_jumpable(-1) then
|
|
luasnip.jump(-1)
|
|
else
|
|
fallback()
|
|
end
|
|
end, { "i", "s" }),
|
|
},
|
|
}
|
|
end,
|
|
}
|
|
```
|