How to Add Multiple Keybindings to the term_normal Option in snacks.nvim? #1801
-
return {
{
"folke/snacks.nvim",
opts = {
terminal = {
win = {
position = "float",
width = 0.6,
keys = {
term_normal = {
"<esc>",
function()
vim.cmd("stopinsert")
-- self:hide()
end,
mode = "t",
expr = true,
desc = "esc to normal mode",
},
},
},
},
},
},
}
bind c-f scroll-down |
Beta Was this translation helpful? Give feedback.
Answered by
drowning-cat
Apr 25, 2025
Replies: 1 comment 1 reply
-
terminal = {
win = {
keys = {
{
'<C-f>',
function()
vim.print 'Mode = n'
end,
mode = 'n',
},
print_term_ins = { -- You can define or omit the key (`print_term_ins = `), it doesn't matter
'<C-f>',
function()
vim.print 'Mode = t'
end,
mode = 't',
}, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kwdiwt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mode = 't'
— When the terminal is open and you can type directly into it (Terminal mode).mode = 'n'
— When you are on top of terminal window and all Neovim keybindings work (Normal mode).