Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added hook_before_actual_saving #25

Closed
wants to merge 7 commits into from
Closed

Conversation

ofirgall
Copy link

nvim-autopairs is triggering the TextChanged autocmd when it inserts new pair, it does it by go to normal mode change stuff and go back to insert mode, AutoSave.nvim triggers and autosave that might be unwanted.

I tried to avoid it by check if I'm in insert mode before save but I realized it does the check before the debounce when the mode is still normal.

I had to check if i'm in insert mode before the actual saving so I added hook_before_actual_saving and added this hook to my conf:

autosave.hook_before_actual_saving = function ()
	mode = vim.api.nvim_get_mode()
	if mode.mode == 'i' then -- Don't save while we in insert mode (triggered with autopair and such)
		vim.g.auto_save_abort = true
	end
end

@pocco81
Copy link
Owner

pocco81 commented Jul 31, 2022

Heya! please check #33 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants