config(nvim): move some keymaps
This commit is contained in:
1 parent
93adcfeb17
commit
d42da38ed0
6 files changed
+51
-22
No files matched your search
@@ -90,3 +90,41 @@ au({ "BufNewFile", "BufRead" }, {
|
||||
vim.diagnostic.disable(0)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Use the more sane snippet session leave logic. Copied from:
|
||||
-- https://github.com/L3MON4D3/LuaSnip/issues/258#issuecomment-1429989436
|
||||
au("ModeChanged", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
if
|
||||
((vim.v.event.old_mode == "s" and vim.v.event.new_mode == "n") or vim.v.event.old_mode == "i")
|
||||
and require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not require("luasnip").session.jump_active
|
||||
then
|
||||
require("luasnip").unlink_current()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local numbertoggle = ag("numbertoggle", { clear = true })
|
||||
-- Toggle between relative/absolute line numbers
|
||||
au({ "BufEnter", "FocusGained", "InsertLeave", "CmdlineLeave", "WinEnter" }, {
|
||||
pattern = "*",
|
||||
group = numbertoggle,
|
||||
callback = function()
|
||||
if vim.o.nu and vim.api.nvim_get_mode().mode ~= "i" then
|
||||
vim.opt.relativenumber = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
au({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter", "WinLeave" }, {
|
||||
pattern = "*",
|
||||
group = numbertoggle,
|
||||
callback = function()
|
||||
if vim.o.nu then
|
||||
vim.opt.relativenumber = false
|
||||
vim.cmd.redraw()
|
||||
end
|
||||
end,
|
||||
})
|
||||
Reference in new issue
Block a user