-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
315 lines (252 loc) · 7.9 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
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
set nocompatible " Use vim, no vi defaults. Set first as it has side
" effects on other settings
filetype off " vundle required
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
" vundle required
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-sensible'
Bundle 'ajf/puppet-vim'
Bundle 'ervandew/supertab'
Bundle 'tpope/vim-fugitive'
Bundle 'bling/vim-airline'
Bundle 'bling/vim-bufferline'
Bundle 'kien/ctrlp.vim'
Bundle 'tpope/vim-git'
Bundle 'vim-scripts/molokai'
Bundle 'bitc/vim-bad-whitespace'
Bundle 'Raimondi/delimitMate'
Bundle 'vim-scripts/ShowMarks'
Bundle 'tpope/vim-vividchalk'
Bundle 'guns/vim-clojure-static'
Bundle 'rizzatti/funcoo.vim'
Bundle 'rizzatti/dash.vim'
Bundle 'terryma/vim-expand-region'
Plugin 'rust-lang/rust.vim'
Bundle 'kien/rainbow_parentheses.vim'
Bundle 'christoomey/vim-tmux-navigator'
Bundle 'henrik/git-grep-vim'
Bundle 'airblade/vim-gitgutter'
Bundle 'scrooloose/nerdcommenter'
Bundle 'hashivim/vim-terraform'
Bundle 'flazz/vim-colorschemes'
let g:expand_region_text_objects_clojure = {
\ 'a)' :1,
\ }
if v:version >= '702'
Bundle 'majutsushi/tagbar'
Bundle 'scrooloose/syntastic'
endif
filetype plugin indent on " vundle required
" Customize leader
let mapleader = ' '
" Load pathogen
call pathogen#infect()
" Basic config
if exists("&relativenumber")
set relativenumber " User nifty relative line numbers
else
set number " Show line numbers
endif
set ttyfast " Optimize for fast terminal connections
set cursorline " Highlight current line
set showcmd " show partial command as you type them
set updatetime=250 " timeout for writing swap file, also affect showmarks
" updates
set vb t_vb= " disable any beeping
" Don’t reset cursor to start of line when moving around.
set nostartofline
" We live in the future
set mouse=a
if exists("&colorcolumn")
" Show column 80
set colorcolumn=80
endif
" make split and vsplit open window in sane ways
set splitright
set splitbelow
" Spelling
if v:version >= 700
" Enable spell check for text files
autocmd BufNewFile,BufRead *.txt,*.md setlocal spell spelllang=en
"spell check when writing commit logs
autocmd filetype svn,*commit* setlocal spell spelllang=en
endif
set showmatch " show matching brackets
set formatoptions=tcrql " t - autowrap to textwidth
" c - autowrap comments to textwidth
" r - autoinsert comment leader with <Enter>
" q - allow formatting of comments with :gq
" l - don't format already long lines
" Color scheme
colorscheme molokai
" Whitespace
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set expandtab " use spaces, not tabs
if exists("g:enable_mvim_shift_arrow")
let macvim_hig_shift_movement = 1 " mvim shift-arrow-keys
endif
set list " Show invisible characters
" Searching
set hlsearch " highlight matches
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" Keep search matches in the middle of the window:
nnoremap * *zzzv
nnoremap # #zzzv
nnoremap n nzzzv
nnoremap N Nzzzv
" Disable output and VCS files
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.class,.svn,*.gem
" Disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
" Disable temp and backup files
set wildignore+=*.swp,*~,._*
" Backup and swap files
function! InitBackupDir()
let parent = $HOME .'/.vim/'
let backup = parent . 'backup/'
let tmp = parent . 'tmp/'
if exists("*mkdir")
if !isdirectory(parent)
call mkdir(parent)
endif
if !isdirectory(backup)
call mkdir(backup)
endif
if !isdirectory(tmp)
call mkdir(tmp)
endif
endif
let missing_dir = 0
if isdirectory(tmp)
execute 'set backupdir=' . escape(backup, " ") . "/,."
else
let missing_dir = 1
endif
if isdirectory(backup)
execute 'set directory=' . escape(tmp, " ") . "/,."
else
let missing_dir = 1
endif
if missing_dir
echo "Warning: Unable to create backup directories: " . backup ." and " . tmp
echo "Try: mkdir -p " . backup
echo "and: mkdir -p " . tmp
set backupdir=.
set directory=.
endif
endfunction
call InitBackupDir()
set guifont=Inconsolata\ for\ Powerline:h14
" Disable toolbar
if has("gui_running")
set guioptions-=T
endif
" enable sane text selection
if has("gui_macvim")
let macvim_hig_shift_movement = 1
endif
" Enable sane file selection
set wildmode=list:longest
" Don't show swap alert, default value is filnxtToO
set shortmess=filnxtToOA
" Going hard core
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
filetype on
filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin)
if has("autocmd")
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType make set noexpandtab
" Treat JSON files like JavaScript
au BufNewFile,BufRead *.json set ft=javascript
" Make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
" Remember last location in file, but not for commit messages.
" see :help last-position-jump
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
endif
if has("gui_running")
if has("autocmd")
" Automatically resize splits when resizing MacVim window
autocmd VimResized * wincmd =
endif
endif
" Statusline
if has("statusline") && !&cp
" Start the status line
set statusline=%f\ %m\ %r
" Add fugitive if enabled
set statusline+=%{fugitive#statusline()}
" Add syntastic if enabled
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
" Finish the statusline
set statusline+=Line:%l/%L[%p%%]
set statusline+=Col:%v
set statusline+=Buf:#%n
set statusline+=[%b][0x%B]
endif
if has("gui_macvim")
" Command-Shift-F on OSX
map <D-F> :Ack<space>
map <D-t> :CtrlP<CR>
imap <D-F> <ESC>:CtrlP<CR>
else
" Control-Shift-F on other systems
map <C-F> :Ack<space>
map <C-t> :CtrlP<CR>
imap <C-F> <ESC>:CtrlP<CR>
endif
" Configure indent guides (toggle with ,ig)
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
map <Leader>rt :TagbarToggle<CR>
" Fugitive mappings
nmap <leader>gb :Gblame<CR>
nmap <leader>gs :Gstatus<CR>
nmap <leader>gd :Gdiff<CR>
nmap <leader>gl :Glog<CR>
nmap <leader>gc :Gcommit<CR>
nmap <leader>gp :Git push<CR>
nmap <Leader>gD :diffoff!<cr><c-w>h:bd<cr>
" Move lines up and down
nmap <Leader><Down> ddp
nmap <Leader><Up> ddkkp
" Open pydoc window to the right
let g:pydoc_open_cmd = 'botright 60vsplit'
" Always copy to the system clipboard
set clipboard=unnamed
if has("gui_macvim")
function! OnlineDoc()
let s:wordUnderCursor = expand("<cword>")
let s:cmd = "silent !open dash://" . s:wordUnderCursor
execute s:cmd
endfunction
" Online doc search.
map <silent> <Leader>d :call OnlineDoc()<CR>
endif
let g:showmarks_include = "abcdefghijklmnopqrstuvwxyz"
" Give this a try perhaps
nnoremap <Left> :bprev<CR>
nnoremap <Right> :bnext<CR>
nnoremap <Up> :buffers<CR>:buffer<SPACE>
nnoremap <Down> <C-^>
let g:airline_right_sep = ''
let g:airline_left_sep = ''
"let g:airline_linecolumn_prefix = '␊ '
"let g:airline_linecolumn_prefix = ' '
let g:airline_symbols#linenr = '¶ '
let g:airline_symbols#branch = '⎇ '
let g:bufferline_echo=0
autocmd VimEnter * let &statusline='%{bufferline#refresh_status()}' .bufferline#get_status_string()
au BufEnter /private/tmp/crontab.* setl backupcopy=yes
au BufNewFile,BufRead *.md set filetype=markdown
au BufNewFile,BufRead *.clj RainbowParenthesesToggle