I regularly find myself editing some code, encountering an error in a function and then changing the function call and the function itself to debug the problem. Once the problem in the function is solved, I then want to revert the call to what it was. Of course I always forget to save the call to a register beforehand, and I figured the most intuitive solution would be to undo the last change on the current line. I have not been able to find such functionality in Vim however. Is there something I overlooked? In my mind I see a mapping that branches the undo tree and replays all edits, except the last one on the current line.
undo last change on current line
undo redo
This will probably do what you want:function! Undoline()  let pos = getpos(.)  let current = getline(pos[1])  let chg = changenr()  while changenr() > 0 && current ==# getline(pos[1])    silent exec 'u'  endwhile  let old = getline(pos[1])  while changenr() < chg    silent exec 'redo'  endwhile   undo if we jumped over a gap  if changenr() > chg    silent exec 'u'  endif  call setpos('.', pos)  if old ==# current    echo 'no change found'  else    call setline(pos[1], old)  endifendfunctionIt will undo until the line you are on changes, take the old value, redo to your current state and then replace the line with the old value.It will obviously not work if a line above was added or removed, in that case take a look at one of the undo browsing plugins.