From ba5f0ab0916bba865e67cbcea943f06ac5fd92af Mon Sep 17 00:00:00 2001 From: olimorris Date: Tue, 19 Apr 2022 13:29:07 +0100 Subject: [PATCH] fix: #8 autoload when neovim opened with arguments --- lua/persisted/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/persisted/init.lua b/lua/persisted/init.lua index e825f13..3b72463 100644 --- a/lua/persisted/init.lua +++ b/lua/persisted/init.lua @@ -110,10 +110,14 @@ end function M.setup(opts) config.setup(opts) setup_commands() - if config.options.autoload and (allow_dir() and not ignore_dir()) then + if config.options.autoload and (allow_dir() and not ignore_dir()) and vim.fn.argc() == 0 then M.load() end - if config.options.autosave and (allow_dir() and not ignore_dir() and vim.g.persisting == nil) then + if + config.options.autosave + and (allow_dir() and not ignore_dir() and vim.g.persisting == nil) + and vim.fn.argc() == 0 + then M.start() end end