I want to run an autocommand to restore cursor position after undoing with u
. After reading the documentation for event, I cannot find a event that is specified for undoing. Which event should I be using?
1 Answer
Based on @Mass's comment, you might be able to get started with
augroup whatever
autocmd!
autocmd TextChanged * call F()
augroup END
function F() abort
const undotree = undotree()
if undotree.seq_cur is# undotree.seq_last
" no undos
return
endif
" your work here…
endfunction
-
1
u
keyu
key, so that it will trigger whatever code you'd like to run around that operation.