Skip to content

Instantly share code, notes, and snippets.

@teeerevor
Created September 16, 2011 23:54
Show Gist options
  • Save teeerevor/1223423 to your computer and use it in GitHub Desktop.
Save teeerevor/1223423 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible " be iMproved
filetype off " required!
colorscheme ir_black
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-ragtag'
Bundle 'kien/ctrlp.vim'
Bundle 'vim-scripts/matchit.zip'
" Bundle 'corntrace/bufexplorer'
Bundle 'kchmck/vim-coffee-script'
Bundle 'corntrace/bufexplorer'
" vim-scripts repos
" Bundle 'NERD_Tree-and-ack'
Bundle 'The-NERD-tree'
Bundle 'The-NERD-Commenter'
Bundle 'ack.vim'
Bundle 'Tabular'
Bundle 'ruby-matchit'
Bundle 'minibufexpl.vim'
Bundle 'SuperTab'
" ...
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
let mapleader = ","
set t_Co=256
set smartcase
set grepprg=ack\ -H\ --nocolor\ --nogroup
set grepformat=%f:%l:%m
au BufNewFile,BufRead *.thor setfiletype ruby
au BufNewFile,BufRead Gemfile setfiletype ruby
au BufNewFile,BufRead *.ejs setfiletype html
let $ACK_OPTIONS = "--type-set=haml=.haml --type-set=sass=.sass --type-set=coffee=.coffee"
command! -nargs=* -complete=file Ack call Ack(<q-args>)
" ,F to startup an ack search
map <leader>F :Ack<space>
let g:rails_default_file='config/database.yml'
syntax on
set wildmenu
set autoread
set nobackup
set nowritebackup
set smartindent
set gdefault
set cursorline
set nu " Line numbers on
set nowrap " Line wrapping off
set directory=/tmp
" Visual
set showmatch " Show matching brackets.
set mat=5 " Bracket blinking.
set list
" Show $ at end of line and trailing space as ~
set lcs=tab:\ \ ,eol:$,trail:~,extends:>,precedes:<
set novisualbell " No blinking .
set noerrorbells " No noise.
set laststatus=2 " Always show status line.
" don't use folder browser when adding to project listings
let g:proj_flags='imst'
" no menu, and no toolbar:
"set guioptions-=m
set guioptions-=T
set term=xterm-256color
" os x backspace fix
set backspace=indent,eol,start
"set t_kb
fixdel
set incsearch
set hlsearch
" tabs -> spaces
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
" turn mouse on
set mouse=a
" folding
" za -fold/ufold - zR - zM
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=1
" remap'd keys
nnoremap <leader><leader> <c-^>
map <Tab><Tab> <C-W>
nnoremap <F5><F5> :set invhls hls?<CR> " use f5f5 to toggle search hilight
nnoremap <F4><F4> :set invwrap wrap?<CR> " use f4f4 to toggle wordwrap
nmap <leader>v :e ~/.vimrc
nnoremap <leader>d :NERDTreeToggle<CR>
"Force Saving Files that Require Root Permission
cmap w!! %!sudo tee > /dev/null %
" make Y act like all the other capitals
map Y y$
" remap'd for dvorak movement
" t is now move down
nnoremap t j
vnoremap t j
nnoremap T J
vnoremap T J
" n is now move up
nnoremap n k
vnoremap n k
nnoremap N K
vnoremap N K
" s is now move right
nnoremap s l
vnoremap s l
nnoremap S L
vnoremap S L
" make j to n for next search
nnoremap j n
nnoremap J N
nnoremap k t
nnoremap K T
nnoremap l s
nnoremap L s
" removes tildes
map <C-t> <Esc>:%s/[ ^I]*$//<CR>
"Rails Stuff
map <leader>gr :topleft :split config/routes.rb<cr>
map <leader>gg :topleft 100 :split Gemfile<cr>
function! ShowRoutes()
" Requires 'scratch' plugin
:topleft 100 :split __Routes__
" Make sure Vim doesn't write __Routes__ as a file
:set buftype=nofile
" Delete everything
:normal 1GdG
" Put routes output in buffer
:0r! rake -s routes
" Size window to number of lines (1 plus rake output length)
:exec ":normal " . line("$") . "_ "
" Move cursor to bottom
:normal 1GG
" Delete empty trailing line
:normal dd
endfunction
map <leader>gR :call ShowRoutes()<cr>
set hls
set incsearch
set showcmd
set nowrap
set hidden
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment