This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
223 lines (181 loc) · 5.08 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
set nocompatible
set backspace=indent,eol,start
set history=50
set ruler
set showcmd
set hidden
"line numbers
set number
"case insensitive unless pattern contains uppercase
set ignorecase
set smartcase
"suppress lack of ctags warning
if has('win32')
if !executable('ctags.exe')
let loaded_taglist = 'yes'
endif
endif
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
"Use console dialogs instead of popup for simple choices
set guioptions+=c
"Remove toolbars, tearoffs and tabs
set guioptions-=t
set guioptions-=T
set guioptions-=e
set incsearch
set hlsearch
if has('mouse')
set mouse=a
endif
syntax on
set foldmethod=syntax
let g:xml_syntax_folding=1
filetype plugin indent on
set autoindent
autocmd FileType java setlocal omnifunc=javacomplete#Complete
let g:java_classpath='H:\classpath\wm-isserver.jar;H:\classpath\wm-isclient.jar'
"Autocomplete popup behavior
set completeopt+=longest
set completeopt+=menuone
"Styles, fonts and colourschemes
colorscheme desertmod
if has('win32')
"Start maximized
au GUIEnter * simalt ~x
if hostname() == 'VDI-R004'
set gfn=Lucida_Console:h9:cANSI
else
set gfn=Consolas:h9:cANSI
endif
elseif has('unix')
set gfn=Liberation\ Mono\ 9
endif
set list
if has('win32')
set encoding=utf8
set listchars=tab:›\ ,eol:¬
endif
if has('unix')
set listchars=tab:▸\ ,eol:¬
endif
set ts=4 sw=4 sts=4 et
"XPath plugin setting
if !has('python')
let g:loaded_xpath = 1
endif
if has('win32')
set diffexpr=MyDiff()
function! MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
set backupdir=h:\documents\temp\vim
command! Xv echo system('xmllint.bat' . expand('%'))
command! -nargs=1 Xp call Cmd_Shell("xmllint --xpath \"", <q-args>, "\"", expand("%"))
endif
" 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
"""""""""""""""
"Plugin config
"""""""""""""""
"Set netrw to tree style
let g:netrw_liststyle=3
"SQL autocomplete settings
let g:omni_sql_ignorecase = 1
let g:omni_sql_include_owner = 0
"Autodelete hidden fugitive buffers
autocmd BufReadPost fugitive://* set bufhidden=delete
""""""""""""""""""
"Plugin functions
""""""""""""""""""
function! PythonCheckPylint()
let g:pyflakes_use_quickfix = 0
set makeprg=pylint\ --reports=n\ --output-format=parseable\ %:p
set errorformat=%f:%l:\ %m
make
cwindow
endfunction
function! PythonCheckPyflakes()
let g:pyflakes_use_quickfix = 1
PyflakesUpdate
cwindow
endfunction
""""""""""""""
"Key bindings
""""""""""""""
"Standard
"Maps change current directory to that of current file
map <leader>cd :cd %:p:h<CR>:pwd<CR>
"Maps space to clear search highlighting
nmap <SPACE> <SPACE>:noh<CR>
"Select an option with <CR>
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
"Close the menu with escape
inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
"Map C-space to use omnicomplete if available otherwise C-n behavior
inoremap <expr> <C-space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o>"
"Map <C-l> to close and re-open the completion window. When
"completeopt 'longest' is on this causes the longest common text of all
"matches to be automatically inserted even after typing (although I imagine
"there must be a better way to do this which I've been unable to find)
inoremap <C-l> <C-R>=pumvisible() ? "\<lt>C-e>\<lt>C-n>" : "\<lt>C-l>"<CR>
"Indentation
nmap <C-h> <<
nmap <C-l> >>
vmap <C-h> <gv
vmap <C-l> >gv
"Move over wrapped lines
nmap <C-j> gj
nmap <C-k> gk
"Plugins
"NERDCommenter
vnoremap <C-k> :call NERDComment(1, "toggle")<CR>
"netrw
noremap <F2> :NERDTreeToggle<CR>
noremap <C-F2> :FufDir<CR>
noremap <F3> :FufBuffer<CR>
noremap <F4> :FufFile<CR>
noremap <C-F4> :FufFileWithCurrentBufferDir<CR>
"taglist
noremap <F5> :TlistAddFilesRecursive .<CR>:TlistToggle<CR>
"gundo
noremap <F6> :GundoToggle<CR>
noremap <F7> :call PythonCheckPyflakes()<CR>
noremap <F8> :call PythonCheckPylint()<CR><CR>
"db-exec
if has('win32')
source H:\_sql_connections
inoremap <F9> <ESC>:normal vap<CR>:DBExecVisualSQL<CR><CR>
noremap <F9> :normal vap<CR>:DBExecVisualSQL<CR><CR>
noremap <F10> :DBPromptForBufferParameters<CR><BS>
endif
noremap <F11> :XPathSearchPrompt<CR>
autocmd FileType ruby setlocal sw=2 ts=2 sts=2
autocmd FileType coffee setlocal sw=2 ts=2 sts=2