From 04f784a8c6f2b51b60f2b831405e1838ffc08b7c Mon Sep 17 00:00:00 2001 From: danymat Date: Sun, 30 Jan 2022 15:46:53 +0100 Subject: [PATCH] feat: jump_next and jump_prev check if cursor is jumpable --- lua/neogen/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/neogen/init.lua b/lua/neogen/init.lua index 8898bff..93649c6 100644 --- a/lua/neogen/init.lua +++ b/lua/neogen/init.lua @@ -283,13 +283,17 @@ neogen.match_commands = helpers.match_commands --- Jumps to the next cursor template position ---@private function neogen.jump_next() - cursor.jump() + if neogen.jumpable() then + cursor.jump() + end end --- Jumps to the next cursor template position ---@private function neogen.jump_prev() - cursor.jump_prev() + if cursor.jumpable(-1) then + cursor.jump_prev() + end end --- Checks if the cursor can jump backwards or forwards