chillu /.vimrc

Possibly the most edited rc of mine ever.
" map! ii 

set nocompatible    " We don't want vi compatibility.
set showcmd	     	" Show (partial) command in status line.
set showmatch		" Show matching brackets.
set ignorecase      " Do case sensitive matching
set smartcase		" Do smart case matching
set incsearch		" Incremental search
set hlsearch        " Highlight all matches
set mouse=a	    	" Enable mouse usage (all modes) in terminals

" Tab setup
set softtabstop=4
set shiftwidth=4
set tabstop=4
set expandtab         " Turn Tabs into whitespace

set textwidth=75      " Wrap after 76 Chars (could probably be 77, too)
set autoindent        " Automatically indent

filetype on           " Automatically detect file types
filetype indent on    " Filetype specific indentation

set clipboard+=unnamed    " Yanks go on clipboard instead.
set history=999           " Number of things to remember in history.
set autowrite             " Writes on make/shell commands
set ruler                 " Ruler on
set nu                    " Line numbers on
set timeoutlen=250        " Time to wait after ESC (default causes an annoying delay)
set laststatus=2          " Always show status line.
set mousehide             " Hide mouse after chars typed
set mouse=a               " Mouse in all modes

set directory=~/.vim/

set encoding=utf-8        " you really should be using utf-8 now
set termencoding=utf-8    " ditto
set fileencodings=        " don't do any encoding conversion (otherwise munges binary files)

set lazyredraw
set ttyfast

set wildmode=longest:full
set wildignore+=*.o,*~,.lo    " ignore object files
set wildmenu                  " menu has tab completion

set dictionary=/usr/share/dict/words " more words!

" AutoChange directory on switching buffers
autocmd BufEnter * lcd %:p:h

" Choose between moria/macvim/_warm_grey/xoria256
set t_Co=256                    " Set 256 Colors
set background="dark"
colorscheme xoria256

" ColorScheme Scrolling"
map  :NEXTCOLOR
map  :PREVCOLOR
map  :SCROLLCOLOR

" [Awesome] Buffer Navigation with Ctrl-[hjkl]
let g:miniBufExplMapWindowNavVim = 1

" Move windows to Adjacent Tabs or Create new Tabs to accomodate them.
function MoveToPrevTab()
  "there is only one window
  if tabpagenr('$') == 1 && winnr('$') == 1
    return
  endif
  "preparing new window
  let l:tab_nr = tabpagenr('$')
  let l:cur_buf = bufnr('%')
  if tabpagenr() != 1
    close!
    if l:tab_nr == tabpagenr('$')
      tabprev
    endif
    sp
  else
    close!
    exe "0tabnew"
  endif
  "opening current buffer in new window
  exe "b".l:cur_buf
endfunc

function MoveToNextTab()
  "there is only one window
  if tabpagenr('$') == 1 && winnr('$') == 1
    return
  endif
  "preparing new window
  let l:tab_nr = tabpagenr('$')
  let l:cur_buf = bufnr('%')
  if tabpagenr() < tab_nr
    close!
    if l:tab_nr == tabpagenr('$')
      tabnext
    endif
    sp
  else
    close!
    tabnew
  endif
  "opening current buffer in new window
  exe "b".l:cur_buf
endfunc

" TAB Navigation
" Overrides the default functions of H, L, t (which are pretty useless anyway :D)
:map  gT
:map  gt
:map tn :tabnew
:map td :tabclose

" Bind keys for Moving Tabs
map tN :call MoveToNextTab()
map tP :call MoveToPrevTab()

" Move tabs using Arrow Keys
noremap   :exe "silent! tabmove " . (tabpagenr() - 2)
noremap   :exe "silent! tabmove " . tabpagenr()

" Settings for :TOhtml
let html_number_lines=1
let html_use_css=1
let use_xhtml=1

" Settings for taglist.vim
let Tlist_Use_Right_Window=1
let Tlist_Auto_Open=1
let Tlist_Enable_Fold_Column=0
let Tlist_Compact_Format=0
let Tlist_WinWidth=28
let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Process_File_Always = 1

" Keyboard Mappings for NERDTree and Taglist"
nmap   :TlistToggle
nmap   :NERDTreeToggle

if has("unix")
    map ,e :e =expand("%:p:h") ."/"
else
    map ,e :e =expand("%:p:h") ."\\"
endif

" Abbreviations
iab _NAME Chidambaram Annamalai
iab _URL http://importantigravity.blogspot.com
iab _DATE =strftime("Date: %A %B, %e %Y\nTime: %I:%M:%S %p %Z")

" Auto chmod +x for sh and py filesk
autocmd BufWritePost   *.sh !chmod +x %
autocmd BufWritePost   *.py !chmod +x %