From 2bdb8e66d41a73cc89811ff335671903eaa1e364 Mon Sep 17 00:00:00 2001 From: Kim Gert Nielsen Date: Thu, 21 Mar 2024 06:38:47 +0100 Subject: [PATCH] Don't fail if line no longer exist --- lua/marlin/init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/marlin/init.lua b/lua/marlin/init.lua index 3c7aecd..0e604ba 100644 --- a/lua/marlin/init.lua +++ b/lua/marlin/init.lua @@ -278,10 +278,12 @@ marlin.open = function(index, opts) marlin.opts.open_callback(bufnr, opts) if set_position then - vim.api.nvim_win_set_cursor(0, { - cur_item.row or 1, - cur_item.col or 0, - }) + pcall(function() + vim.api.nvim_win_set_cursor(0, { + cur_item.row or 1, + cur_item.col or 0, + }) + end) end end