aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2014-05-25 15:46:22 -0400
committerTeddy Wing2014-05-25 15:46:22 -0400
commit1c62251ea84d8d53012da687b929ca8b70c16f24 (patch)
treea7d049e62688473ce06a8afca16b7ff3e93850cb
parent2a47d76e47119095e523b9946df423575793acd1 (diff)
downloaddotvim-1c62251ea84d8d53012da687b929ca8b70c16f24.tar.bz2
vimrc: allow undo of Ctrl-u and Ctrl-w in insert mode
Ensure that my changes can be undone if I accidentally press Ctrl-u or Ctrl-w in insert mode.
-rw-r--r--vimrc10
1 files changed, 10 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 5f66e1d..64b8c18 100644
--- a/vimrc
+++ b/vimrc
@@ -149,6 +149,11 @@
" variable needed to be set directly.
" * Move gitcommit indentation settings from vimrc to ftplugin/gitcommit
"
+" 2014.05.25:
+" * If in insert mode I press Ctrl-u to delete a line or Ctrl-w to
+" delete a word, add those changes to the undo history so that I can
+" go back and don't have to remember what I typed if I want to undo.
+"
" Pathogen
@@ -376,6 +381,11 @@ inoremap <CR> <CR>x<BS>
nnoremap o ox<BS>
nnoremap O Ox<BS>
+" Allow undo of Ctrl-u and Ctrl-w in insert mode
+" http://vim.wikia.com/wiki/Recover_from_accidental_Ctrl-U
+inoremap <c-u> <c-g>u<c-u>
+inoremap <c-w> <c-g>u<c-w>
+
" Show invisibles with <leader>i
nnoremap <leader>i :set list!<cr>