You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of the time I enable autoformatting on save when I work on my own projects. However I do collaborate on other open-source projects that do not use my code style. When I write code there I want to disable the autoformat. I use the autocmd given in the Wiki and added a little twist to make it work, here is how it looks like:
Initially it works. Then I switch autoFormat to false with :lua vim.g.autoFormat=false for example. I make a modification in the code, hit :wand autoFormat is disabled properly. However if I enable it again it doesn't work. It's like my autocmd is not even triggered as I put a print() in the callback and it's not displayed. Is there something I'm missing here?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Most of the time I enable autoformatting on save when I work on my own projects. However I do collaborate on other open-source projects that do not use my code style. When I write code there I want to disable the autoformat. I use the autocmd given in the Wiki and added a little twist to make it work, here is how it looks like:
Initially it works. Then I switch
autoFormat
to false with:lua vim.g.autoFormat=false
for example. I make a modification in the code, hit:w
and autoFormat is disabled properly. However if I enable it again it doesn't work. It's like my autocmd is not even triggered as I put aprint()
in the callback and it's not displayed. Is there something I'm missing here?Beta Was this translation helpful? Give feedback.
All reactions