fix: do not autostart the plugin if nvim is passed args
parent
3006e641e2
commit
e65093de39
|
|
@ -3,6 +3,8 @@ local utils = require("persisted.utils")
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local config
|
local config
|
||||||
|
local start_args = vim.fn.argc() > 0 or vim.g.started_with_stdin
|
||||||
|
|
||||||
local e = vim.fn.fnameescape
|
local e = vim.fn.fnameescape
|
||||||
local uv = vim.uv or vim.loop
|
local uv = vim.uv or vim.loop
|
||||||
|
|
||||||
|
|
@ -35,7 +37,7 @@ end
|
||||||
function M.autoload(opts)
|
function M.autoload(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|
||||||
if not opts.force and (vim.fn.argc() > 0 or vim.g.started_with_stdin) then
|
if not opts.force and start_args then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -72,7 +74,7 @@ function M.load(opts)
|
||||||
config.on_autoload_no_session()
|
config.on_autoload_no_session()
|
||||||
end
|
end
|
||||||
|
|
||||||
if config.autostart and M.allowed_dir() then
|
if config.autostart and M.allowed_dir() and not start_args then
|
||||||
M.start()
|
M.start()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -223,7 +225,7 @@ function M.setup(opts)
|
||||||
|
|
||||||
vim.fn.mkdir(config.save_dir, "p")
|
vim.fn.mkdir(config.save_dir, "p")
|
||||||
|
|
||||||
if config.autostart and M.allowed_dir() and vim.g.persisting == nil then
|
if config.autostart and M.allowed_dir() and vim.g.persisting == nil and not start_args then
|
||||||
M.start()
|
M.start()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue