From e11d413ed2b4d150fb544ec4e38a077448b8a2d2 Mon Sep 17 00:00:00 2001 From: Shi Han NG Date: Sat, 13 Jul 2024 16:08:20 +0900 Subject: [PATCH] Fix error when user command calls nav --- lua/zellij-nav/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/zellij-nav/init.lua b/lua/zellij-nav/init.lua index d96e41b..d1abdd2 100644 --- a/lua/zellij-nav/init.lua +++ b/lua/zellij-nav/init.lua @@ -1,7 +1,11 @@ local M = {} local function nav(short_direction, direction, action) - action = action or "move-focus" + -- Use "move-focus" if nav is called via user command or + -- action is nil. + if type(action) == "table" or not action then + action = "move-focus" + end if action ~= "move-focus" and action ~= "move-focus-or-tab" then error("invalid action: " .. action)