From f13a62d3fd2884865398627d8a168e0c7df82ff4 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 3 May 2025 16:07:54 +0300 Subject: Changed some nvim stuff, giving a try to terminals again, added keybinds to easily open/close the terminal and also Ctrl+HJKL to navigate --- .config/nvim/lua/plugins/snacks.lua | 43 ++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to '.config/nvim/lua/plugins/snacks.lua') diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index 85714b9..7fa7238 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -1,3 +1,13 @@ +local function term_nav(dir) + ---@param self snacks.terminal + return function(self) + return self:is_floating() and '' + or vim.schedule(function() + vim.cmd.wincmd(dir) + end) + end +end + return { 'folke/snacks.nvim', priority = 1000, @@ -21,7 +31,14 @@ return { style = 'compact', filter = function(notif) local exact_filter = { 'No information available', 'No code actions available' } - local contains_filter = { 'fewer lines', 'lines indented', 'lines yanked', 'more lines', 'E486:' } + local contains_filter = { + 'fewer lines', + 'lines indented', + 'lines yanked', + 'more lines', + 'lines moved', + 'E486:', + } for _, msg in ipairs(exact_filter) do if notif.msg == msg then return false @@ -67,7 +84,16 @@ return { -- easing = 'linear', -- }, -- }, - terminal = {}, + terminal = { + win = { + keys = { + nav_h = { '', term_nav('h'), desc = 'Go to Left Window', expr = true, mode = 't' }, + nav_j = { '', term_nav('j'), desc = 'Go to Lower Window', expr = true, mode = 't' }, + nav_k = { '', term_nav('k'), desc = 'Go to Upper Window', expr = true, mode = 't' }, + nav_l = { '', term_nav('l'), desc = 'Go to Right Window', expr = true, mode = 't' }, + }, + }, + }, }, keys = { { @@ -107,7 +133,7 @@ return { { 'nh', function() - Snacks.notifier.show_history() + Snacks.picker.notifications({ layout = 'telescope' }) end, desc = '[N]otification [H]istory', }, @@ -247,18 +273,11 @@ return { }, { - 'nt', + '', function() - Snacks.terminal.open() + Snacks.terminal() end, desc = '[N]ew [T]erminal', }, - { - 'T', - function() - Snacks.terminal.toggle() - end, - desc = 'Toggle [T]erminal', - }, }, } -- cgit v1.3.1