From 9d0e106178a14651f5290dd742761167c353631e Mon Sep 17 00:00:00 2001 From: pablu Date: Thu, 18 Jun 2026 10:16:47 +0200 Subject: dont use cmd+enter for fullscreen in ghostty, add unified vim + hyprland navigation --- dot_config/nvim/init.lua | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'dot_config/nvim/init.lua') diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 11e3d28..b618040 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -38,10 +38,29 @@ vim.keymap.set("n", "-", function() vim.cmd.new() end, { desc = "Pane split down" }) --- vim.api.nvim_set_keymap('n', '', ':wincmd k', { noremap = true, silent = true, desc = "Move to up windows" }); --- vim.api.nvim_set_keymap('n', '', ':wincmd h', { noremap = true, silent = true, desc = "Move to left windows" }); --- vim.api.nvim_set_keymap('n', '', ':wincmd j', { noremap = true, silent = true, desc = "Move to down windows" }); --- vim.api.nvim_set_keymap('n', '', ':wincmd l', { noremap = true, silent = true, desc = "Move to right windows" }); +local function smart_move(direction, vim_cmd) + return function() + local before = vim.api.nvim_get_current_win() + + vim.cmd("wincmd " .. vim_cmd) + + if before == vim.api.nvim_get_current_win() then + vim.system({ + "hyprctl", + "dispatch", + string.format( + "hl.dsp.focus({direction = '%s' })", + direction + ) + }) + end + end +end + +vim.keymap.set('n', '', smart_move("left", "h"), { noremap = true, silent = false, desc = "Move to left windows" }); +vim.keymap.set('n', '', smart_move("right", "l"), { noremap = true, silent = false, desc = "Move to right windows" }); +vim.keymap.set('n', '', smart_move("down", "j"), { noremap = true, silent = false, desc = "Move to down window" }); +vim.keymap.set('n', '', smart_move("up", "k"), { noremap = true, silent = false, desc = "Move to up window" }); vim.api.nvim_set_keymap('n', 'gb', ':bnext', { noremap = true, silent = true, desc = "Go back last buffer" }); @@ -165,7 +184,7 @@ vim.keymap.set("n", "dps", function() local function start_debug(script_name, module, args_str) local package = module:match("^([^:]+)") - + -- Parse arguments string into table local args = {} if args_str and args_str ~= "" then @@ -205,7 +224,7 @@ vim.keymap.set("n", "dps", function() default = last_params[script_name] or "", completion = "file", }, function(args_str) - if args_str ~= nil then -- nil = cancelled, "" = empty input is OK + if args_str ~= nil then -- nil = cancelled, "" = empty input is OK start_debug(script_name, module, args_str) end end) -- cgit 1.3.1