Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhuster committed Nov 20, 2024
1 parent 236f913 commit b6609a2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/autosave.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local nvim = require('autosave.nvim')
local bool = nvim.bool
local isnvim = bool(vim.fn.has('nvim'))

local M = {}

Expand Down Expand Up @@ -59,7 +60,7 @@ function M.cmdlineComplete(_A)
end
end
end
return bool(vim.fn.has('nvim')) and completion or vim.list(completion)
return isnvim and completion or vim.list(completion)
end

--- Check if a buffer can be autosaved
Expand All @@ -72,8 +73,9 @@ function M.check_buffer()
end

local path = nvim.buf_get_name()
for i = 1, #vim.g.autosave_disable_inside_paths do
local pattern = vim.g.autosave_disable_inside_paths[i]
local disable_dirs = vim.g.autosave_disable_inside_paths
for i = 1, #disable_dirs do
local pattern = disable_dirs[i]
pattern = vim.fn.expand(pattern)
if path:sub(1, #pattern) == pattern then
if bool(vim.b.autosave_enabled) then
Expand All @@ -96,7 +98,7 @@ function M.print_status()
end

function M.setup(user_config)
if not bool(vim.fn.has('nvim')) then
if not isnvim then
print("require('autosave').setup() is only supported in Neovim")
return
end
Expand Down

0 comments on commit b6609a2

Please sign in to comment.