-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
148 lines (121 loc) · 3.45 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
" Show the cursor position info
set ruler
" Hightlight the syntax
syntax on
" Insert space characters when the tab key pressed
set expandtab
" Set the number of space characters inserted when the tab key pressed
set tabstop=4
" Set the number of space characters inserted for indentation
set shiftwidth=4
" To change all the existing tab characters corresponding the current settings
" retab
"""""""""""""""""""""""""""""""""""""""""""""
" TODO The following setings are not checked!
"""""""""""""""""""""""""""""""""""""""""""""
"显示行尾的空格
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/
set foldmethod=marker
"let g:winManagerWindowLayout='TagList|FileExplorer'
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let g:Tlist_Use_Right_Window=1
syntax enable
filetype plugin indent on
set completeopt=longest,menu
set shiftwidth=4
set mouse=i
set nu
"smartcase,这样搜索时默认不区分大小写,只有搜索关键字中出现一个大字母时才区分大小写
set ignorecase smartcase
set autowrite
" 删除所有行未尾空格
nmap <F12> :%s/[ \t\r]\+$//g<CR>
"把tab 替换为空格
nmap <F9> :%s/\t/ /g<CR>
"光标在窗口上下边界时距离边界7行即开始滚屏
set so=7
"setlocal omnifunc=javacomplete#Complete
if has("autocmd")
"autocmd Filetype java setlocal omnifunc=javacomplete#Complete
autocmd Filetype java set omnifunc=javacomplete#Complete
"Set 'completefunc' option to show parameters information IF YOU LIKE. e.g.
"setlocal completefunc=javacomplete#CompleteParamsInfo
endif
inoremap <buffer> <C-X><C-U> <C-X><C-U><C-P>
inoremap <buffer> <C-S-Space> <C-X><C-U><C-P>
let g:SuperTabRetainCompletionType=2
let g:SuperTabDefaultCompletionType="<C-X><C-O>"
nmap <C-1> :only<CR>
nmap <F2> :close<CR>
nmap <F4> :WMToggle<CR>
nmap <F5> :Tlist<CR>
let g:miniBufExplMapCTabSwitchBufs = 1
nnoremap <silent> <F3> :Grep<CR>
nmap ,v "+p
vmap ,c "+yy
nmap ,c "+yy
"Move one line up and down
map <A-UP> yyddkkp
map <A-DOWN> yyddp
nmap <A-UP> yyddkkp
nmap <A-DOWN> yyddp
imap <A-UP> <ESC>yyddkkpi
imap <A-DOWN> <ESC>yyddpi
"Copy one line up/down to the original line
map <C-UP> yykp
map <C-DOWN> yyp
nmap <C-UP> yykp
nmap <C-DOWN> yyp
imap <C-UP> <ESC>yykpi
imap <C-DOWN> <ESC>yypi
"Delete current line
nmap <C-D> dd
imap <C-D> <ESC>ddi
map <C-D> dd
"Exit
nmap <C-E> :qa<CR>
imap <C-E> :qa<CR>
map <C-E> :qa<CR>
"Save Exit
nmap <C-W> :wqa<CR>
imap <C-W> :wqa<CR>
map <C-W> :wqa<CR>
"括号补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
"cs add cscope.out
endif
set csverb
endif
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>