Permalink
Browse files

insert mode <Tab> indents or completes

  • Loading branch information...
1 parent 32aca06 commit 2864ae9324e532f1bd5d7051bc1c75840caf2934 @mislav committed Aug 29, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 vimrc
View
@@ -159,6 +159,18 @@ let g:ackprg = 'ag --nogroup --nocolor --column'
" In command-line mode, C-a jumps to beginning (to match C-e)
cnoremap <C-a> <Home>
+" <Tab> indents if at the beginning of a line; otherwise does completion
+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>
+
" ignore Rubinius, Sass cache files
set wildignore+=tmp/**,*.rbc,.rbx,*.scssc,*.sassc
" ignore Bundler standalone/vendor installs & gems

0 comments on commit 2864ae9

Please sign in to comment.