-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
334 lines (252 loc) · 8.5 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
set nocompatible " be iMproved, required
filetype off " required
let mapleader = ","
" set the runtime path to include Vundle and initialize
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 'gmarik/Vundle.vim'
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/syntastic'
Plugin 'altercation/vim-colors-solarized'
Plugin 'bling/vim-airline'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'majutsushi/tagbar'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'rking/ag.vim'
Plugin 'jmcantrell/vim-virtualenv'
Plugin 'dbext.vim'
Plugin 'ervandew/supertab'
"good defaults
Plugin 'tpope/vim-sensible'
" Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
" Various shortcuts
Plugin 'tpope/vim-unimpaired'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" Plugin 'derekwyatt/vim-scala'
call vundle#end() " required
filetype plugin indent on " required
"Powerline options
"let g:Powerline_symbols = 'fancy'
"Airline help
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
"set guifont=Menlo\ Regular\ for\ PowerLine:h11
set guifont=Meslo\ LG\ S\ Regular\ for\ Powerline:h11
set visualbell
set background=dark
colorscheme solarized
"Better search
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set showmatch
set incsearch
set hlsearch
set gdefault
"Easy clearing of highlihgt
nnoremap <leader><space> :noh<cr>
"Long lines
set wrap
"set colorcolumn=85
"SNIPPETS
let g:snips_author = 'Frej Soya'
set expandtab
set tabstop=8
set autoindent
"Default setting of tabstop as recommended in help (width 8) -- printing, etc
set shiftwidth=2
set softtabstop=2
set nu
set smartindent
set smarttab
set ruler
"Save undofile!
set undofile
set relativenumber
" Save your backups to a less annoying place than the current directory.
" If you have .vim-backup in the current directory, it'll use that.
" Otherwise it saves it to ~/.vim/backup or . if all else fails.
if isdirectory($HOME . '/.vim/backup') == 0
:silent !mkdir -p ~/.vim/backup >/dev/null 2>&1
endif
set backupdir-=.
set backupdir+=.
set backupdir-=~/
set backupdir^=~/.vim/backup/
set backupdir^=./.vim-backup/
set backup
" Save your swp files to a less annoying place than the current directory.
" If you have .vim-swap in the current directory, it'll use that.
" Otherwise it saves it to ~/.vim/swap, ~/tmp or .
if isdirectory($HOME . '/.vim/swap') == 0
:silent !mkdir -p ~/.vim/swap >/dev/null 2>&1
endif
set directory=./.vim-swap//
set directory+=~/.vim/swap//
set directory+=~/tmp//
set directory+=.
" viminfo stores the the state of your previous editing session
set viminfo+=n~/.vim/viminfo
if exists("+undofile")
" undofile - This allows you to use undos after exiting and restarting
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
" :help undo-persistence
" This is only present in 7.3+
if isdirectory($HOME . '/.vim/undo') == 0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=./.vim-undo//
set undodir+=~/.vim/undo//
set undofile
endif
" Hide toolbar
set guioptions-=T
"Concealment
set conceallevel=2
let g:tex_conceal= 'adgm'
highlight Conceal guifg=fg guibg=bg
let g:tex_comment_nospell= 1
" let g:tex_fold_enabled=1
"ATP TEX
"let b:atp_TexCompiler="lualatex"
au BufReadPre *.tex let b:atp_TexCompiler="lualatex"
"wscript is a python file (waf)
au BufNewFile,BufRead wscript* set filetype=python
" LLVM Makefiles can have names such as Makefile.rules or TEST.nightly.Makefile,
" so it's important to categorize them as such.
augroup filetype
au! BufRead,BufNewFile *Makefile* set filetype=make
augroup END
" In Makefiles, don't expand tabs to spaces, since we need the actual tabs
autocmd FileType make set noexpandtab
" Delete trailing whitespace and tabs at the end of each line
command! DeleteTrailingWs :%s/\s\+$//
" Enable syntax highlighting for tablegen files. To use, copy
" utils/vim/tablegen.vim to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.td set filetype=tablegen
au! BufNewFile,BufRead *.plt,.gnuplot set filetype=gnuplot
augroup END
" Enable syntax highlighting for LLVM files. To use, copy
" utils/vim/llvm.vim to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.ll set filetype=llvm
augroup END
augroup filetype
au! BufRead,BufNewFile *.sig set filetype=sml
augroup END
" Convert all tab characters to two spaces
command! Untab :%s/\t/ /g
set encoding=utf-8
" use ghc functionality for haskell files
au Bufenter *.hs compiler ghc
" enable filetype detection, triggers loading of filetype plugins
" (documentation only - this is already implied by :set syntax on)
" configure browser for haskell_doc.vim
"
" Configure browser for haskell_doc.vim
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"
"
function! s:set_working_directory_for_project()
let wd = expand("%:p:h")
silent exe "cd " . wd
let git_root = s:git_root()
if git_root != ""
silent exe "cd " . git_root
return
endif
let hg_root = s:mercurial_root()
if hg_root != ""
silent exe "cd " . hg_root
return
endif
endfunction
function! s:mercurial_root()
let mercurial_root = system('hg root')
if v:shell_error != 0
return ""
endif
return mercurial_root
endfunction
function! s:git_root()
let git_root = system('git rev-parse --show-toplevel')
if v:shell_error != 0
return ""
endif
return git_root
endfunction
"au BufEnter * call s:set_working_directory_for_project()
au BufNewFile,BufRead *.plt,.gnuplot setf gnuplot
if filereadable($VIRTUAL_ENV . '/.vimrc')
source $VIRTUAL_ENV/.vimrc
endif
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_javascript_checkers = ['jshint']
"Enable automatic doxygen
let g:load_doxygen_syntax=1
let g:doxygen_enhanced_color=1
"Ag search (silver searcher
let g:ackprg = 'ag --nogroup --nocolor --column'
"merling / ocaml
let g:merlin_ignore_warnings = "true"
let g:opamshare = substitute(system('opam config var share'),'\n$','','''')
execute "set rtp+=" . g:opamshare . "/merlin/vim"
autocmd FileType ocaml
\ map <LocalLeader>l :Locate<CR> |
\ map <LocalLeader>d :Destruct<CR> |
\ map <LocalLeader>< :ShrinkEnclosing<CR> |
\ map <LocalLeader>> :GrowEnclosing<CR> |
nmap <LocalLeader>r <Plug>(MerlinRename)
nmap <LocalLeader>R <Plug>(MerlinRenameAppend)
" \ hi EnclosingExpr ctermbg=7
au FileType ocaml call SuperTabSetDefaultCompletionType("<c-x><c-o>")
let g:syntastic_ocaml_checkers = ['merlin']
" ## added by OPAM user-setup for vim / base ## 8a3125e39f347f6b9a1b167d8e564281 ## you can edit, but keep this line
let s:opam_share_dir = system("opam config var share")
let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')
let s:opam_configuration = {}
function! OpamConfOcpIndent()
let l:file = s:opam_share_dir . "/vim/syntax/ocp-indent.vim"
execute "source " . l:file
endfunction
let s:opam_configuration['ocp-indent'] = function('OpamConfOcpIndent')
function! OpamConfOcpIndex()
let l:file = s:opam_share_dir . "/vim/syntax/ocpindex.vim"
execute "source " . l:file
endfunction
let s:opam_configuration['ocp-index'] = function('OpamConfOcpIndex')
function! OpamConfMerlin()
let l:dir = s:opam_share_dir . "/merlin/vim"
execute "set rtp+=" . l:dir
endfunction
let s:opam_configuration['merlin'] = function('OpamConfMerlin')
let s:opam_packages = ["ocp-indent", "ocp-index", "merlin"]
let s:opam_check_cmdline = ["opam list --installed --short --safe --color=never"] + s:opam_packages
let s:opam_available_tools = split(system(join(s:opam_check_cmdline, ' ')))
for tool in s:opam_available_tools
call s:opam_configuration[tool]()
endfor
" ## end of OPAM user-setup addition for vim / base ## keep this line
" ## added by OPAM user-setup for vim / ocp-indent ## 38c1f71fce5736312137eeae3b5234d6 ## you can edit, but keep this line
if count(s:opam_available_tools,"ocp-indent") == 0
source "/Users/frej/.opam/4.02.1/share/vim/syntax/ocp-indent.vim"
endif
" ## end of OPAM user-setup addition for vim / ocp-indent ## keep this line