Skip to content

Instantly share code, notes, and snippets.

@shreeshga
Created November 29, 2011 18:09
Show Gist options
  • Save shreeshga/1405763 to your computer and use it in GitHub Desktop.
Save shreeshga/1405763 to your computer and use it in GitHub Desktop.
my vim config file
" This uses Vundle (https://github.com/gmarik/vundle) to manage vim scripts
" syntax highlight
syntax on
" Mouse support
set mouse=a
" Code Header
autocmd bufnewfile *.py so ~/.vim/py_header.txt
autocmd bufnewfile *.h,*.hpp,*.c,*.cpp so ~/.vim/c_header.txt
autocmd bufnewfile *.h,*.hpp,*.c,*.cpp,*.py exe "1," . 5 . "g/Creation Date :.*/s//Creation Date : " .strftime("%d-%m-%Y")
autocmd bufnewfile *.h,*.hpp,*.c,*.cpp,*.py exe "1," . 5 . "g/Created By :.*/s//Created By : " "Shreesh Ayachit (shreesh.ayachit@gmail.com)"
"autocmd Bufwritepre,filewritepre *.h,*.hpp,*.cpp,*.c,*.py exe "normal ma"
"autocmd Bufwritepre,filewritepre *.h,*.hpp,*.c,*.cpp,*.py exe "1," . 5 . "g/Last Modified :.*/s/Last Modi"fied :.*/Last Modified : " .strftime("%c")
"autocmd bufwritepost,filewritepost *.h,*.hpp,*.c,*.cpp,*.py exe "normal `a"
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "can tweak
" undo History
set undofile
set relativenumber
" Make cursor move as expected with wrapped lines
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
" Map ; to : No annoying Shift key
nore ; :
nore , ;
" better way of navigatin than arrows
imap <c-h> <left>
imap <c-j> <down>
imap <c-k> <up>
imap <c-l> <right>
" no more compatible with vi
set nocompatible
" Taken from stevenlosh, http://stevelosh.com/blog/2010/09/coming-home-to-vim/#some-background-about-me
set nowritebackup
set nobackup
set wrap
set textwidth=79
set formatoptions=qrn1
set colorcolumn=85
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
nnoremap <leader>w <C-w>v<C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
au FocusLost * :wa
" autoread from disk when file is changed outside of vim
set autoread
" Set GUI font
set gfn=Menlo:h15
"""""""""""""""""""""""""""""
" TABing and INDENTing stuff
"""""""""""""""""""""""""""""
set tabstop=4
set shiftwidth=4
" tabs are actually multiple spaces
set expandtab
" auto and smart indentation
set autoindent
set smartindent
" C-style indentation
set cindent
" backspacing
set backspace=indent,eol,start
" turn line numbering on
set number
" set colorscheme to evening
colorscheme evening
"""""""""""
" SEARCH
"""""""""""
" ignore case for searches
set ignorecase
" highlight search
set hlsearch
""""""""""""
" FILETYPES
""""""""""""
au BufRead,BufNewFile {Gemfile,Rakefile,Capfile,*.rake,config.ru} set ft=ruby
au BufRead,BufNewFile {*.md,*.mkd,*.markdown} set ft=markdown
au Bufread,BufNewFile *.as set filetype=actionscript
au BufRead,BufNewFile {*.html.haml,*.haml} set ft=haml
au BufRead,BufNewFile {*.rkt,*.scm} set ft=scheme
au BufRead,BufNewFile {*.tt} set ft=treetop
au BufNewFile,BufRead {*.less} set filetype=less
""""""""""
" BUNDLES
""""""""""
filetype on
set rtp+=~/.vim/vundle.git/
call vundle#rc()
Bundle "L9"
Bundle "FuzzyFinder"
Bundle "ack.vim"
" NERDTree
Bundle 'The-NERD-tree'
" markdown syntax
Bundle "Markdown"
Bundle "git://git.wincent.com/command-t.git"
" cucumber
Bundle "cucumber.zip"
" rails
Bundle "rails.vim"
" jquery
Bundle "jQuery"
" git
Bundle "git.zip"
Bundle "fugitive.vim"
" haml
Bundle "tpope/vim-haml"
filetype off
" coffeescript
Bundle "kchmck/vim-coffee-script"
filetype plugin indent on
" ActionScript
Bundle "actionscript.vim--Cuss"
" LessCSS
Bundle "itspriddle/vim-lesscss"
" Treetop
Bundle "nanki/treetop.vim"
" Utility
Bundle "SuperTab"
Bundle "godlygeek/tabular"
" end bundle list
filetype plugin indent on
" NOTE: if some plugins fail to work, put the config *between* lines:
" filetype off
" "Bundles here
" filetype plugin indent on
set background=dark
" set bg and fg of numbering
highlight LineNr ctermfg=black ctermbg=white
" make filename and status always visible
set modeline
set ls=2
"py-diction
let g:pydiction_location = '~/.vim/bundle/pydict/complete-dict'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment