-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
229 lines (179 loc) · 5.92 KB
/
vimrc
File metadata and controls
229 lines (179 loc) · 5.92 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
set nocompatible " be iMproved, required
filetype on
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'godlygeek/tabular'
Plugin 'airblade/vim-gitgutter'
Plugin 'altercation/vim-colors-solarized'
Plugin 'terryma/vim-multiple-cursors'
Plugin 's3rvac/vim-syntax-redminewiki'
Plugin 'mileszs/ack.vim'
Plugin 'kchmck/vim-coffee-script'
Plugin 'vimwiki/vimwiki'
Plugin 'ervandew/supertab'
Plugin 'slim-template/vim-slim'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'majutsushi/tagbar'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-syntastic/syntastic'
packadd! matchit
"Tryouts
"Plugin 'git://git.wincent.com/command-t.git'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}
call vundle#end() " required
filetype plugin indent on " required
" To disable a plugin, add its bundle name to the following list
" Via http://stackoverflow.com/a/5316897/56333
" let g:pathogen_disabled = []
" Determine if we're running on a Mac.
" If not, disable Dash plugin
" http://stackoverflow.com/a/2842811/56333
" if has("unix")
" let s:uname = substitute(system("uname"), '\n', '', '')
" if s:uname != "Darwin"
" call add(g:pathogen_disabled, 'dash')
" endif
" endif
filetype plugin on
syntax enable
"For Solarized color scheme
if has('gui_running')
set background=light
colorscheme solarized
endif
filetype plugin indent on
"Fugitive settings
if v:version >= 700
"set statusline+=%{fugitive#statusline()}
endif
"general settings
set expandtab
set ruler
set nocompatible
" *** Unified Tab Width Changing
" Change all tab widths at once
function! SetTabWidth(width)
let &tabstop=a:width
let &softtabstop=a:width
let &shiftwidth=a:width
endfunction
command! -n=1 -bar St :call SetTabWidth(<args>)
" Set default
call SetTabWidth(4)
" *** NERDTree Customization
"Don't show some files in NERDTree
let NERDTreeIgnore = ['\.pyc$']
" Change window directory and execute NERDTree
function! CdToNERDTree(dir)
exec 'lcd '.a:dir
exec 'NERDTree'
endfunction
" Shortcuts
command! -n=? -complete=dir Nt :call CdToNERDTree('<args>')
command! Ntf :NERDTreeFind
set nofoldenable
" Start with NERDTree running
autocmd VimEnter * Nt .
" Default to the editor rather than NERDtree if vim was called with a file as
" an argument
if argc() > 0
autocmd VimEnter * wincmd p
endif
" *** Pretty Printing
" Format file using passed-in command-line executable
" Write the file if a bang is passed in
function! PrettyPrint(bang, command)
exec a:command
if v:shell_error
" Bail if command returned 1
let error_text = join(getline(1, '$'), "\n")
undo
echo 'ERROR: ' . error_text
elseif a:bang == '!'
:w
end
endfunction
" JSON pretty printing. Requires Python
function! JsonPrettyPrint(bang)
call PrettyPrint(a:bang, 'silent %!python -m json.tool')
endfunction
command! -n=0 -bang Jpp :call PrettyPrint('<bang>', 'silent %!python -m json.tool')
" XML pretty printing. Requires xmllint
function! XmlPrettyPrint(bang)
call PrettyPrint(a:bang, 'silent %!xmllint --format -')
endfunction
command! -n=0 -bang Xpp :call PrettyPrint('<bang>', 'silent %!xmllint --format -')
"Disable middle mouse pastes
nnoremap <MiddleMouse> <Nop>
nnoremap <2-MiddleMouse> <Nop>
nnoremap <3-MiddleMouse> <Nop>
nnoremap <4-MiddleMouse> <Nop>
inoremap <MiddleMouse> <Nop>
inoremap <2-MiddleMouse> <Nop>
inoremap <3-MiddleMouse> <Nop>
inoremap <4-MiddleMouse> <Nop>
" Consider all .redmine files Redmine wiki files.
au BufNewFile,BufRead *.redmine set ft=redminewiki
" Consider all .md files Markdown files.
au BufNewFile,BufRead *.md set ft=markdown
" Mappings for CommandT
noremap <leader>o <Esc>:CommandT<CR>
noremap <leader>O <Esc>:CommandTFlush<CR>
" Adding highlighting for Ruby files not ending in .rb
augroup ruby_highlighting
au!
au BufNewFile,BufRead Gemfile set filetype=ruby
au BufNewFile,BufRead Gemfile.lock set filetype=ruby
au BufNewFile,BufRead Guardfile set filetype=ruby
au BufNewFile,BufRead Capfile set filetype=ruby
augroup END
" Vimwiki config
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md', 'auto_tags': 1},
\{'path': '~/personal_wiki/',
\ 'syntax': 'markdown', 'ext': '.md', 'auto_tags': 1}]
let s:vimdir = fnamemodify(resolve(expand('<sfile>:p')), ':h')
" Vimwiki Tagbar integration
let g:tagbar_type_vimwiki = {
\ 'ctagstype':'vimwiki'
\ , 'kinds':['h:header']
\ , 'sro':'&&&'
\ , 'kind2scope':{'h':'header'}
\ , 'sort':0
\ , 'ctagsbin': s:vimdir.'/scripts/vwtags.py'
\ , 'ctagsargs': 'markdown'
\ }
" Syntastic config
let g:syntastic_ruby_checkers = ['rubocop']
let g:syntastic_ruby_rubocop_exec = "bundle"
let g:syntastic_ruby_rubocop_args = "exec rubocop"
let g:syntastic_php_phpcs_args = "--standard=PSR2 -n"
" Ag aliases in ack.vim
if executable('ag')
let g:ackprg = 'ag --nogroup --nocolor --column'
endif
cnoreabbrev Ag Ack
cnoreabbrev AgFile AckFile