Skip to content

Commit 95e853d

Browse files
committedNov 2, 2015
[common] Init porting to github.
Signed-off-by: atline <atline@aliyun.com>
0 parents  commit 95e853d

File tree

4 files changed

+256
-0
lines changed

4 files changed

+256
-0
lines changed
 

‎_vimrc

+241
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
" General
2+
if has('win32')
3+
set nocompatible
4+
source $VIMRUNTIME/vimrc_example.vim
5+
source $VIMRUNTIME/mswin.vim
6+
behave mswin
7+
8+
set diffexpr=MyDiff()
9+
function MyDiff()
10+
let opt = '-a --binary '
11+
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
12+
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
13+
let arg1 = v:fname_in
14+
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
15+
let arg2 = v:fname_new
16+
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
17+
let arg3 = v:fname_out
18+
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
19+
let eq = ''
20+
if $VIMRUNTIME =~ ' '
21+
if &sh =~ '\<cmd'
22+
let cmd = '""' . $VIMRUNTIME . '\diff"'
23+
let eq = '"'
24+
else
25+
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
26+
endif
27+
else
28+
let cmd = $VIMRUNTIME . '\diff'
29+
endif
30+
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
31+
endfunction
32+
endif
33+
34+
syntax enable
35+
syntax on
36+
37+
if !has('win32')
38+
colorscheme desert
39+
endif
40+
41+
set nocp
42+
set bs=2
43+
set ruler
44+
set nonu
45+
set ts=4 sw=4
46+
filetype plugin indent on
47+
set ai nosi ci
48+
set et sts=4
49+
set sta
50+
set ignorecase
51+
52+
"set helplang=cn
53+
set encoding=utf-8
54+
set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
55+
set termencoding=utf-8
56+
57+
" If internal messy code issue, may uncomment next
58+
if has('win32')
59+
source $VIMRUNTIME/delmenu.vim
60+
source $VIMRUNTIME/menu.vim
61+
language messages zh_CN.utf-8
62+
endif
63+
64+
set nobackup
65+
set history=50
66+
set hls
67+
set autowrite
68+
set vb t_vb=
69+
au GuiEnter * set t_vb=
70+
"set guioptions-=T
71+
72+
" Space at end
73+
highlight WhitespaceEOL ctermbg=red guibg=#00FFFF
74+
match WhitespaceEOL /\s\+$/
75+
nmap <F7> :%s/\s*$//g<CR> :nohl<CR>
76+
77+
" Enable vundle
78+
" git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
79+
filetype off
80+
if has('win32')
81+
set rtp+=$VIM/vimfiles/bundle/vundle/
82+
call vundle#rc('$VIM/vimfiles/bundle/')
83+
else
84+
set rtp+=~/.vim/bundle/vundle/
85+
call vundle#rc()
86+
endif
87+
88+
Bundle 'gmarik/vundle'
89+
Bundle 'The-NERD-tree'
90+
Bundle 'taglist.vim'
91+
Bundle 'ctrlp.vim'
92+
Bundle 'winmanager'
93+
Bundle 'javacomplete'
94+
Bundle 'Python-mode-klen'
95+
Bundle 'The-NERD-Commenter'
96+
Bundle 'fholgado/minibufexpl.vim'
97+
Bundle 'OmniCppComplete'
98+
Bundle 'davidhalter/jedi-vim'
99+
Bundle 'Visual-Mark'
100+
Bundle 'derekwyatt/vim-scala'
101+
filetype on
102+
103+
" Define leader key
104+
let mapleader=';'
105+
106+
" NerdTree
107+
map <Leader>n :NERDTreeMirror<CR>
108+
map <Leader>n :NERDTreeToggle<CR>
109+
let g:NERDTreeWinPos="left"
110+
let g:NERDTreeWinSize=30
111+
let g:NERDTreeShowLineNumbers=1
112+
113+
" TagList
114+
let Tlist_Show_One_File=1
115+
let Tlist_Exit_OnlyWindow=1
116+
let Tlist_Use_Right_Window=1
117+
nmap <Leader>t :Tlist<CR>
118+
119+
" MiniBufExplorer
120+
let g:miniBufExplMapCTabSwitchBufs=1
121+
let g:miniBufExplMapWindowNavVim=1 "different buffers change
122+
let g:miniBufExplMapWindowNavArrows=1
123+
let g:miniBufExplTabWrap=1 "make tabs show complete
124+
let g:miniBufExplModSelTarget=1
125+
126+
" NetRW/TagList with WinManager
127+
let g:winManagerWindowLayout='FileExplorer|TagList'
128+
let g:winManagerWidth=30
129+
let g:defaultExplorer=0
130+
nmap wm :WMToggle<CR>
131+
132+
" Cscope & ctags
133+
if has('cscope')
134+
"set csprg=/usr/bin/cscope
135+
set csto=1
136+
set cst
137+
138+
" Add any database in current directory
139+
set nocsverb
140+
if filereadable("cscope.out")
141+
cs add cscope.out
142+
endif
143+
set csverb
144+
145+
set cscopequickfix=c-,d-,e-,f-,g-,i-,s-,t-
146+
nmap ,s :cs find s <C-R>=expand("<cword>")<CR><CR>
147+
nmap ,g :cs find g <C-R>=expand("<cword>")<CR><CR>
148+
nmap ,c :cs find c <C-R>=expand("<cword>")<CR><CR>
149+
nmap ,t :cs find t <C-R>=expand("<cword>")<CR><CR>
150+
nmap ,e :cs find e <C-R>=expand("<cword>")<CR><CR>
151+
nmap ,f :cs find f <C-R>=expand("<cword>")<CR><CR>
152+
nmap ,i :cs find i <C-R>=expand("<cword>")<CR><CR>
153+
nmap ,d :cs find d <C-R>=expand("<cword>")<CR><CR>
154+
155+
if has('win32')
156+
nmap <F5> :silent !dir /s/b *.c,*.cpp,*.h,*.java > cscope.files<CR>
157+
\ :silent !cscope -Rbk<CR>
158+
\ :silent !ctags -R --c++-kinds=+px --fields=+iaS --extra=+q<CR>
159+
\ :cs reset<CR><CR>
160+
nmap <F6> :silent !dir /s/b *.c,*.cpp,*.h,*.java > cscope.files<CR>
161+
\ :silent !cscope -Rbk<CR>
162+
\ :cs reset<CR><CR>
163+
else
164+
nmap <F5> :!find . -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.java'>cscope.files<CR>
165+
\ :!cscope -Rbkq<CR>
166+
\ :!ctags -R --c++-kinds=+px --fields=+iaS --extra=+q<CR>
167+
\ :cs reset<CR><CR>
168+
nmap <F6> :!find . -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.java'>cscope.files<CR>
169+
\ :!cscope -Rbkq<CR>
170+
\ :cs reset<CR><CR>
171+
endif
172+
endif
173+
174+
" Omni
175+
set nocp
176+
filetype plugin indent on
177+
set completeopt=longest,menu
178+
179+
"autocmd FileType python set omnifunc=pythoncomplete#Complete " use jedi
180+
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
181+
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
182+
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
183+
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
184+
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
185+
autocmd FileType c set omnifunc=ccomplete#Complete
186+
autocmd FileType java set omnifunc=javacomplete#Complete
187+
188+
" Omni cpp
189+
let OmniCpp_GlobalScopeSearch=1
190+
let OmniCpp_NamespaceSearch=1
191+
let OmniCpp_DisplayMode=1
192+
let OmniCpp_ShowScopeInAbbr=0
193+
let OmniCpp_ShowPrototypeInAbbr=1
194+
let OmniCpp_ShowAccess=1
195+
let OmniCpp_MayCompleteDot=1
196+
let OmniCpp_MayCompleteArrow=1
197+
let OmniCpp_MayCompleteScope=1
198+
199+
" Easier moving of code blocks
200+
vnoremap < <gv
201+
vnoremap > >gv
202+
203+
" CtrlP
204+
let g:ctrlp_max_height=30
205+
set wildignore+=*.pyc
206+
set wildignore+=*.class
207+
nmap <Leader>f :CtrlP<CR>
208+
209+
" Python-mode
210+
let ropevim_enable_shortcuts=1
211+
let g:pymode_rope_goto_def_newwin="vnew"
212+
let g:pymode_rope_extended_complete=1
213+
let g:pymode_folding=0
214+
let g:pymode_options_colorcolumn=0
215+
let g:pymode_rope=0
216+
let g:pymode_lint=1
217+
let g:pymode_lint_checker="pyflakes,pep8,pep257"
218+
let g:pymode_lint_ignore="E265,E501,E302"
219+
let g:pymode_syntax=1
220+
let g:pymode_syntax_all=1
221+
let g:pymode_syntax_builtin_objs = 0
222+
let g:pymode_syntax_builtin_funcs = 0
223+
let g:pymode_syntax_indent_errors=g:pymode_syntax_all
224+
let g:pymode_syntax_space_errors=g:pymode_syntax_all
225+
autocmd FileType python setlocal nonumber " disable line number
226+
227+
" Jedi
228+
let g:jedi#completions_enabled=1
229+
let g:jedi#goto_command=",d"
230+
let g:jedi#goto_assignments_command=",g"
231+
let g:jedi#goto_definitions_command=""
232+
let g:jedi#documentation_command="K"
233+
let g:jedi#usages_command=",n"
234+
let g:jedi#completions_command="<C-Space>"
235+
let g:jedi#rename_command=",r"
236+
let g:jedi#popup_on_dot=1
237+
238+
" Color
239+
"highlight Pmenu ctermbg=darkred
240+
"highlight PmenuSel ctermbg=red ctermfg=yellow
241+
highlight PmenuSel ctermbg=gray

‎cscope.exe

463 KB
Binary file not shown.

‎ctags.exe

256 KB
Binary file not shown.

‎pluginfix.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
1. NERDTree:
2+
Issue:
3+
Messy code
4+
Fix:
5+
Just need to do next in linux, The-NERD-tree\plugin\NERD_tree.vim
6+
call s:initVariable("g:NERDTreeDirArrows", !s:running_windows)
7+
->
8+
call s:initVariable("g:NERDTreeDirArrows", s:running_windows)
9+
10+
2. visualmask:
11+
Issue:
12+
E197: Cannot set language to "en_US"
13+
Fix:
14+
Just need to do next in linux, Visual-Mark\plugin\visualmark.vim
15+
exec ":lan mes en_US" -> exec ":lan mes en_US.utf8"

0 commit comments

Comments
 (0)
Please sign in to comment.