Skip to content

Instantly share code, notes, and snippets.

@zfedoran
Created April 11, 2012 14:25
Show Gist options
  • Save zfedoran/2359629 to your computer and use it in GitHub Desktop.
Save zfedoran/2359629 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible
"install pathogen
"git clone nerdtree, auto-pairs
call pathogen#infect()
syntax on
"set nu
set ts=2
set shiftwidth=2
set softtabstop=2
set expandtab
set cindent
set smartindent
set autoindent
set ignorecase
set smartcase
set incsearch
set hlsearch
set nowrap
set nobackup
set noswapfile
" indent line(s) using > or < in visual mode
vmap <TAB> >gv
vmap <S-TAB> <gv
" <tab> will skip closing parentheses, autocomplete, and add \t
function! SmartTab()
let line = getline('.')
let current_char = line[col('.')-1]
let prev_char = line[col('.')-2]
let alpha_num = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
let not_eol = col('.') != col('$')
if not_eol && stridx(']})"', current_char)!=-1
return "\<Right>"
elseif prev_char != '' && stridx(alpha_num, prev_char )!=-1
return "\<C-N>"
else
return "\<Tab>"
endfunction
inoremap <expr> <Tab> SmartTab()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment