-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
219 lines (193 loc) · 6.21 KB
/
vimrc
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
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'altercation/vim-colors-solarized'
Bundle 'scrooloose/nerdtree'
Bundle 'msanders/snipmate.vim'
Bundle 'mileszs/ack.vim'
Bundle 'hallettj/jslint.vim'
Bundle 'juvenn/mustache.vim'
Bundle 'rstacruz/sparkup'
Bundle 'godlygeek/tabular'
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-rails'
Bundle 'ervandew/supertab'
Bundle 'tpope/vim-surround'
Bundle 'gregsexton/gitv'
Bundle 't9md/vim-chef'
Bundle 'kchmck/vim-coffee-script'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'mutewinter/LustyJuggler'
Bundle 'mutewinter/vim-indent-guides'
Bundle 'Raimondi/delimitMate'
Bundle 'pangloss/vim-javascript'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-commentary'
Bundle 'scrooloose/syntastic'
Bundle 'tangledhelix/vim-octopress'
Bundle 'Lokaltog/vim-powerline'
Bundle 'kana/vim-textobj-user'
Bundle 'nelstrom/vim-textobj-rubyblock'
Bundle 'tsaleh/vim-matchit'
Bundle 'L9'
Bundle 'FuzzyFinder'
Bundle 'JSON.vim'
Bundle 'git://git.wincent.com/command-t.git'
set nocompatible " vi compatibility is for losers
set background=dark " dark is good
syntax on
filetype on
filetype plugin on
filetype plugin indent on
set shiftwidth=2 " space width 2
set tabstop=2 " tab width 2
set binary noeol
set number " turns on line numbering
set matchpairs+=<:> " adds matching on <> pairs
set comments=s1:/*,mb:*,ex:*/,f://,b:#,:%,:XCOMM,n:>,fb:-
set backspace=indent,eol,start " fixes the backspace key
set ignorecase " ignore case during search
set smartcase " (unless caps)
set expandtab
set showcmd
set hlsearch " turns on highlight search
set incsearch " incremental search
set autoindent " turns on autoindent
set nostartofline " alters default go to begining of line behavior
set ruler " displays column numbers
set confirm
set clipboard+=unnamed " Yank to go to clipboard
set backup " enable backup files
set backupdir=~/.vim/backup " Vim swp directory
set directory=~/.vim/tmp " temp file directory
set undodir=~/.vim/undo
set autowrite " Writes on make/shell commands
set showmatch " show matching brackets
set mat=5 " matching blinky
set encoding=utf-8 " utf8 encoding
set report=0 " show a report when N lines were changed. 0 means 'all'
set ls=2 " always show status line
set cursorline " highlight cursor line
set splitbelow splitright
set nofoldenable "dont fold by default
source ~/.vim/abbreviations
" Show trailing whitespace or tag/space in blinding red
highlight ExtraWhitespace ctermbg=red guibg=red
au ColorScheme * highlight ExtraWhitespace guibg=red
au BufWinEnter * match ExtraWhitespace /\s\+$/
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
au InsertLeave * match ExtraWhiteSpace /\s\+$/
au BufWinLeave * call clearmatches()
" Use Node.js for JavaScript interpretation
let $JS_CMD='node'
" Setup for various TERM types
if $TERM =~ '^xterm.*' || $TERM == 'screen-256color'
set t_Co=256
colorscheme solarized
else
set t_Co=16
endif
"dont load csapprox if we no gui support - silences an annoying warning
if !has("gui")
" let g:CSApprox_loaded = 1
else
if has("gui_gnome")
set term=gnome-256color
let moria_style = 'black'
colorscheme solarized
else
colorscheme solarized
set guitablabel=%M%t
endif
if has("gui_mac") || has("gui_macvim")
set guifont="Menlo":h11
endif
if has("gui_win32") || has("gui_win32s")
set guifont=Consolas:h12
set enc=utf-8
endif
endif
" Set wildcard behavior
set wildmode=longest,list "make cmdline tab completion similar to bash
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~,*.pyc,*.zip,*.gz,*.bz,*.tar,*.jpg,*.png,*.gif,*.avi,*.wmv,*.ogg,*.mp3,*.mov
autocmd FileType mkd set formatoptions=tcroqn2 comments=n:>
autocmd FileType mkd set spell
autocmd FileType c,cpp,java,javascript,python,xml,xhtml,html set shiftwidth=4
" Must have shortcuts
imap jj <Esc>
imap uu _
imap hh =>
imap aa @
let mapleader = ","
" turn of highlight until next search
nnoremap <C-S> :nohl<CR><C-S>
" refresh vimrc
map <Leader>s :source $MYVIMRC<CR>
map <S-Enter> 0<ESC>
map <Enter> o<ESC>
" Command-T
map <Leader>a :CommandT<CR>
" Cycle through buffers
nnoremap <C-N> :bn<CR>
nnoremap <C-P> :bp<CR>
"move around windows with ctrl key!
map <C-H> <C-W>h
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
"replace all tabs with 2 spaces
map <Leader>r :retab 2<CR>
" NERDTree
map ,n :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyo$', '\.pyc$', '\.svn[\//]$', '\.swp$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
" Tabularize
if exists(":Tabularize")
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
endif
" Ruby Debugger
" let g:ruby_debugger_debug_mode = 1
let g:ruby_debugger_progname = 'mvim'
let g:ruby_debugger_builtin_sender = 0
" JSON tidy'er
" install with: cpan JSON::XS
" http://visibletrap.blogspot.com/2010/05/vim-how-to-format-and-syntax-highlight.html
map <leader>jt <Esc>:%!json_xs -f json -t json-pretty<CR>
" Markdown preview
imap <leader>p <ESC>:w!<CR>:!markdown % > %.html && open %.html<CR><CR>a
map <leader>p <ESC>:w!<CR>:!markdown % > %.html && open %.html<CR><CR>a
" Chef switcher
au BufNewFile,BufRead */cookbooks/* call s:SetupChef()
function! s:SetupChef()
nnoremap <buffer> <silent> <C-w><C-w> :<C-u>ChefDoWhatIMean<CR>
nnoremap <buffer> <silent> <C-w><C-f> :<C-u>ChefDoWhatIMeanSplit<CR>
endfunction
" LustyJuggler
nnoremap <leader>, :LustyJugglePrevious<CR>
let g:LustyJugglerShowKeys=1 " Show numbers for Lusty Buffers
let g:LustyJugglerSuppressRubyWarning=1
" Syntastic
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=2
" FuzzyFinder shortcuts
nmap <leader>ff <ESC>:FufFile<CR>
nmap <leader>fl <ESC>:FufLine<CR>
nmap <leader>fb <ESC>:FufBuffer<CR>
" Powerline
let g:Powerline_symbols="fancy"
" JSON.vim settings
augroup json_autocmd
autocmd!
autocmd FileType json set autoindent
autocmd FileType json set formatoptions=tcq2l
autocmd FileType json set textwidth=78 shiftwidth=2
autocmd FileType json set softtabstop=2 tabstop=8
autocmd FileType json set expandtab
autocmd FileType json set foldmethod=syntax
augroup END