Files
LazyVim-mirror/lua/lazyvim/plugins/util.lua
Iordanis Petkakis c64a61734f fix(terminal): partially revert previous mappings (#6770)
## Description
Commit 4efd0e2bea introduced some changes
to terminal mappings. I tested in a new LazyVim installation and
`sidekick.nvim` is not affected by `<C-/>` any more.

The mappings `hide_underscore` and `hide_slash` don't let user to create
new terminals with `2<C-/>`, `3<C-/>` and so on. Instead they hide the
terminal and user can't open split terminals next to each other any
more.

Therefore, I believe it would be a better default to revert these 2
mappings explicitly.

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
None
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2025-11-11 09:35:25 +01:00

57 lines
2.0 KiB
Lua

-- Terminal Mappings
local function term_nav(dir)
---@param self snacks.terminal
return function(self)
return self:is_floating() and "<c-" .. dir .. ">" or vim.schedule(function()
vim.cmd.wincmd(dir)
end)
end
end
return {
-- Snacks utils
{
"snacks.nvim",
opts = {
bigfile = { enabled = true },
quickfile = { enabled = true },
terminal = {
win = {
keys = {
nav_h = { "<C-h>", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" },
nav_j = { "<C-j>", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" },
nav_k = { "<C-k>", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" },
nav_l = { "<C-l>", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" },
},
},
},
},
-- stylua: ignore
keys = {
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
{ "<leader>dps", function() Snacks.profiler.scratch() end, desc = "Profiler Scratch Buffer" },
},
},
-- Session management. This saves your session in the background,
-- keeping track of open buffers, window arrangement, and more.
-- You can restore sessions when returning through the dashboard.
{
"folke/persistence.nvim",
event = "BufReadPre",
opts = {},
-- stylua: ignore
keys = {
{ "<leader>qs", function() require("persistence").load() end, desc = "Restore Session" },
{ "<leader>qS", function() require("persistence").select() end,desc = "Select Session" },
{ "<leader>ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" },
{ "<leader>qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" },
},
},
-- library used by other plugins
{ "nvim-lua/plenary.nvim", lazy = true },
}