-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
328 lines (275 loc) · 8.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
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
set t_Co=256
set term=xterm-256color
"set t_ti= t_te=
set bg=dark
set visualbell
set nobackup
set nowb
set dir=~/tmp/vim
set bs=2
set nowrap
set ruler
set showcmd
set smartindent
set cindent
set ai
set ignorecase
set noet
set sw=4
set ts=4
set softtabstop=4
set ffs=unix,dos
set hidden
set tag=tags
set noignorecase
set modeline
set pastetoggle=<F12>
set fen
set termencoding=utf-8
"set number
filetype plugin indent on
color kalmi
syn on
map , <leader>
let g:NERDShutUp = 1
let g:NERDMapleader = '\'
let g:NERDCreateDefaultMappings = 0
nmap <leader>nc <plug>NERDCommenterComment
vmap <leader>nc <plug>NERDCommenterComment
nmap <leader>n<space> <plug>NERDCommenterToggle
vmap <leader>n<space> <plug>NERDCommenterToggle
nmap <leader>nm <plug>NERDCommenterMinimal
vmap <leader>nm <plug>NERDCommenterMinimal
nmap <leader>ns <plug>NERDCommenterSexy
vmap <leader>ns <plug>NERDCommenterSexy
nmap <leader>ni <plug>NERDCommenterInvert
vmap <leader>ni <plug>NERDCommenterInvert
nmap <leader>ny <plug>NERDCommenterYank
vmap <leader>ny <plug>NERDCommenterYank
nmap <leader>nl <plug>NERDCommenterAlignLeft
vmap <leader>nl <plug>NERDCommenterAlignLeft
nmap <leader>nb <plug>NERDCommenterAlignBoth
vmap <leader>nb <plug>NERDCommenterAlignBoth
nmap <leader>nn <plug>NERDCommenterNest
vmap <leader>nn <plug>NERDCommenterNest
nmap <leader>nu <plug>NERDCommenterUncomment
vmap <leader>nu <plug>NERDCommenterUncomment
nmap <leader>n$ <plug>NERDCommenterToEOL
vmap <leader>n$ <plug>NERDCommenterToEOL
nmap <leader>nA <plug>NERDCommenterAppend
vmap <leader>nA <plug>NERDCommenterAppend
au BufNewFile,BufRead /tmp/sql* setf sql
au BufNewFile,BufRead *.phtml setf php
au BufNewFile,BufRead *.json setf json
let g:user_zen_leader_key = '<C-z>'
let g:use_zen_complete_tag = 1
set complete=.,w,b
"au FileType * if filereadable($VIMRUNTIME.'/syntax/'.&filetype.'.vim') | exe('setl dict+='.$VIMRUNTIME.'/syntax/'.&filetype.'.vim') | endif
map <silent><F5> :BufExplorer<CR>
imap <silent><F5> <ESC>:BufExplorer<CR>
map SS :update<CR>
map S :update<CR>
map <F6> :NERDTreeToggle<CR>
map <M-PageDown> gt
map <M-PageUp> gT
map <C-w>t :tabnew<cr>
imap <C-w>t <ESC>:tabnew<cr>
imap <silent><M-PageDown> <ESC>gta
imap <silent><M-PageUp> <ESC>gTa
map <C-e>w :call SwitchWrap()<CR>
map <Space> <PageDown>
function! SwitchWrap()
if &wrap == 1
setl nowrap
else
setl wrap
endif
endfunction
let g:sandbox_use_vcscommand = 1
let g:sandbox_look_for_updates = 1
nnoremap <silent> <F7> :TlistToggle<CR>
inoremap <silent> <F7> <ESC>:TlistToggle<CR>
let Tlist_Use_Right_Window = 1
" Command Make will call make and then cwindow which
" opens a 3 line error window if any errors are found.
" " if no errors, it closes any open cwindow.
:command! -nargs=* Make make <args> | cwindow 3
map <silent><F8> :silent Make %<CR>
imap <silent><F8> <ESC>:silent Make %<CR>
map <F9> :!bash<CR>
" Browser settings
nnoremap <silent> go :exe("!screen w3m \"".expand("<cfile>")."\"")<CR>
" dbext
let g:dbext_default_login_script_dir = '~/.vim/plugin/dbext/'
" screen settings
"if has("terminfo")
" if &term =~ "screen"
" set <C-PageDown>=^[[6;5~
" set <C-PageUp>=^[[5;5~
" endif
"endif
autocmd FileType text setlocal textwidth=78
" 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).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
if has("statusline")
set statusline=%F\ %m%r%=[%-{&fenc}]\ [%{&ff}]\ [%Y]\ [%06l,%03v][%03p%%]
set laststatus=2
endif
function! GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Add '+' if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label = '+'
break
endif
endfor
" Append the number of windows in the tab page if more than one
let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1
let label .= wincount
endif
if label != ''
let label .= ' '
endif
" Append the buffer name
return label . expand("%:t")
"return label . expand(bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]).":p")
endfunction
set stal=2
set tabline=%!MyTabLine()
function! MyTabLine()
let s = ''
for i in range(tabpagenr('$'))
" select the highlighting
if i + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s .= '%' . (i + 1) . 'T'
" the label is made by MyTabLabel()
"let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
let s .= ' %{BradLabel(' . (i + 1) . ')} '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s .= '%=%#TabLine#%999Xclose'
endif
return s
endfunction
function! BradLabel(n)
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
let bufnam = bufname(buflist[winnr - 1])
" This is getting the basename() of bufname above
let base = substitute(bufnam, '.*/', '', '')
let name = a:n . ' ' . base
return name
endfunction
function! MyTabLabel(n)
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
return bufname(buflist[winnr - 1])
endfunction
" Use the above tabe naming scheme
set tabline=%!MyTabLine()
function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=1
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction
"au FileType javascript call JavaScriptFold()
"au FileType javascript setl fen
set statusline+=%{SyntasticStatuslineFlag()}
let twitvim_count = 50
"-------------------------------------
"# File/Window/Buffer Managment Keys #
"-------------------------------------
" quick file browse mapping
map <Leader>r :e %:p:h<CR>
map <Leader>R :lcd %:p:h<CR>
map <Leader>N :new %:p:h<CR>
" Give tab cycling nicer keys (normally these just do same as j & k)
noremap <C-n> :tabnext<CR>
noremap <C-p> :tabNext<CR>
"noremap <Tab> :tabnext<CR>
"noremap <S-Tab> :tabprev<CR>
noremap <Left> :tabprev<CR>
noremap <Right> :tabnext<CR>
"noremap <Up> :bp<CR>
"noremap <Down> :bn<CR>
"for i in range(1,9)
" exec "map <M-" . i ."> " . i . "gt"
"endfor
" new tab
"nmap <Leader>t :tabe %:p:h<CR>
"nmap <Leader>T :tabe %:p:h<CR>
nmap <Leader>n :tabe %:p:h<CR>
" tab close
"map <Leader>w :tabclose<CR>
" close window
map <Leader>q :q<CR>
" quit vim
map <Leader>Q :qall!<CR>
" make F2 save
nmap <silent> <F2> <ESC>:w<CR>
imap <silent> <F2> <C-o>:w<CR>
let g:fuf_file_exclude = '\v\~$|\.(o|exe|dll|bak|orig|swp|class)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|^target/'
let g:fuf_coveragefile_exclude = '\v\~$|\.(o|exe|dll|bak|orig|swp|class|png|jpg|gif)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|^target/|^project/plugins/target/|^cache/|^webroot/assets/_archive/|base\.v\d/|base\.v\d\.static/'
nmap <Leader>b :FufBuffer<CR>
nmap <Leader>. :FufCoverageFile<CR>
nmap <F3> :FufBuffer<CR>
nmap <F4> :FufTag<CR>
nmap <F5> :FufFileWithCurrentBufferDir<CR>
let g:CommandTMaxFiles=20000
let g:CommandTMaxDepth=30
set wildignore+=.git,php/hires/public/assets/index.hu/import,web/index.hu/assets/import,php/lib/Nemo/Config/*
nmap <Leader>yr :CommandT<CR>
nmap <Leader>yp :CommandT php/hires/public<CR>
nmap <Leader>ym :CommandT php/hires/mobile<CR>
nmap <Leader>ya :CommandT php/hires/admin<CR>
"
let g:snipplr_rb='~/bin/snipplr.rb'
let g:snips_author = 'Zoltan Kalmar'
function! TimestampToDate()
echo strftime("%Y-%m-%d %H:%M:%S", expand('<cword>'))
endfunction
if filereadable($HOME . "/.vimrc_local")
source ~/.vimrc_local
endif
let twitvim_browser_cmd = 'open'
" fix misspelled return
abbr retrun return
" Tabular.vim
noremap <LocalLeader>a= :Tab /=<CR>
noremap <LocalLeader>a> :Tab /=><CR>
noremap <LocalLeader>a: :Tab /:<CR>
" fugitive settings
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd User fugitive
\ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
\ nnoremap <buffer> .. :edit %:h<CR> |
\ endif
let g:notes_directory = '~/Dropbox/Notes'
let g:Grep_Find_Use_Xargs = 0
" Ganja settings
if getcwd() =~ '^/www/ganja'
set tags=~/tags
set noet
set sw=4
endif