nvim bugfixes
This commit is contained in:
+36
-12
@@ -908,7 +908,7 @@ local function makespec_fugitive()
|
|||||||
group = vim.api.nvim_create_augroup("fugitive_folds", { clear = true }),
|
group = vim.api.nvim_create_augroup("fugitive_folds", { clear = true }),
|
||||||
pattern = { "fugitive", "gitcommit" },
|
pattern = { "fugitive", "gitcommit" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.opt_local.foldmethod = "syntax"
|
vim.opt_local.foldmethod = "expr"
|
||||||
vim.opt_local.foldlevel = 99
|
vim.opt_local.foldlevel = 99
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@@ -1183,7 +1183,22 @@ local function makespec_snacks()
|
|||||||
}):map("<leader>uS")
|
}):map("<leader>uS")
|
||||||
|
|
||||||
-- Toggle for Neoscroll
|
-- Toggle for Neoscroll
|
||||||
local ns_keys = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" }
|
local ns_keys = {
|
||||||
|
["<C-u>"] = function() require("neoscroll").ctrl_u({ half_win_duration = 250 }) end,
|
||||||
|
["<C-d>"] = function() require("neoscroll").ctrl_d({ half_win_duration = 250 }) end,
|
||||||
|
["<C-b>"] = function() require("neoscroll").ctrl_b({ half_win_duration = 450 }) end,
|
||||||
|
["<C-f>"] = function() require("neoscroll").ctrl_f({ half_win_duration = 450 }) end,
|
||||||
|
["<C-y>"] = function()
|
||||||
|
require("neoscroll").scroll(-0.1, { move_cursor = false, duration = 100 })
|
||||||
|
end,
|
||||||
|
["<C-e>"] = function()
|
||||||
|
require("neoscroll").scroll(0.1, { move_cursor = false, duration = 100 })
|
||||||
|
end,
|
||||||
|
["zt"] = function() require("neoscroll").zt({ half_win_duration = 250 }) end,
|
||||||
|
["zz"] = function() require("neoscroll").zz({ half_win_duration = 250 }) end,
|
||||||
|
["zb"] = function() require("neoscroll").zb({ half_win_duration = 250 }) end,
|
||||||
|
}
|
||||||
|
|
||||||
vim.g.neoscroll_enabled = false
|
vim.g.neoscroll_enabled = false
|
||||||
|
|
||||||
Snacks.toggle({
|
Snacks.toggle({
|
||||||
@@ -1192,14 +1207,13 @@ local function makespec_snacks()
|
|||||||
set = function(state)
|
set = function(state)
|
||||||
vim.g.neoscroll_enabled = state
|
vim.g.neoscroll_enabled = state
|
||||||
if state then
|
if state then
|
||||||
-- Turn ON: Tell neoscroll to hijack the keys
|
-- Turn ON: Map the keys to Neoscroll's functions
|
||||||
require("neoscroll").setup({
|
for key, func in pairs(ns_keys) do
|
||||||
mappings = ns_keys,
|
vim.keymap.set({ "n", "v", "x" }, key, func, { desc = "Smooth Scroll " .. key })
|
||||||
hide_cursor = true,
|
end
|
||||||
})
|
|
||||||
else
|
else
|
||||||
-- Turn OFF: Delete the hijacks so Neovim returns to default scrolling
|
-- Turn OFF: Delete the maps, returning Neovim to default scrolling
|
||||||
for _, key in ipairs(ns_keys) do
|
for key, _ in pairs(ns_keys) do
|
||||||
pcall(vim.keymap.del, { "n", "v", "x" }, key)
|
pcall(vim.keymap.del, { "n", "v", "x" }, key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1526,13 +1540,23 @@ local function makespec_lint()
|
|||||||
}
|
}
|
||||||
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup("nvim_lint", { clear = true })
|
local lint_augroup = vim.api.nvim_create_augroup("nvim_lint", { clear = true })
|
||||||
|
local timer = vim.uv.new_timer()
|
||||||
|
|
||||||
-- Use a timer to debounce linting to prevent UI stutter
|
-- Use a timer to debounce linting to prevent UI stutter
|
||||||
local timer = vim.uv.new_timer()
|
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||||
group = lint_augroup,
|
group = lint_augroup,
|
||||||
callback = function()
|
callback = function(args)
|
||||||
timer:start(200, 0, vim.schedule_wrap(function() lint.try_lint() end))
|
timer:stop()
|
||||||
|
local bufnr = args.buf
|
||||||
|
timer:start(
|
||||||
|
200,
|
||||||
|
0,
|
||||||
|
vim.schedule_wrap(function()
|
||||||
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
|
require("lint").try_lint(nil, { bufnr = bufnr })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user