-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
355 lines (267 loc) · 9.55 KB
/
vimrc
File metadata and controls
355 lines (267 loc) · 9.55 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
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
" reload with :so ~/.vimrc (or :so % if editing)
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set path+=/usr/include/alsa/
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'jceb/vim-orgmode'
Plugin 'tpope/vim-speeddating'
Plugin 'majutsushi/tagbar'
Plugin 'taglist.vim'
Plugin 'benmills/vimux'
" Allow repeating plugin maps with .
Plugin 'tpope/vim-repeat'
" change surrounding quotes etc
Plugin 'tpope/vim-surround'
" auto-detect indentation in current file
Plugin 'tpope/vim-sleuth'
" golang
Plugin 'fatih/vim-go'
" http://vimawesome.com/plugin/easymotion
" TODO - go through configuration ...
" Plugin 'Lokaltog/vim-easymotion'
"Plugin 'tpope/vim-fugitive'
" http://www.vim.org/scripts/script.php?script_id=3252
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" insert mode auto-completion for quotes, parenthesis etc
" https://github.com/Raimondi/delimitMate
" Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/syntastic'
" Plugin 'tomasr/molokai'
Plugin 'vim-scripts/dante.vim'
"Plugin 'humiaozuzu/TabBar'
Plugin 'xolox/vim-misc'
" https://github.com/xolox/vim-easytags
" requires exuberant-ctags to be installed
" Plugin 'xolox/vim-easytags'
" Plugin 'majutsushi/tagbar'
" Plugin 'kien/ctrlp.vim'
" Plugin 'tpope/vim-rails'
" Plugin 'tpope/vim-bundler'
" Plugin 'vim-perl/vim-perl'
Plugin 'vim-ruby/vim-ruby'
Plugin 'pangloss/vim-javascript'
Plugin 'othree/html5.vim'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'chrisbra/csv.vim'
Plugin 'elzr/vim-json'
"Plugin 'maksimr/vim-jsbeautify'
" Plugin 'w0rp/ale'
Plugin 'junegunn/fzf'
" Plugin 'vim-scripts/Vim-R-plugin'
Plugin 'Align'
" Plugin 'SQLUtilities'
" Plugin 'freitass/todo.txt-vim'
" wrapper for the silver searcher ('ag') plugin for vim
Plugin 'rking/ag.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set backup " keep a backup file
set backupdir=~/.vim/backup
" from http://vim.wikia.com/wiki/Keep_incremental_backups_of_edited_files
let myvar = strftime("%F_%H%M%S")
let myvar = "set backupext=_".myvar
execute myvar
set directory=~/.vim/tmp " Swap file directory
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set number
" Don't use Ex mode, use Q for formatting
map Q gq
" In an xterm the mouse should work quite well, thus enable it.
set mouse=a
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
set shiftwidth=2
set tabstop=4
set smartindent
"set breakindent
" Keep permanent undo info! :-)
set undofile " Save undo's after file closes
set undodir=~/.vim/undo " where to save undo histories - need to do mkdir to get it work
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
silent !mkdir -p ~/.vim/tmp
silent !mkdir -p ~/.vim/undo
silent !mkdir -p ~/.vim/backup
" don't keep backups over a month ...
silent !find ~/.vim/backup/ -ctime +30 -delete
" show matching brackets
autocmd FileType perl set showmatch
" check perl code with :make
autocmd FileType perl set makeprg=perl\ -Wc\ %\ $*
autocmd FileType perl set errorformat=%f:%l:%m
autocmd FileType perl set autowrite
set background=dark
"colorscheme molokai
colorscheme dante
if &diff
colorscheme evening
endif
set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
"use a strong cipher for encrypting files,
"default is 'zip'
setlocal cm=blowfish2
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_ruby_checkers = ['rubocop', 'mri']
let g:syntastic_ruby_checkers = ['rubocop']
" default java checker (javac) takes aaaaaages
let g:syntastic_java_checkers = ['checkstyle']
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_perl_checkers=['perl', 'perlcritic']
" let g:syntastic_perl_checkers=['perl']
let g:syntastic_enable_perl_checker = 1
" let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_go_checkers = ['golint', 'govet', 'go']
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:syntastic_enable_go_checker = 1
" let g:syntastic_c_checkers = ['gcc', 'splint']
" ----- xolox/vim-easytags settings -----
" Where to look for tags files
set tags=./tags;,~/.vimtags
" Sensible defaults
let g:easytags_events = ['BufReadPost', 'BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1
" ----- majutsushi/tagbar settings -----
" Open/close tagbar with \b
nmap <silent> <leader>b :TagbarToggle<CR>
" Uncomment to open tagbar automatically whenever possible
"autocmd BufEnter * nested :call tagbar#autoopen(0)
" ----- jistr/vim-nerdtree-tabs -----
" Open/close NERDTree Tabs with \t
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
" To have NERDTree always open on startup
let g:nerdtree_tabs_open_on_console_startup = 0
let g:nerdtree_tabs_open_on_gui_startup = 0
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
augroup END
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Look in .svn .git etc
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
" js beautify
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
" for sql
autocmd FileType sql noremap <buffer> <c-f> :% SQLUFormatter<cr>
" for xml
autocmd FileType xml noremap <buffer> <c-f> :% ! tidy -utf8 -xml -w 180 -i -c -q -asxml <cr>
au! BufRead,BufNewFile *.json set filetype=json
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
au! BufRead,BufNewFile Berksfile set filetype=ruby
au! BufRead,BufNewFile Vagrantfile set filetype=ruby
if has("gui_running")
" GUI is running or is about to start.
" Maximize gvim window (for an alternative on Windows, see simalt below).
set lines=999 columns=999
else
" This is console Vim.
if exists("+lines")
set lines=50
endif
if exists("+columns")
set columns=100
endif
endif
" set this at the end, because something seemed to be overriding it ...
" I hate tabs!
set expandtab
" nicked from https://github.com/Morantron/dotfiles/blob/master/vimrc#L229
function! SendToNearestPane(type, ...)
let reg_save = @@
"if exists("g:VimuxRunnerIndex") "use this to open vimux runner
"inteligently
if a:0 " Invoked from Visual mode, use gv command.
silent exe "normal! gvy"
elseif a:type == 'line'
silent exe "normal! '[V']y"
else
silent exe "normal! :%y"
endif
call VimuxSendText(@@)
let @@ = reg_save
endfunction
nnoremap \\ :<C-U>call SendToNearestPane(1)<CR>
vmap \\ :<C-U>call SendToNearestPane(visualmode(), 1)<CR>