From 9f3b4a5c4a00c0ce50fc1ddeeb12772687bbc822 Mon Sep 17 00:00:00 2001 From: Diogo Duarte Date: Sun, 31 Mar 2024 17:23:30 +0100 Subject: [PATCH] Add argument for enabling save_last_directory --- init.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 4093768..a146efc 100644 --- a/init.lua +++ b/init.lua @@ -46,8 +46,10 @@ end) local all_bookmarks = ya.sync(function(state, append_last_dir) local bookmarks = {} - for _, value in pairs(state.bookmarks) do - table.insert(bookmarks, value) + if state.bookmarks then + for _, value in pairs(state.bookmarks) do + table.insert(bookmarks, value) + end end if append_last_dir and state.last_dir then @@ -84,7 +86,7 @@ local delete_all_bookmarks = ya.sync(function(state) end end) -local _save_last_dir = ya.sync(function(state) +local _save_last_directory = ya.sync(function(state) state.curr_dir = { on = "'", desc = "~", -- FIX This might not be true, i.e. the user entry point might not be the home dir @@ -145,7 +147,9 @@ return { return end - _save_last_dir() + if args.save_last_directory then + _save_last_directory() + end state.notify = { enable = false,