-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
215 lines (186 loc) · 8.25 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
execute pathogen#infect()
filetype plugin on
" vim: set foldmarker={,} foldlevel=0 spell:
"
set nocompatible " explicitly get out of vi-compatible mode
set noexrc " don't use local version of .(g)vimrc, .exrc
set background=dark " we plan to use a dark background
set cpoptions=aABceFsmq
" |||||||||
" ||||||||+-- When joining lines, leave the cursor
" ||||||| between joined lines
" |||||||+-- When a new match is created (showmatch)
" |||||| pause for .5
" ||||||+-- Set buffer options when entering the
" ||||| buffer
" |||||+-- :write command updates current file name
" ||||+-- Automatically add <CR> to the last line
" ||| when using :@r
" |||+-- Searching continues at the end of the match
" || at the cursor position
" ||+-- A backslash has no special meaning in mappings
" |+-- :write updates alternative file name
" +-- :read updates alternative file name
syntax on " syntax highlighting on
set autochdir " always switch to the current file directory
set backup " make backup files
set clipboard+=unnamed " share windows clipboard
set hidden " you can change buffers without saving
" (XXX: #VIM/tpope warns the line below could break things)
set iskeyword+=_,$,@,%,# " none of these are word dividers
set mouse=a " use mouse everywhere
set noerrorbells " don't make noise
set whichwrap=b,s,h,l,<,>,~,[,] " everything wraps
" | | | | | | | | |
" | | | | | | | | +-- "]" Insert and Replace
" | | | | | | | +-- "[" Insert and Replace
" | | | | | | +-- "~" Normal
" | | | | | +-- <Right> Normal and Visual
" | | | | +-- <Left> Normal and Visual
" | | | +-- "l" Normal and Visual (not recommended)
" | | +-- "h" Normal and Visual (not recommended)
" | +-- <Space> Normal and Visual
" +-- <BS> Normal and Visual
" ignore these list file extensions
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,*.jpg,*.gif,*.png
set wildmode=list:longest " turn on wild mode huge list
set cursorcolumn " highlight the current column
set incsearch " BUT do highlight as you type you search phrase
set cursorline " highlight current line
set lazyredraw " do not redraw while running macros
set linespace=0 " don't insert any extra pixel lines betweens rows
set matchtime=5 " how many tenths of a second to blink matching brackets for
set nostartofline " leave my cursor where it was
set novisualbell " don't blink
set number " turn on line numbers
set numberwidth=5 " We are good up to 99999 lines
set report=0 " tell us when anything is changed via :...
set shortmess=aOstT " shortens messages to avoid 'press a key' prompt
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
" | | | | | | | | | | |
" | | | | | | | | | | + current
" | | | | | | | | | | column
" | | | | | | | | | +-- current line
" | | | | | | | | +-- current % into file
" | | | | | | | +-- current syntax in
" | | | | | | | square brackets
" | | | | | | +-- current fileformat
" | | | | | +-- number of lines
" | | | | +-- preview flag in square brackets
" | | | +-- help flag in square brackets
" | | +-- readonly flag in square brackets
" | +-- rodified flag in square brackets
" +-- full path to file in the buffer
" set completeopt= " don't use a pop up menu for completions
set expandtab " no real tabs please!
" set formatoptions=rq " Automatically insert comment leader on return, and let gq format comments
set ignorecase " case insensitive by default
set infercase " case inferred by default
set nowrap " do not wrap line
set smartcase " if there are caps, go case-sensitive
set shiftwidth=4 " auto-indent amount when using cindent, >>, << and stuff like that
set softtabstop=4 " when hitting tab or backspace, how many spaces should a tab be (see expandtab)
set tabstop=4
set cino=N-s,i0,g0
set foldenable " Turn on folding
set foldmarker={,} " Fold C style code (only use this as default if you use a high foldlevel)
set foldmethod=marker " Fold on the marker
set foldlevel=100 " Don't autofold anything (but I can still fold manually)
set foldopen=block,hor,mark,percent,quickfix,tag " what movements open folds
function SimpleFoldText() " {
return getline(v:foldstart).' '
endfunction " }
set foldtext=SimpleFoldText() " Custom fold text function (cleaner than default)
let b:match_ignorecase = 1 " case is stupid
let perl_extended_vars=1 " highlight advanced perl vars inside strings
if has('win32')
set backup " make backup files
set backupdir=~/tmp/vim/backup " where to put backup files
set clipboard+=unnamed " share windows clipboard
set directory=~/tmp/vim/swap " directory to place swap files in
endif
set fileformats=unix,dos,mac " support all three, in this order
set list " we do what to show tabs, to ensure we get them out of my files
set hlsearch " highlight searched for phrases
if has("gui_running")
" colorscheme inkpot
colorscheme mustang
set columns=180
if has('win32')
set guifont=Consolas:h10
else
"set guifont=DejaVu\ Sans\ Mono\ 10
set guifont=Ubuntu\ Mono\ 10
endif
set guioptions=ce
" ||
" |+-- use simple dialogs rather than pop-ups
" + use GUI tabs, not console style tabs
set lines=55
set mousehide " hide the mouse cursor when typing
endif
" C++
au FileType cpp,objcpp set syntax=cpp
au BufNewFile,BufRead *
\ if expand('%:e') =~ '^\(h\|hh\|hxx\|hpp\|ii\|ixx\|ipp\|inl\|txx\|tpp\|tpl\|cc\|cxx\|cpp\)$' |
\ if &ft != 'cpp' |
\ set ft=cpp |
\ endif |
\ endif |
" rainbow parentheses
au FileType c,cpp,objc,objcpp call rainbow#load()
" gnu global
let Gtags_Auto_Map = 1
if !has('win32')
" Clang Complete Settings
" g:clang_user_options set at vimprj section
let g:clang_use_library=1
let g:clang_complete_copen=1
let g:clang_complete_macros=1
let g:clang_complete_patterns=0
" Avoids lame path cache generation and other unknown sources for includes
let g:clang_auto_user_options=''
let g:clang_memory_percent=70
set conceallevel=2
set concealcursor=vin
let g:clang_snippets=1
let g:clang_conceal_snippets=1
" The single one that works with clang_complete
let g:clang_snippets_engine='clang_complete'
" Complete options (disable preview scratch window, longest removed to aways
" show menu)
set completeopt=menu,menuone
" Limit popup menu height
set pumheight=20
" SuperTab completion fall-back
let g:SuperTabDefaultCompletionType='<c-x><c-u><c-p>'
" SuperTab completion fall-back for context aware completion
" (incompatible with g:clang_auto_select=0, using the above)
" let g:SuperTabContextDefaultCompletionType='<c-x><c-u><c-p>'
" Reparse the current translation unit in background
command Parse
\ if &ft == 'cpp' |
\ call g:ClangBackgroundParse() |
\ else |
\ echom 'Parse What?' |
\ endif
" Reparse the current translation unit and check for errors
command ClangCheck
\ if &ft == 'cpp' |
\ call g:ClangUpdateQuickFix() |
\ else |
\ echom 'Check What?' |
\ endif
noremap <silent> <F5> :Parse<cr>
noremap <silent> <F6> :ClangCheck<cr>
noremap! <silent> <F5> <c-o>:Parse<cr>
noremap! <silent> <F6> <c-o>:ClangCheck<cr>
" Called BEFORE sourcing .vimprj and when not sourcing
"function! g:vimprj#dHooks['SetDefaultOptions']['main_options'](dParams)
"let g:clang_user_options = '-std=c++11 -stdlib=libc++'
"endfunction
endif
let g:alternateExtensions_hh = "c,cc,cpp,cxx,CC"
let g:alternateExtensions_cc = "h,hh,H"
:nnoremap <esc> :noh<return><esc>
:noremap <C-[> :noh<c-[><esc>