I don't like to have to press ESC to change to normal mode, so I'm writing a small script for doing that for me, after a time.
But I'm getting the following error:
Error detected while processing InsertEnter Auto commands for "*":
E521: Number required after =: updatetime=aunm
This is the script
let aunm=800
au InsertEnter * let aunm_restore=&updatetime | set updatetime=aunm | au CursorHoldI * :stopinsert
au InsertLeave * let &updatetime=aunm_restore
if I remove let aunm=800 and set manualy set updatetime=800 it works perfectly. But i would like to have a global var to change the time if needed.
Use
let &updatetime=aunm
. set does not accept expressions.
By the way, I see your code constantly adds CursorHoldI events without clearing them out, this way you may end up with a hundred of them. You should use
autocmd! CursorHoldI * :stopinsert
(with bang) or just add it once (with a line just before au InsertEnter), in any case it won’t be triggered not in insert mode. Note: this command will clear out all CursorHoldI events with pattern * that are not in any group so if you have more you have to put them or this into a augroup {GroupName} | au … | augroup END (better to put both).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With