-
Notifications
You must be signed in to change notification settings - Fork 0
/
osxvimrc-2
252 lines (201 loc) · 5.93 KB
/
osxvimrc-2
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
" Disable toolabar
" has to be the first thing you do to prevent slow load times
set guioptions=aegiMLc
:aunmenu *
"GUI hacks
if has("gui_running")
"Paste from clipboard in normal mode
nmap <S-INS> "+gP
"Paste from clipboard in insert mode
imap <S-INS> <c-r>+
"Copy to system clipboard
vmap <C-S-C> "+y
" Hide the mouse pointer while typing
set mousehide
endif
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" Bundles
Bundle 'scrooloose/syntastic'
Bundle 'Markdown'
Bundle 'Valloric/YouCompleteMe'
Bundle 'embear/vim-localvimrc'
Bundle 'tpope/vim-fugitive'
"Bundle 'Blackrush/vim-gocode'
Bundle 'fatih/vim-go'
Bundle 'kchmck/vim-coffee-script'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup'
Bundle 'kien/ctrlp.vim'
Bundle 'bling/vim-airline'
Bundle 'vim-scripts/mediawiki.vim'
Bundle 'vim-scripts/colorschemer'
Bundle 'jdonaldson/vaxe'
Bundle 'leafo/moonscript-vim'
Bundle 'tikhomirov/vim-glsl'
Bundle 'majutsushi/tagbar'
Bundle 'OrangeT/vim-csharp'
Bundle 'cespare/vim-toml'
Bundle 'klen/python-mode'
Bundle 'ciaranm/inkpot'
Bundle 'altercation/vim-colors-solarized'
"Python-mode
" don't use linter, we use syntastic for that
let g:pymode_lint_on_write = 0
let g:pymode_lint_signs = 0
" don't fold python code on open
let g:pymode_folding = 0
" don't load rope by default. Change to 1 to use rope
let g:pymode_rope = 0
" open definitions on same window, and custom mappings for definitions and
" occurrences
let g:pymode_rope_goto_definition_bind = ',d'
let g:pymode_rope_goto_definition_cmd = 'e'
nmap ,D :tab split<CR>:PymodePython rope.goto()<CR>
nmap ,o :RopeFindOccurrences<CR>
" Syntastic
let g:syntastic_echo_current_error = 1
let g:syntastic_enable_signs = 1
let g:syntastic_enable_highlighting = 1
let g:syntastic_auto_jump = 0
let g:syntastic_auto_loc_list = 1
" Checks for vala and java are buggy and annoying
let g:syntastic_vala_check_disabled = 1
let g:syntastic_java_check_disabled = 1
let g:syntastic_python_checkers=['flake8']
"Go support
let g:ycm_semantic_triggers = {
\ 'go' : ['.'],
\ 'rust' : ['::', '.'],
\ 'lua' : ['.', ':'],
\ }
"Git
:au Filetype gitcommit setlocal spell
"Filetype fix
:filetype on
"cscope
if filereadable("cscope.out")
set nocscopeverbose
cs add cscope.out
set cscopeverbose
endif
":autocmd FileType c,cpp,h nmap <C-]> :cs find g <C-R>=expand("<cword>")<CR><CR>
":autocmd FileType c,cpp,h nmap <C-\> :cs find c <C-R>=expand("<cword>")<CR><CR>
"Code jumping
:autocmd FileType python nmap <C-\> :YcmCompleter GoToDeclaration<CR>
:autocmd FileType * nmap <A-\> :Ggrep "\<<cword>\>" -- *.[ch]<CR>
:autocmd FileType python nmap <C-]> :YcmCompleter GoToDefinition<CR>
:autocmd FileType python map <silent> <leader>b oimport ipdb; ipdb.set_trace() # breakpoint<esc>
:autocmd FileType python map <silent> <leader>B Oimport pdb; pdb.set_trace() # breakpoint<esc>
:autocmd FileType go nmap <C-]> gd
:let g:godef_split = 0
"cmdline completion
set wildmenu
"Colors
set t_Co=256
let g:solarized_termcolors=256
"Inkpot scheme
:let g:inkpot_black_background = 1
set background=dark
"colorscheme inkpot
"colorscheme solarized
colorscheme cobalt
"Incremental search
:set incsearch
"Better autocopmlete
:set completeopt=longest,menuone
"Indentation
set autoindent
:autocmd FileType javascript,css,html,python,cython,vala,lua setlocal expandtab
:autocmd FileType javascript,css,html,python,cython,vala,lua setlocal shiftwidth=4
:autocmd FileType javascript,css,html,python,cython,vala,lua setlocal softtabstop=4
:autocmd FileType * setlocal autoindent
:autocmd FileType vala setlocal cindent
filetype plugin indent on
"Whitespace handling
:com! CleanExtraWhitespace :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))"
:nnoremap <silent> <F5> :CleanExtraWhitespace <CR>
:autocmd BufWritePre \(*.py\|*.[ch]\|*.go\|*.java\|*.cs\|*.cpp\) :CleanExtraWhitespace
:highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen
:au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
:au InsertLeave * match ExtraWhitespace /\s\+$/
"Tab mappings
:nmap <A-LEFT> :tabp<CR>
:nmap <A-RIGHT> :tabn<CR>
:nmap <C-S-T> :tabnew<CR>
"quickfix mappings
:nmap <A-DOWN> :cn<CR>
:nmap <A-UP> :cp<CR>
"Reread vimrc on update
:au! BufWritePost $MYVIMRC source $MYVIMRC
"Workaround netrw cursorline bug
:au! BufWritePost * set nocursorline
"Pyflakes fix
let g:pyflakes_use_quickfix = 0
"tagbar
" toggle tagbar display
map <F4> :TagbarToggle<CR>
" autofocus on tagbar open
let g:tagbar_autofocus = 1
"Disable EX mode
:map Q <Nop>
"Map F9 to build
:nnoremap <silent> <C-B> :make<CR>
:nnoremap <silent> <F9> :make<CR>
"Map F10 to test
:nnoremap <silent> <F10> :make test<CR>
"Map F11 to run
:nnoremap <silent> <F11> :make run<CR>
"Map F11 to nohl
:nnoremap <silent> <F12> :nohl<CR>
"Highlight column 80
:set colorcolumn=80
:highlight ColorColumn guibg=#073662
"wildignore
"python
:set wildignore+=*.pyc,*.pyo
"c/cpp
:set wildignore+=*.o,*.obj
"editors
:set wildignore+=*.swp,*~
"java
:set wildignore+=*.class
"VCS
:set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
"ctrlp
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files . -co --exclude-standard'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ }
\ }
"Less mode shortcut
:com! LESS :source /usr/share/vim/vim*/macros/less.vim*
"Beutify
" for go
:autocmd FileType go noremap <silent> <c-f> :Fmt<cr>
let g:gocode_gofmt_tabwidth =""
:noremap <c-g> :Ggrep
"airline
set laststatus=2
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#Syntastic#enabled = 1
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_theme = 'molokai'
"lvimrc
let g:localvimrc_sandbox = 0
let g:localvimrc_ask = 0
"vim-go
let g:go_auto_type_info = 1
set autowrite
"racer
let g:racer_cmd = "/home/saggi/projects/racer/target/racer"
let $RUST_SRC_PATH="/home/saggi/projects/rust/src/"