-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
248 lines (189 loc) · 6.28 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
map <F5> :!./testmine.sh <CR>
map <F8> :!./testref.sh <CR>
map <F9> :!./test.sh <CR>
map <F7> :!./run_production.sh <CR>
map <S-F9> :!vimdiff data.cl-ast cldata.cl-ast <CR>
"Vundle settings from the github
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
"Let Vundle managed vundle!
Plugin 'VundleVim/Vundle.vim'
"My bundles here:
Bundle 'sjl/gundo.vim'
nnoremap <F10> :GundoToggle<CR>
Bundle 'Valloric/YouCompleteMe'
let mapleader = "\<Space>"
nnoremap <leader>t :YcmCompleter GetType<CR>
"Auto tag
Bundle 'craigemery/vim-autotag'
"Targets
Bundle 'wellle/targets.vim'
"Airline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
let g:airline_theme='kolor'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
set fillchars+=stl:\ ,stlnc:\
" 256 Colors
Bundle 'noah/vim256-color'
"Set some statusline stuff
set laststatus=2
"messan's
" set statusline= " clear the statusline for when vimrc is reloaded
" set statusline+=%-3.3n\ " buffer number
" set statusline+=%f\ " file name
" set statusline+=%h%m%r%w " flags
" set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype
" set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
" set statusline+=%{&fileformat}] " file format
" set statusline+=%= " right align
" set statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\ " highlight
" set statusline+=%b,0x%-8B\ " current char
" set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
Plugin 'terryma/vim-expand-region'
vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
"Fix backspace back to the way it was, damn it
set backspace=indent,eol,start
Bundle 'scrooloose/syntastic'
"let g:syntastic_mode_ap = {'more': 'active',
"\ 'active_filetypes': [],
"\ 'passive_filetypes': ['html'] }
"highlight SyntasticErrorSign guifg=white guibg=red
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
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:opamshare = substitute(system('opam config var share'),'\n$','','''')
execute "set rtp+=" . g:opamshare . "/merlin/vim"
let g:syntastic_ocaml_checkers = ['merlin']
"If you use `:mksession` to save Vim sessions you should probably make sure to
"remove option "blank" from 'sessionoptions': >
set sessionoptions-=blank
syntax on "Had to add after vundle stuff
set shiftwidth=4
set expandtab
set undofile
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000
set incsearch " Keep matching
set ignorecase
set smartcase " Only lower: case insensitive; if any upper, case sensitive
"Have the title string show the path and name of the file.
let &titlestring = "vim: " . expand("%:p")
if &term == "screen"
set t_ts=^[k
set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
set title
endif
"Reindent the whole file
map <F4> mzgg=G`z<CR>
filetype plugin indent on "Also required for vundle
"Turn on spell checking for .txt files
autocmd FileType notes setlocal spell
"Turn off annoying blue highlight of uncapitalized sentence start.
set spc=
"Toggle folds with F12, visual select and F12 to fold
set foldmethod=manual
inoremap <F12> <C-O>za
nnoremap <F12> za
onoremap <F12> <C-C>za
vnoremap <F12> zf
"Turn on line numbers and change their color. Add map to turn off. set nu
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
nmap <C-N><C-N> :set invnumber<CR>
"Programming abbreviations
abbr #i #include
abbr #d #define
colorscheme oxeded
" augroup reload_vimrc " {
" autocmd!
" autocmd BufWritePost $MYVIMRC source $MYVIMRC
" augroup END " }
autocmd! BufWritePost .vimrc source %
set splitbelow
set splitright
"Highlights all instants of search, clear with space
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
"Custom per directory vim settings, for unusual indentations, perhaps.
if filereadable(".vim.custom")
so .vim.custom
endif
"Make asm files use nasm stuff
au BufRead,BufNewFile *.asm set filetype=nasm
au BufRead,BufNewFile *.ml,*.mli compiler ocaml
""Remap movement between windows
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
nmap <leader>h <C-w>h
nmap <leader>j <C-w>j
nmap <leader>k <C-w>k
nmap <leader>l <C-w>l
""Remap window rearrangement
nmap <C-m>h <C-w>H
nmap <C-m>j <C-w>J
nmap <C-m>k <C-w>K
nmap <C-m>l <C-w>L
nmap <leader>mh <C-w>H
nmap <leader>mj <C-w>J
nmap <leader>mk <C-w>K
nmap <leader>ml <C-w>L
" Fast window resizing with +/- keys (horizontal); / and * keys (vertical)
map <kPlus> <C-W>+
map <kMinus> <C-W>-
map <kDivide> <c-w><
map <kMultiply> <c-w>>
set so=7
nnoremap e 5<c-e>
nnoremap k 5<c-y>
"Get rid of expandtab for Makefiles
autocmd FileType make set noexpandtab
set softtabstop=4
" Highlight the line the cursor is one
set cursorline
"Add tab completion to works
"imap <Tab> <C-N>
set wildmode=longest,list,full
set wildmenu
autocmd FileType ocaml setlocal shiftwidth=2 softtabstop=2
autocmd FileType c setlocal shiftwidth=4 softtabstop=4
set autoread
nmap ; :
nnoremap Y y$
" Commenting blocks of code.
autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
autocmd FileType sh,ruby,python let b:comment_leader = '# '
autocmd FileType conf,fstab let b:comment_leader = '# '
autocmd FileType tex let b:comment_leader = '% '
autocmd FileType mail let b:comment_leader = '> '
autocmd FileType vim let b:comment_leader = '" '
autocmd FileType zsh let b:comment_leader = '# '
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
" Nede to add one here for Ocaml
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction