mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-06-02 02:35:01 +00:00
Merge branch 'main' into dev
This commit is contained in:
@@ -6,6 +6,7 @@ config.options = {
|
||||
events = {"InsertLeave", "TextChanged"},
|
||||
conditions = {
|
||||
exists = true,
|
||||
filename_is_not = {},
|
||||
filetype_is_not = {},
|
||||
modifiable = true,
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@ local function actual_save()
|
||||
end
|
||||
|
||||
local function assert_user_conditions()
|
||||
local sc_exists, sc_filetype, sc_modifiable = true, true, true
|
||||
local sc_exists, sc_filename, sc_filetype, sc_modifiable = true, true, true, true
|
||||
|
||||
for condition, value in pairs(opts["conditions"]) do
|
||||
if condition == "exists" then
|
||||
@@ -70,6 +70,13 @@ local function assert_user_conditions()
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif condition == "filename_is_not" then
|
||||
if not (next(opts["conditions"]["filename_is_not"]) == nil) then
|
||||
if table_has_value(opts["conditions"]["filename_is_not"], vim.fn.expand('%:t')) == true then
|
||||
sc_filename = false
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif condition == "filetype_is_not" then
|
||||
if not (next(opts["conditions"]["filetype_is_not"]) == nil) then
|
||||
if table_has_value(opts["conditions"]["filetype_is_not"], api.nvim_eval([[&filetype]])) == true then
|
||||
@@ -80,7 +87,7 @@ local function assert_user_conditions()
|
||||
end
|
||||
end
|
||||
|
||||
return { sc_exists, sc_filetype, sc_modifiable }
|
||||
return { sc_exists, sc_filename, sc_filetype, sc_modifiable }
|
||||
end
|
||||
|
||||
local function assert_return(values, expected)
|
||||
|
||||
Reference in New Issue
Block a user