]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - vimrc
vimrc: Add support to undo <C-@>, <C-A> and <C-W> in insert mode.
[config/dotfiles.git] / vimrc
diff --git a/vimrc b/vimrc
index 7aa91ce35c6687d787652ba4ab377e50ca176d33..6516546234febcfcfa372f56827426d8cc30d28a 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -26,7 +26,7 @@ endif
 set nocompatible
 
 " Load my scripts from ~/.vim (my scripts) and ~/.vim/runtime (checkout of Vim
-" runtime files).
+" runtime files) if available.
 set runtimepath-=~/.vim
 set runtimepath^=~/.vim,~/.vim/runtime
 
@@ -328,6 +328,17 @@ endif
 " vimgor (bot) in #vim on Freenode (2010-03-30 05:58 CEST).
 noremap <silent> <C-L> :nohlsearch<CR><C-L>
 
+" Ctrl-U in insert mode deletes a lot, break undo sequence before deleting the
+" line so the change can be undone. Thanks to the vimrc_example.vim file in
+" Vim's source.
+inoremap <C-U> <C-G>u<C-U>
+" Same for <C-@> (insert previously inserted text and leave insert mode).
+inoremap <C-@> <C-G>u<C-@>
+" And for <C-A> (insert previously inserted text).
+inoremap <C-A> <C-G>u<C-A>
+" And for <C-W> (delete word before cursor).
+inoremap <C-W> <C-G>u<C-W>
+
 
 " ABBREVIATIONS
 
@@ -450,7 +461,7 @@ if has('autocmd')
             autocmd InsertLeave * set nopaste
         endif
 
-" Save changes when running :mak[e] before 'makeprg' is called.
+" Write file when running :mak[e] before 'makeprg' is called.
         autocmd QuickFixCmdPre * write
 
 " AFTER/FTPLUGIN AUTO COMMANDS