Skip to content

Commit

Permalink
fix(aucommands): bail out if direct file editing (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe authored Sep 28, 2024
1 parent 71cb758 commit a0ec27d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lua/kikao/config/aucommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ local vim_leave_cb = function(session_file_path)
vim.cmd("mksession! " .. session_file_path)
end

local vim_enter_cb = function(project_dir_matchers, session_file_path, ps)
local vim_enter_cb = function(data, project_dir_matchers, session_file_path, ps)
if data.file and vim.fn.filereadable(data.file) == 1 then
return
end

local dir = vim.fn.getcwd()

for _, root in ipairs(project_dir_matchers) do
Expand Down Expand Up @@ -39,8 +43,8 @@ M.setup = function(config)
end

vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
vim_enter_cb(config.project_dir_matchers, session_file_path, ps)
callback = function(data)
vim_enter_cb(data, config.project_dir_matchers, session_file_path, ps)
end,
group = augroup,
nested = true,
Expand Down
2 changes: 1 addition & 1 deletion lua/kikao/globals/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local M = {}

M.VERSION = "1.0.1"
M.VERSION = "1.0.2"

return M

0 comments on commit a0ec27d

Please sign in to comment.