From 4c23170a02f7c119715c19ae3293a563f34d9b33 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 16 Feb 2009 23:58:36 +0100 Subject: [PATCH] Improve Wq and Q fix. Thanks to Tony Mechelynck. --- vimrc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/vimrc b/vimrc index 6b52841..8e64ca0 100644 --- a/vimrc +++ b/vimrc @@ -119,10 +119,24 @@ map se :set spelllang=en_us map sd :set spelllang=de_de " I often type "W" instead of "w" when trying to save a file. Fix my mistake. -cmap W w -cmap Wq wq +" Thanks to Tony Mechelynck from the Vim +" mailing list for the commands. +if v:version < 700 + cnoreabbrev W w + cnoreabbrev Wq wq +else + cnoreabbrev W + \ ((getcmdtype() == ':' && getcmdpos() <= 2) ? 'w' : 'W') + cnoreabbrev Wq + \ ((getcmdtype() == ':' && getcmdpos() <= 3) ? 'wq' : 'Wq') +endif " Also fix my typo with "Q". -cmap Q q +if v:version < 700 + cnoreabbrev Q q +else + cnoreabbrev Q + \ ((getcmdtype() == ':' && getcmdpos() <= 2) ? 'q' : 'Q') +endif " Disable Apple style movements in MacVim. if has("gui_macvim") -- 2.45.2