neoformat
neoformat copied to clipboard
Getting E790 error after undoing the autoformat
Getting an error when trying to save to a file after undoing the autosave changes and then saving again
Steps to reproduce
Save a file
undo changes by pressing u
save a file
error msg
Error detected while processing BufWritePre Autocommands for "*":
E790: undojoin is not allowed after undo
file: go (go lang) Config used
vim.api.nvim_exec([[
augroup fmt
autocmd!
autocmd BufWritePre * undojoin | Neoformat
augroup END
]], false)
I'm experiencing this too. Ended up just removing undojoin
from my autocmd for now.
I'm seeing the same thing. Just for further information:
- macOS 11.6.2
- vim 8.2.4227
- neoformat is up to date with the main branch
- The file was go.
- Here's my autocommand:
autocmd vim_config BufWritePre *.go undojoin | Neoformat
.
@telemachus thanks for your solution using the following au for
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
autocommand solved the save error after undo but getting an error for the first save for a file type
Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:83: Vim(catch):E603: :catch without :try
Please check your config for correctness