]> git.rmz.io Git - dotfiles.git/commitdiff
switch <C-P> and <C-N> in smarttab
authorSamir Benmendil <samir.benmendil@gmail.com>
Fri, 18 Oct 2013 04:40:50 +0000 (06:40 +0200)
committerSamir Benmendil <samir.benmendil@gmail.com>
Fri, 18 Oct 2013 04:40:50 +0000 (06:40 +0200)
vimrc

diff --git a/vimrc b/vimrc
index ceab90ef251eca9051a49c4d31686b6b6f250eed..94c32a8e17e5fb81ba7ba33e16f3b1295335daa1 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -107,6 +107,18 @@ set nrformats=hex               " number formats recognized for CTRL-A and CTRL-
 " whether to use a popup menu for Insert mode completion
 set completeopt=longest,menuone,preview
 
+" Indent if we're at the beginning of a line. Else, do completion.
+function! InsertTabWrapper()
+  let col = col('.') - 1
+  if !col || getline('.')[col - 1] !~ '\k'
+    return "\<Tab>"
+  else
+    return "\<C-N>"
+endif
+endfunction
+inoremap <Tab> <C-R>=InsertTabWrapper()<CR>
+inoremap <S-Tab> <C-P>
+
 " fix legacy vi inconsistency
 map Y y$
 
@@ -227,15 +239,3 @@ if !exists(":DiffOrig")
   command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
                   \ | wincmd p | diffthis
 endif
-
-" Indent if we're at the beginning of a line. Else, do completion0.
-function! InsertTabWrapper()
-  let col = col('.') - 1
-  if !col || getline('.')[col - 1] !~ '\k'
-    return "\<tab>"
-  else
-    return "\<c-p>"
-endif
-endfunction
-inoremap <tab> <c-r>=InsertTabWrapper()<cr>
-inoremap <s-tab> <c-n>