-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
Disabled formating with enabled autosave plugin #1262
Comments
I won't be at a computer for the next few days to test this, but the way I understood these auto save hooks is It'll disable formatting during any auto save and then restore the settings. So if you want to format it, you'll need to manually save or use |
weird behavior as for me - or autosave or autoformat :) I check it again:
✅ format and save
❌ no format
|
I believe we added this to prevent it from formatting the code unexpectedly, e.g, you leave insert mode to copy and paste or try to select something in visual mode and than it formats in the middle you trying to do something else moving the code around If you really want to avoid using these hooks it might be easier to either install the plugin directly
or disable the auto commands doing something like
|
when testing this, I also noticed that the buffer setting wasn't getting restored correctly. so if you went into insert mode, did something, went to normal mode and then |
make sense... ps. #1265 will fix this issue as for me, closing |
Hi there! I have this configuration on my AstroNvim. File return {
{
"okuuva/auto-save.nvim",
-- version = '^1.0.0', -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release
cmd = "ASToggle", -- optional for lazy loading on command
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
opts = {
-- your config goes here
-- or just leave it empty :)
trigger_events = {
defer_save = { "InsertLeave", "TextChanged", "TextChangedI" },
},
debounce_delay = 2500,
},
},
} File return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.lua" },
-- import/override with your plugins folder
...
{ import = "astrocommunity.editing-support.auto-save-nvim" },
} It works perfectly (save without leaving the editor after 2500ms) but I noticed the file is not formatted automatically, I need to execute is it feasible to get what i want? Thank you |
We have this logic here to disable formatting with autosave to prevent it from shifting while you're using it, I believe you can disable the auto command like I showed in the second example #1262 (comment) |
Does not work, file is saved after 2500ms but not formatted return {
{
"okuuva/auto-save.nvim",
-- version = '^1.0.0', -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release
cmd = "ASToggle", -- optional for lazy loading on command
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
opts = {
-- your config goes here
-- or just leave it empty :)
trigger_events = {
defer_save = { "InsertLeave", "TextChanged", "TextChangedI" },
},
debounce_delay = 2500,
autocmds = {
autoformat_toggle = {},
},
},
},
} |
the autocmd is on Astrocore and not on the plugin directly.
|
This is exactly I was looking for, many thanks! |
Checklist
repro.lua
provided belowNeovim version (nvim -v)
0.10.2
Operating system/version
arch
Terminal/GUI
kitty
Describe the bug
caused by #511
Formating buffer does not work (disabled ) if
"astrocommunity.pack.angular"
and"astrocommunity.editing-support.auto-save-nvim"
is enabled (maybe on go pack too)Steps to Reproduce
astrocommunity.pack.angular
endastrocommunity.editing-support.auto-save-nvim
oncommunity.lua
fileExpected behavior
buffer should be forma
Screenshots
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: