public
Created — forked from localshred/.vimrc

Vimrc

  • Download Gist
.vimrc
VimL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
"-------------------------------------------------------------------[Vundle]----
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
 
Bundle 'gmarik/vundle'
 
Bundle 'kien/ctrlp.vim'
Bundle 'mileszs/ack.vim'
Bundle 'danchoi/ruby_bashrockets.vim'
Bundle 'duff/vim-bufonly'
Bundle 'ervandew/supertab'
Bundle 'jdevera/vim-protobuf-syntax'
Bundle 'leshill/vim-json'
Bundle 'Lokaltog/vim-powerline'
Bundle 'majutsushi/tagbar'
Bundle 'msanders/snipmate.vim'
Bundle 'Rykka/ColorV'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/snipmate-snippets'
Bundle 'scrooloose/syntastic'
Bundle 'vim-ruby/vim-ruby'
Bundle 'vim-scripts/yaml.vim'
Bundle 'jamestomasino/actionscript-vim-bundle'
Bundle 'cespare/mxml.vim'
Bundle 'cespare/dtd.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-git'
Bundle 'tpope/vim-haml'
Bundle 'tpope/vim-markdown'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-rake'
Bundle 'tpope/vim-bundler'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-unimpaired'
Bundle 'vim-scripts/Align'
Bundle 'bronson/vim-trailing-whitespace'
Bundle 'vim-scripts/Io-programming-language-syntax'
Bundle 'edsono/vim-matchit'
Bundle 'kana/vim-textobj-user'
Bundle 'nelstrom/vim-textobj-rubyblock'
Bundle 'vim-scripts/vim-scala'
Bundle 'vim-scripts/scala.vim'
 
"colorschemes
Bundle 'altercation/vim-colors-solarized'
Bundle 'tomasr/molokai'
 
filetype plugin indent on
 
"------------------------------------------------------------------[General]----
set secure "locks down the exrc setting
set exrc "enable cwd .vimrc files
 
set nocompatible
set encoding=utf8
 
syntax on
 
set nowrap
set nofoldenable
 
set backspace=indent,eol,start
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set autoindent
set cinoptions=(s,m1,)200,j1,J1
 
set vb
set t_vb=""
 
set backup
set swapfile
set backupdir=/tmp
set directory=/tmp
 
set lazyredraw
 
set complete=.,w,k,b,u,t,i
set completeopt=menu
 
let mapleader=","
 
"-------------------------------------------------------------------[Layout]----
set number
set laststatus=2
"set ruler
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
set listchars=tab:▶━,trail:⌴,extends:▶,precedes:◀
 
set splitbelow
set splitright
 
colorscheme molokai
 
syn on
 
silent! set colorcolumn=80
 
function! SyntaxItem()
return synIDattr(synID(line("."),col("."),1),"name")
endfunction
 
"--------------------------------------------------------------[Plugins]----
"let g:Powerline_symbols='fancy'
let g:SuperTabSetDefaultCompletionType="context"
let g:syntastic_javascript_checker="jshint"
let g:fugitive_github_domains = ['git.iamawesome.com']
let g:Powerline_dividers_override = ['', '', '', '']
call Pl#Theme#RemoveSegment('fileformat')
call Pl#Theme#RemoveSegment('fileencoding')
 
silent! sign define SyntasticError text=!>
silent! sign define SyntasticWarning text=W>
 
" Tagbar mappings
nnoremap <leader>tb :TagbarToggle<cr>
 
" NERDTree mappings
nnoremap <leader>ntt :NERDTreeToggle<cr>
nnoremap <leader>ntf :NERDTreeFind<cr>
 
" Ack.vim mappings
nnoremap <leader>fi :Ack --ruby
nnoremap <leader>f/ :AckFromSearch --ruby<cr>
nnoremap <leader>fq :cclose<cr>
nnoremap <leader>fo :copen<cr>
 
" Whitespace mappings
nnoremap <leader>fw :FixWhitespace<cr>
 
"---------------------------------------------------------------[Search]----
set hlsearch
set incsearch
set smartcase
set ignorecase
 
"-----------------------------------------------------------[Navigation]----
"set mouse=a
set hidden
set scrolloff=5
set scrolljump=5
set sidescrolloff=10
set sidescroll=1
set wildmenu
set showmatch
set matchtime=2
set cursorline
set cursorcolumn
 
"------------------------------------------------------[Custom Mappings]----
nnoremap <silent> <Tab> :wincmd w<cr>
nnoremap <silent> <S-Tab> :wincmd W<cr>
 
" Map esc key in insert mode to jk
"inoremap jk <esc>
"vnoremap jk <esc>
"inoremap <esc> <nop>
"vnoremap <esc> <nop>
 
" Disable arrow keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
 
" Move around splits with <c-hjkl>
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
 
" Move line up (keep cursor with line)
noremap <leader>k ddkP
" Move line down (keep cursor with line)
noremap <leader>j ddp
" Insert mode delete line
inoremap <c-d> <esc>ddi
" Insert mode uppercase word
inoremap <c-u> <esc>viwUi
 
" Beginning of line
noremap H ^
" End of line
noremap L $
" Insert line below
noremap <leader>o o<esc>k
" Insert line above
noremap <leader>O O<esc>j
" Insert line at top of file
noremap gO ggO
" Insert line at bottom of file
noremap go Go
 
" Go to file under cursor
noremap gf :e <cfile><cr>
" Unhighlight search
nnoremap <leader>/ :nohls<cr>
" Edit .vimrc in new vsplit
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
" Source .vimrc
nnoremap <leader>sv :source $MYVIMRC<cr>
 
" Symbolize word
nnoremap <leader>: viw<esc>bi:<esc>
" Wrap parens around def method args
nnoremap <leader>() ^welr(A)<esc>
 
" Reformat line
nnoremap <leader>l= V=
" Reformat paragraph
nnoremap <leader>p= vip=
 
function! PromoteToLet()
:normal! dd
" :exec '?^\s*it\>'
:normal! P
:.s/\(\w\+\) = \(.*\)$/let(:\1) { \2 }/
:normal ==
endfunction
:command! PromoteToLet :call PromoteToLet()
:map <leader>p :PromoteToLet<cr>
 
" Expand hashrocket
iabbrev hh =>
 
"---------------------------------------------------------------[Keymap]----
"set keymap=jocafa
 
"---------------------------------------------------------------------------
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[File Types]%%%%
"---------------------------------------------------------------------------
 
"-----------------------------------------------------------------[HTML]----
autocmd BufNewFile,BufRead *.htm,*.html set filetype=html.css.javascript
 
"------------------------------------------------------------------[CSS]----
autocmd BufNewFile,BufRead *.css,*.less set filetype=css
 
 
"-----------------------------------------------------------------[HAML]----
autocmd BufNewFile,BufRead *.haml set filetype=haml
autocmd FileType haml set makeprg=haml\ %:p\ %:p:s?haml?html?
 
"-----------------------------------------------------------------[Ruby]----
autocmd BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec,[rR]akefile,Thorfile,Capfile,*.jbuilder,*.rake,*.thor set filetype=ruby
autocmd Filetype,BufNewFile *_spec.rb nmap <Leader>r :!bundle exec rspec %<CR>
autocmd Filetype,BufNewFile *_spec.rb nmap <Leader>R :exe "!bundle exec rspec %\:" . line(".")<cr>
 
 
"---------------------------------------------------------------[Python]----
autocmd FileType python let python_highlight_space_errors=1
autocmd FileType python let python_highlight_all=1
autocmd FileType python set omnifunc=pythoncomplete#Complete
 
"-------------------------------------------------------------[Markdown]----
autocmd BufNewFile,BufRead *.md,*.mkd,*.markdown set filetype=markdown
autocmd FileType markdown set wrap linebreak
 
"---------------------------------------------------------[ Processing ]----
autocmd BufNewFile,BufRead *.pde set filetype=java
 
"-----------------------------------------------------------[ Protobuf ]----
autocmd BufNewFile,BufRead *.proto set filetype=proto
 
"---------------------------------------------------------------[ YAML ]----
autocmd BufNewFile,BufRead *.yml*,*.yaml*,.trebrc so ~/.vim/bundle/yaml.vim/colors/yaml.vim
 
"-------------------------------------------------------[ ActionScript ]----
autocmd BufNewFile,BufRead *.as set filetype=io
 
"---------------------------------------------------------------[ MXML ]----
autocmd BufNewFile,BufRead *.mxml set filetype=mxml
 
"-----------------------------------------------------------------[ Scala ]----
autocmd BufNewFile,BufRead *.scala set filetype=scala
au! Syntax scala source ~/.vim/bundle/scala.vim/syntax/scala.vim
 
"-----------------------------------------------------------------[ Io ]----
autocmd BufNewFile,BufRead *.io set filetype=io

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.