-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path__vimrc
307 lines (229 loc) · 9.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
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
set ruler
set nu
syntax on
set showmatch
set background=light
highlight Comment ctermfg=darkcyan
highlight Search term=reverse ctermbg=4 ctermfg=7
highlight Normal ctermbg=black ctermfg=white
set hls
set encoding=utf8
let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936
set ic
set foldmethod=marker
set tags=/var/www/baby/tags
let loaded_matchparen = 1
""Auto complete
filetype plugin indent on
"This setting make searchcomplete malfunction, so turn off first
""set paste
""let Tlist_Auto_Open = 1
"
"let Tlist_Use_Right_Window = 1
"
""close TagList when exit
"let Tlist_xEit_OnlyWindow = 1
"let Tlist_Ctags_Cmd = '/usr/bin/exuberant-ctags'
let Tlist_Show_One_File = 1
"
"let g:closetag_html_style=1
"
"nnoremap <silent> <F8> :Tlist<CR>
"nnoremap <silent> <F9> :tabp<CR>
"nnoremap <silent> <F10> :tabn<CR>
"nnoremap <silent> <Left> :tabp<CR>
"nnoremap <silent> <Right> :tabn<CR>
"nnoremap <silent> \ :Tlist<CR>
"nnoremap <silent> [ :tabp<CR>
"nnoremap <silent> ] :tabn<CR>
"map ee :tabe
"inoremap <Tab> <C-R>=InsertTabWrapper()<CR>
nmap <Space> <Pagedown>
vmap <BS> x
set makeprg=php\ -l\ %
set errorformat=%m\ in\ %f\ on\ line\ %l
""""""""""""""""""""""""""""""
" BufExplorer
"""""""""""""""""""""""""""""""
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitVertical=1 " Split vertically.
let g:bufExplorerSplitVertSize = 30 " Split width
let g:bufExplorerUseCurrentWindow=1 " Open in new window.
autocmd BufWinEnter \[Buf\ List\] setl nonumber
set bg=dark
syntax on
set title
set nocompatible
" php helpfuls
" let php_sql_query = 1
let php_baselib = 1
let php_htmlInStrings = 1
let php_noShortTags = 1
let php_parent_error_close = 1
let php_parent_error_open = 1
let php_folding = 0
" some common helpful settings
set shiftwidth=2
"do an incremental search
set incsearch
" Correct indentation after opening a phpdocblock and automatic * on every line
set formatoptions=qroct
" Wrap visual selectiosn with chars
:vnoremap ( "zdi^V(<C-R>z)<ESC>
:vnoremap { "zdi^V{<C-R>z}<ESC>
:vnoremap [ "zdi^V[<C-R>z]<ESC>
:vnoremap ' "zdi'<C-R>z'<ESC>
:vnoremap " "zdi^V"<C-R>z^V"<ESC>
" Detect filetypes
"if exists("did_load_filetypes")
" finish
"endif
augroup filetypedetect
au! BufRead,BufNewFile *.pp setfiletype puppet
au! BufRead,BufNewFile *httpd*.conf setfiletype apache
au! BufRead,BufNewFile *inc setfiletype php
augroup END
" Nick wrote: Uncomment these lines to do syntax checking when you save
augroup Programming
" clear auto commands for this group
autocmd!
autocmd BufWritePost *.php !php -d display_errors=on -l <afile>
autocmd BufWritePost *.inc !php -d display_errors=on -l <afile>
autocmd BufWritePost *httpd*.conf !/etc/rc.d/init.d/httpd configtest
autocmd BufWritePost *.bash !bash -n <afile>
autocmd BufWritePost *.sh !bash -n <afile>
autocmd BufWritePost *.pl !perl -c <afile>
autocmd BufWritePost *.perl !perl -c <afile>
autocmd BufWritePost *.xml !xmllint --noout <afile>
autocmd BufWritePost *.xsl !xmllint --noout <afile>
autocmd BufWritePost *.js !~/bin/jsl -conf ~/jslint/jsl.default.conf -nologo -nosummary -process <afile>
"autocmd BufWritePost *.js !~/bin/jsl -nologo -nosummary -process <afile>
autocmd BufWritePost *.rb !ruby -c <afile>
autocmd BufWritePost *.pp !puppet --parseonly <afile>
augroup en
" enable filetype detection:
filetype on
" make searches case-insensitive, unless they contain upper-case letters:
set ignorecase
set smartcase
" my common spelling mistakes ;)
abbreviate wierd weird
abbreviate restaraunt restaurant
"set ls=2 " allways show status line
"set ruler " show the cursor position all the time
"au BufNewFile,BufRead *.pls set syntax=dosini
if &term == "xterm-color"
fixdel
endif
" Enable folding by fold markers
" this causes vi problems set foldmethod=marker
" Correct indentation after opening a phpdocblock and automatic * on every
" line
set formatoptions=qroct
" The completion dictionary is provided by Rasmus:
" http://lerdorf.com/funclist.txt
set dictionary-=~/phpfunclist.txt dictionary+=~/phpfunclist.txt
" Use the dictionary completion
set complete-=k complete+=k
" {{{ Autocompletion using the TAB key
" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" }}} Autocompletion using the TAB key
" {{{ Mappings for autogeneration of PHP code
" There are 2 versions available of the code templates, one for the case, that
" the close character mapping is disabled and one for the case it is enabled.
" {{{ With close char mapping activated (currently active)
" require, require_once
map! =req /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>require '<RIGHT>;<LEFT><Left>
map! =roq /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>require_once '<RIGHT>;<LEFT><Left>
" include, include_once
map! =inc /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>include '<RIGHT>;<Left><Left>
map! =ioc /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>include_once '<Right>;<Left><Left>
" define
map! =def /**<CR> * <CR>* <CR>* <CR>* @since <CR>* @access public<CR>*/<CR><LEFT>define ('<Right>, '<Right><Right>;<ESC>?',<CR>i
" class
map! =cla /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>class {<CR><ESC>?/\*\*<CR>/ \* <CR>$i
" public/private methods
map! =puf /**<CR> * <CR>* <CR>* <CR>* @since <CR>* @access public<CR>* @param <CR>* @return void<CR>*/<CR><LEFT>public function (<Right><CR>{<CR><ESC>?/\*\*<CR>/ \* <CR>$i
map! =prf /**<CR> * <CR>* <CR>* <CR>* @since <CR>* @access private<CR>* @param <CR>* @return void<CR>*/<CR><LEFT>private function _ (<Right><CR>{<CR><ESC>?/\*\*<CR>/ \* <CR>$i
" public/private attributes
map! =pua /**<CR> * <CR>* <CR>* @var <CR>* @since <CR>*/<CR><LEFT>public $ = ;<ESC>?/\*\*<CR>/ \* <CR>$i
map! =pra /**<CR> * <CR>* <CR>* @var <CR>* @since <CR>*/<CR><LEFT>private $_ = ;<ESC>?/\*\*<CR>/ \* <CR>$i
" for loop
map! =for for ($i = 0; $i ; $i++<Right> {<Up><Up><ESC>/ ;<CR>i
" foreach loop
map! =foe foreach ($ as $ => $<Right> {<Up><xHome><ESC>/\ as<CR>i
" while loop
map! =whi while ( <Right> {<Up><Up><ESC>/ )<CR>i
" switch statement
map! =swi switch ($<Right> {<CR>case '<Right>:<CR><CR>break;<CR>default:<CR><CR>break;<Up><Up><Up><Up><Up><Up><Up><xHome><ESC>/)<CR>i
" alternative
map! =if if (<Right> {<Down><xEnd> else {<Up><Up><Up><Up><Up><Up><ESC>/)<CR>i
" }}} With close char mapping activated (currently active)
" {{{ With close char mapping de-activated (currently in-active)
" require, require_once
"map! =req /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>require '';<ESC>hi
"map! =roq /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>require_once '';<ESC>hi
" include, include_once
"map! =inc /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>include '';<ESC>hi
"map! =ioc /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>include_once '';<ESC>hi
" define
"map! =def /**<CR> * <CR>* <CR>* <CR>* @since <CR>* @access public<CR>*/<CR><LEFT>define ('', '');<ESC>?',<CR>i
" class
"map! =cla /**<CR> * <CR>* <CR>* <CR>* @since <CR>*/<CR><LEFT>class {<CR><CR>}<CR><ESC>?/\*\*<CR>/ \* <CR>$i
" public/private methods
"map! =puf /**<CR> * <CR>* <CR>* <CR>* @since <CR>* @access public<CR>* @param <CR>* @return void<CR>*/<CR><LEFT>public function ()<CR>{<CR><CR>}<CR><ESC>?/\*\*<CR>/ \* <CR>$i
"map! =prf /**<CR> * <CR>* <CR>* <CR>* @since <CR>* @access private<CR>* @param <CR>* @return void<CR>*/<CR><LEFT>private function _ ()<CR>{<CR><CR>}<CR><ESC>?/\*\*<CR>/ \* <CR>$i
" public/private attributes
"map! =pua /**<CR> * <CR>* <CR>* @var <CR>* @since <CR>*/<CR><LEFT>public $ = ;<ESC>?/\*\*<CR>/ \* <CR>$i
"map! =pra /**<CR> * <CR>* <CR>* @var <CR>* @since <CR>*/<CR><LEFT>private $_ = ;<ESC>?/\*\*<CR>/ \* <CR>$i
" for loop
"map! =for for ($i = 0; $i ; $i++) {<CR><CR>}<Up><Up><ESC>/ ;<CR>i
" foreach loop
"map! =foe foreach ($ as $ => $) {<CR><CR>}<Up>
" while loop
"map! =whi while ( ) {<CR><CR>}<Up><Up><ESC>/ )<CR>i
" switch statement
"map! =swi switch ($) {<CR>case '':<CR><CR>break;<CR>default:<CR><CR>break;<CR>}<Up><Up><Up><Up><Up><Up><Up><ESC>/)<CR>i
" alternative
"map! =if if () {<CR><CR>} else {<CR><CR>}<Up><Up><Up><Up><Up><Up><ESC>/)<CR>i
" }}} With close char mapping de-activated (currently in-active)
" }}} Mappings for autogeneration of PHP code
" Make VIM remember position in file after reopen
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" 记录文件光标位置
augroup resCur
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END
set expandtab
set ts=4
set sta
set ignorecase
set shiftwidth=4
set softtabstop=4
set tabstop=4
set fdm=marker
fun! MySys()
return "$1"
endfun
set runtimepath=~/.vim_runtime,~/.vim_runtime/after,\$VIMRUNTIME
source ~/.vim_runtime/vimrc
helptags ~/.vim_runtime/doc
set noautoread