-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
231 lines (189 loc) · 6.25 KB
/
vimrc
File metadata and controls
231 lines (189 loc) · 6.25 KB
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
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'powerline/powerline'
Plugin 'ervandew/supertab'
Plugin 'fholgado/minibufexpl.vim'
Plugin 'godlygeek/tabular'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'nviennot/molokai'
Plugin 'preservim/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'spf13/vim-autoclose'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end() " required
filetype plugin indent on " required
"
" COLORS
"
syntax on
filetype plugin indent on
if filereadable(expand("~/.vim/bundle/molokai/colors/molokai.vim"))
colorscheme molokai
endif
" For solarized
" let g:solarized_termcolors=256
" let g:solarized_contrast= 'high'
" let g:solarized_visibility= 'high'
" set background=dark
" colorscheme solarized
set nocursorline " This fixes a lag issue with ruby syntax highlighting
set number
let mapleader=','
let localmapleader=','
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all.
set autoindent smartindent " turn on auto/smart indenting
set smarttab " make <tab> and <backspace> smarter
set tabstop=2 " tabstops of 2
set shiftwidth=2 " indents of 2
set expandtab " tabs are turned into spaces
set backspace=eol,start,indent " allow backspacing over indent, eol, & start
set undolevels=10000 " number of forgivable mistakes
set updatecount=100 " write swap file to disk every 100 chars
set history=2000 " write swap file to disk every 100 chars
set viminfo=%100,'100,/100,h,\"500,:100,n~/.vim/viminfo
" search feature
set ignorecase " ignore case
set smartcase " match case if a capital letter is present in the regexp
set hlsearch " highlight matched patterns
map <Leader>/ :nohlsearch<cr>
set incsearch " highlight search result as you type it
" spell check
map <Leader>ss :setlocal spell!<cr>
set nocompatible " Disable vi-compatibility
set laststatus=2 " Always show the statusline
set encoding=utf-8 " Necessary to show unicode glyphs
set list!
set listchars=tab:▸\ ,trail:•,extends:»,precedes:« " whitespace and trailing spaces
set directory=/tmp "sets the swap (.swp) file directory
set mouse=a " allow mouse scrolling
set foldmethod=syntax
set foldnestmax=10
set nofoldenable
set foldlevel=10
map <Leader>w :set invwrap<cr>
map <Leader>p :set invpaste<cr>
"
" NERDTree
"
nnoremap <C-g> :NERDTreeToggle<cr>
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.py\$class$', '\.obj$', '\.o$', '\.so$', '\.egg$', '^\.git$' ]
let NERDTreeHighlightCursorline=1
let NERDTreeShowBookmarks=1
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
" File tree browser
map \ :NERDTreeToggle<CR>
" File tree browser showing current file - pipe (shift-backslash)
map \| :NERDTreeFind<CR>
"
" Tabular
"
nmap <Leader>ah :Tabularize /=><CR>
vmap <Leader>ah :Tabularize /=><CR>
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
"
" Powerline
"
let g:Powerline_symbols = 'unicode'
"
" Quickfixsigns
"
let g:quickfixsigns_classes=['qfl', 'vcsdiff', 'breakpoints']
"
" Syntastic
"
function! SyntasticWarningToggle()
if g:syntastic_quiet_warnings
let g:syntastic_quiet_warnings = 0
else
let g:syntastic_quiet_warnings = 1
endif
endfunction
let g:syntastic_enable_signs=1 " enable syntastic signs to show up
let g:syntastic_auto_loc_list=1 " automatically open error window
let g:syntastic_mode_map = {
\ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['c', 'html', 'scss', 'cucumber', 'feature']
\ }
map <Leader>t :SyntasticToggle<cr>
map <Leader>y :call SyntasticWarningToggle()<cr>
"
" Minibuf Explorer
"
let g:miniBufExplorerMoreThanOne = 10000
let g:miniBufExplModSelTarget = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplSplitBelow=1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplVSplit = 20
map <Leader>l :MBEToggle<cr>
"
" Tmux integration through screen plugin
"
let g:ScreenImpl = 'Tmux'
command -nargs=? -complete=shellcmd W :w | :call ScreenShellSend("load '".@%."';")
map <F5> :ScreenShellVertical <CR>
map <Leader>c :ScreenShellVertical bundle exec rails c<CR>
map <Leader>r :w<CR> :call ScreenShellSend("rspec ".@% . ':' . line('.'))<CR>
map <Leader>e :w<CR> :call ScreenShellSend("cucumber --format=pretty ".@% . ':' . line('.'))<CR>
map <Leader>b :w<CR> :call ScreenShellSend("break ".@% . ':' . line('.'))<CR>
" Search using Ag
nnoremap <Leader>f :Ag
" Vertical Split
map <Leader>v :vs<CR>
"
" Keybindings
"
" Copy current file path to system pasteboard
map <silent> <D-C> :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
map <leader>C :let @* = expand("%").":".line(".")<CR>:echo "Copied: ".expand("%").":".line(".")<CR>
map <leader>c :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
"
" ctrl+p
"
map <F6> :CtrlPClearAllCaches <CR>
map <Leader>m :CtrlPMRU<cr>
"
" Source custom vim from ~/.custom.vim
"
if filereadable(expand("~/.custom.vim"))
source ~/.custom.vim
endif
"
" Remove Trailing whitespace when saving a vim buffer
"
function! StripTrailingWhitespace()
let save_cursor = getpos(".")
%s/\s\+$//e
call setpos('.', save_cursor)
endfunction
" c style files
autocmd BufWritePre *.m,*.h,*.c,*.mm,*.cpp,*.hpp call StripTrailingWhitespace()
" web development style files
autocmd BufWritePre *.yml,*.js,*.css,*.less,*.sass,*.scss,*.html,*.xml call StripTrailingWhitespace()
" java & php
autocmd BufWritePre *.java,*.php call StripTrailingWhitespace()
" tell vim that tmate.conf has tmux style
au BufNewFile,BufRead,BufReadPost tmate.conf set syntax=tmux
set nowrap