From 543c2a6f8134681b7c38443c12365928f7090d31 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Mon, 18 Jan 2016 21:59:21 -0600 Subject: [PATCH] Add Breaking The Undo Sequence as a vim til. --- README.md | 1 + vim/breaking-the-undo-sequence.md | 34 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 vim/breaking-the-undo-sequence.md diff --git a/README.md b/README.md index 62f1fe1..bc1d6bc 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Amend Commits With Fugitive](vim/amend-commits-with-fugitive.md) - [Beginning And End Of Previous Change](vim/beginning-and-end-of-previous-change.md) - [The Black Hole Register](vim/the-black-hole-register.md) +- [Breaking The Undo Sequence](vim/breaking-the-undo-sequence.md) - [Buffer Time Travel](vim/buffer-time-travel.md) - [Case-Aware Substitution With vim-abolish](vim/case-aware-substitution-with-vim-abolish.md) - [Case-Insensitive Substitution](vim/case-insensitive-substitution.md) diff --git a/vim/breaking-the-undo-sequence.md b/vim/breaking-the-undo-sequence.md new file mode 100644 index 0000000..6005cef --- /dev/null +++ b/vim/breaking-the-undo-sequence.md @@ -0,0 +1,34 @@ +# Breaking The Undo Sequence + +Generally, the sequence of undo-able actions is segmented by command. When +entering Insert mode, everything typed until exiting Insert mode is part of +a single undo-able segment. If you are going to be typing in Insert mode for +a while though, you may want to break it up a bit. Without leaving Insert +mode, hit `ctrl-g u` to mark a break in the sequence of undos. + +For example, starting in Normal mode and then typing +`iabcudefughi` will leave the buffer with: + +``` +abcdefghi +``` + +Hitting `u` once will leave the buffer with: + +``` +abcdef +``` + +Hitting `u` again: + +``` +abc +``` + +Hitting `ctrl-r`: + +``` +abcdef +``` + +See `:h i_CTRL-G_u` for more details.