2485 shaares
83 private links
83 private links
Finding the use of <C-G>u was a little hidden. To find out more in vim-help: i_CTRL-G_u
or undo-break
.
For markdown I have the following mappings in ~/.vim/after/ftplugin/markdown.vim:
" Break undo sequence at punctuation marks
inoremap <buffer> . .<c-g>u
inoremap <buffer> ! !<c-g>u
inoremap <buffer> ? ?<c-g>u
inoremap <buffer> , ,<c-g>u
I don't think that this makes a difference in my workflow, because I seldom use undo on text that I just typed. It is more likely that I undo a formatting, deletion or copy command.