-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc.cyg
362 lines (303 loc) · 10.6 KB
/
_vimrc.cyg
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
356
357
358
359
360
361
362
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
" if has('vim_starting')
" set nocompatible
" set runtimepath="C:\win scripts\vimfiles\bundle\neobundle.vim"
" " ,$VIM,$VIMRUNTIME
" " set runtimepath+=./vimfiles/bundle/neobundle.vim/
" endif
" set runtimepath+='./vimfiles/bundle/neobundle.vim'
set runtimepath+="C:\win scripts\vimfiles\bundle\neobundle.vim"
call neobundle#rc(expand('./vimfiles/bundle/'))
" Let NeoBundle manage itself
NeoBundleFetch 'Shougo/neobundle.vim'
" Recommended to install
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
"" Pure viml, no special dependencies
NeoBundle 'vim-scripts/sensible.vim'
NeoBundle 'vim-scripts/Align'
NeoBundle 'ervandew/supertab'
"NeoBundle 'vim-scripts/Solarized'
"NeoBundle 'vim-scripts/YankRing.vim'
NeoBundle 'vim-scripts/c.vim'
NeoBundle 'vim-scripts/tComment'
" NeoBundle 'vim-scripts/The-NERD-Commenter'
NeoBundle 'scrooloose/syntastic'
"vim-snipmate?
"
"" Plug-ins with dependencies
NeoBundle 'vim-scripts/taglist.vim' " req: ctags
NeoBundle 'Shougo/unite.vim' " req: vimproc
"" Linux installation
"NeoBundle 'Valloric/YouCompleteMe' " req: jedi,clang
"" Cygwin installation
"NeoBundle 'vim-scripts/Python-mode-klen'
NeoBundle 'vim-scripts/OmniCppComplete' "req: ctags
"NeoBundle 'vim-scripts/clang-complete' "req: clang
NeoBundle 'davidhalter/jedi-vim' "req: jedi py package
"NeoBundle 'vim-scripts/Pydiction'
" Note: You don't set neobundle setting in .gvimrc!
" 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 " Required!
" Brief help
" :NeoBundleList - list configured bundles
" :NeoBundleInstall(!) - install(update) bundles
" :NeoBundleClean(!) - confirm(or auto-approve) removal of unused bundles
" Installation check.
NeoBundleCheck
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
"python << EOF
"# Insert python here
"EOF
"/*****VIM custom settings****/
"
" vim-sensible.vim now handles a number of settings(plug-in)
" (the relevant settings are prefixed by '"#')
"
"#" allow backspacing over everything in insert mode
"#set backspace=indent,eol,start
set mouse-=a " disable mouse usage (all modes)
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
"#set ruler " show the cursor position all the time
"#set showcmd " display incomplete commands
"#set incsearch " do incremental searching
"number
" Turnoff highlighting previous search term
"set nohlsearch
"highlight NonText "#4a4a59
"highlight SpecialKey "#4a4a59
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"#set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
"#set history=200 " keep 50 lines of command line history
"#set scrolloff
"#set listchars
" always use 4 spaces for a tab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" show tab and spacing characters
"#set listchars=tab:▸\ ,eol:¬
""set list
" stops the cscope tags (cstag) from overriding ctags
set nocst
"/********/
" use pathogen for installing plug-ins from bundle directory
""call pathogen#infect()
syntax on
"" autocmd FileType * set formatoptions=tcql
"" \ nocindent comments&
"" autocmd FileType java,c,h,cpp set formatoptions=croql
"" \ cindent comments=sr:/*,mb:*,ex:*/,://
" 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).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
"" autocmd BufReadPost *
"" \ if line("'\"") > 1 && line("'\"") <= line("$") |
"" \ exe "normal! g`\"" |
"" \ endif
""
"" autocmd FileType * set textwidth=99
"" autocmd FileType c,cpp,h,python set textwidth=79
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
ab #d #define
ab #i #include
ab #b /****************************************
ab #e <Space>****************************************/
ab #l /*-------------------------------------------- */
" don't forget can use macros within alias declarations, can send ^M as
" \new-line character, ^ [ as carriage return??
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
"if has("cscope") && filereadable("/usr/bin/csco
" set csprg=/usr/bin/cscope
"# set csto=0
"# set cst
"# set nocsverb
"# " add any database in current directory
"# if filereadable("cscope.out")
"# cs add cscope.out
"# " else add database pointed to by environment
"# elseif $CSCOPE_DB != ""
"# cs add $CSCOPE_DB
"# endif
"# set csverb
"#endif
if &term=="xterm"
set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif
" " Ctags auto updates
" function! UPDATE_TAGS()
" let _f_ = expand("%:p")
" let _cmd_ = '"ctags -a -f /dvr/tags --c++-kinds=+p --fields=+iaS --extra=+q " ' . '"' . _f_ . '"'
" let _resp = system(_cmd_)
" unlet _cmd_
" unlet _f_
" unlet _resp
" endfunction
"map <F5> :UPDATE_TAGS()<CR>
" automatically update the tags in selected file extensions
"" autocmd BufWritePost *.java, *.cpp,*.h,*.c,*.py call UPDATE_TAGS()
"/*****VIM Key mappings for plug-ins and customisations*****/
"
" 11-12: many have been removed due to using python mode plug-in defaults
" Taglist
let Tlist_GainFocus_On_ToggleOpen = 1
map <c-G> :TlistToggle<CR>
map <a-V> :TlistSessionSave vim_session<CR>
map <a-L> :TlistSessionLoad vim_session<CR>
" omnicomplete
" automatically open and close the popup menu / preview window
"au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
"set completeopt=menuone,menu,longest,preview
" Not sure if this is still necessary with python mode
"map <c-G> :TaskList<CR>
" yankring plug-in mappings
"nnoremap <silent> <F11> :YRShow<CR>
" defaults: c-p = previous in YR
"
" python Mode related key bindings
"""let g:pymode_rope_guess_project = 0
""let g:pymode_rope enabled
" C-space = auto complete
" C-c g = go to definition
" C-c d = show documentation
" C-c f = show occurrences
""let g:pymode_run enabled
"let g:pymode_run_key = <leader>'r'
" Key for show python documentation
""let g:pymode_doc enabled
"let g:pymode_doc_key = 'K'
" Skip annoying error for libraries without information
"""let g:pymode_lint_ignore = "W*"
"""let g:pymode_lint_ignore = "E*"
" Key for set/unset breakpoint
"" not currently using this, could map to something else is needed
""let g:pymode_breakpoint_key = '<s-b>' 'leader>b'
" default: ctrl-space is short for rope auto complete
" toggle fold (single open, all open, all close respectively)
" <space> already toggle single fold
"inoremap f <C-O>za
"nnoremap f za
"onoremap f <C-C>za
"vnoremap f zf
"inoremap F <C-O>zR
"nnoremap F zR
"onoremap F <C-C>zR
"vnoremap F zf
"inoremap <s-F> <C-O>zM
"nnoremap <s-F> zM
"onoremap <s-F> <C-C>zM
"vnoremap <s-F> zf
"map f za
map <c-F> zR
map <s-F> zM
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" unite
let g:unite_source_history_yank_enable = 1
call unite#filters#matcher_default#use(['matcher_fuzzy'])
nnoremap <leader>t :<C-u>Unite -default-action=open -buffer-name=files -start-insert file_rec/async:!<cr>
nnoremap <leader>f :<C-u>Unite -default-action=open -buffer-name=files -start-insert file<cr>
nnoremap <leader>m :<C-u>Unite -default-action=open -buffer-name=mru -start-insert file_mru<cr>
nnoremap <leader>o :<C-u>Unite -default-action=open -buffer-name=outline -start-insert outline<cr>
nnoremap <leader>y :<C-u>Unite -default-action=open -buffer-name=yank history/yank<cr>
nnoremap <leader>e :<C-u>Unite -default-action=open -buffer-name=buffer buffer<cr>
"
" Custom mappings for the unite buffer
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
" Play nice with supertab
let b:SuperTabDisabled=1
" Enable navigation with control-j and control-k in insert mode
imap <buffer> <C-j> <Plug>(unite_select_next_line)
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
endfunction
" autopep8 corrections
"" useful for autopep8 corrections within vim
"" tells vim not to automatically reload changed files
set noautoread
" sets up mappings to function
function! DiffWithSaved()
let filetype=&ft
diffthis
vnew | r # | normal! 1Gdd
diffthis
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
endfunction
com! DiffSaved call DiffWithSaved()
"map <Leader>ds :DiffSaved<CR>
" Once you run that, you can use the vim copy-diff and other diff commands to quickly go
" through and accept/not accept changes. Plus, all will be stored in undo history.
"
" " run these commands after sourcing the above function
"
" " % expands to filename (also %:h to head, %:t to tail)
" " if it throws an error, just do :cd %:h first
"
" :!autopep8 --in-place %
" :DiffSaved
" use :%diffpu to push all changes in scratch buffer to file
" This needs to be improved
"Press downset tags=/home/tan/tags,./tags
set tags+=tags ";~/tags
"~/src/scratch/tags
"set tags+=tags;/
" Don't use Ex mode, use Q for formatting
"map Q gq
" Replace with Harvard Prof fine's:
map Q 0ma}b:'a,.j<CR>070 ? *<Esc>dwi<CR><Esc>
"let g:pydiction_location = '~/.vim/bundles/pydiction/complete-dict'
highlight Comment ctermfg=lightgrey
" turn on line numbers:
set nonumber
"set relativenumber
set number
set undofile
" mswin maximise Windows on initial gui open
autocmd GUIEnter * simalt ~X