-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvimrc.minimal
More file actions
255 lines (220 loc) · 9.28 KB
/
vimrc.minimal
File metadata and controls
255 lines (220 loc) · 9.28 KB
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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" LOAD EXTERNALS.................load external resources, start package manager
" VIM SETTINGS..................................vim built in setting overwrites
" PLUGIN SETTINGS.....................................plugin setting overwrites
" ENV SPECIFIC SETTINGS............settings that are specific to an environment
" FILE TYPE SETTINGS......................file type specific setting overwrites
" MAPPINGS..................................................custom key mappings
" COMMANDS......................................................custom commands
" COLORSCHEME..................................colorscheme and color overwrites
" SYNTAX...........................syntax (keyword) rebinding and configuration
" FUNCTIONS....................................................custom functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" $LOAD EXTERNALS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved
filetype off " required!
filetype plugin indent on " required!
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" $VIM SETTINGS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
scriptencoding utf-8
set hidden " best. thing. ever. no buffer closed
set antialias
set hlsearch " highlight all matches
set ignorecase " case insensitive searches
set incsearch " highlight matches while typing
set ls=2
set nowrap " Don't wrap lines
set number " show line numbers
set showmatch " jump to search result
set smartcase " case insensitive defaul
set smartindent " block indentation
set softtabstop=4 " back character length
set tabstop=4 " tab character length
set numberwidth=4 " set line numbers section width
set shiftwidth=4 " shift movement length
set colorcolumn=120 " Mark column at 120 chars
set expandtab " Expand tabs to spaces
set wildignore+=*/tmp/*,*.so,*.swp " ignored by vim fs access
set wildignore+=*/templates_c/*,*/bin/*
set wildignore+=*/node_modules/*
set wildignore+=*/QueryBuilder.deploy*/*
set t_Co=256
set wildmenu
set tags^=./.tags,./.TAGS,.tags,.TAGS
set nobackup " dont create tmp backup files
set nowritebackup " dont create tmp backup files
set noswapfile " dont create tmp backup files
set scrolloff=3 " buffer for screen when scrolling
set ttyfast " makes things... smoother?
syntax on
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" $FILE TYPE SETTINGS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"au Filetype * source ~/.vim/scripts/script.vim
"au Filetype yaml source ~/.vim/scripts/yml.vim
"au Filetype yml source ~/.vim/scripts/yml.vim
"au Filetype cucumber source ~/.vim/scripts/yml.vim
"au Filetype ruby source ~/.vim/scripts/yml.vim
" file type remapping for syntax highlighting
au BufNewFile,BufRead *.md set ft=mkd
au BufNewFile,BufRead *.json set ft=javascript
au BufNewFile,BufRead *.twig set ft=htmljinja
au BufNewFile,BufRead *.dist set ft=xml
au BufNewFile,BufRead *.pp set ft=ruby
au BufNewFile,BufRead .domainconfig set ft=dosini
" au BufNewFile,BufRead *.conf set ft=apache
" work shift
au BufNewFile,BufRead *.tpl set ft=smarty
au BufNewFile,BufRead *{.inc,.lan,.view,.act,.get,.controller} set ft=php
" apex shiat
au BufNewFile,BufRead *.cls set ft=java
au BufNewFile,BufRead *.page set ft=xml
au BufNewFile,BufRead *.object set ft=xml
hi link javaCharacter javaString
hi link javaSpecialCharError javaString
hi link javaError None
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" $MAPPINGS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
map <leader>o <ESC>:CtrlPTag<CR>
map <C-c> <ESC>:TComment<CR>
xmap <C-c> <ESC>:'<,'>TComment<CR>
map <S-f> <ESC>:NERDTreeTabsToggle<CR>
nnoremap j :m .+1<CR>==
nnoremap k :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
"map <C-t> <ESC>:exec('tag '.expand("<cword>"))<CR>
map <C-l> <ESC>:echo synIDattr(synID(line("."), col("."), 1), "name")<CR>
map <C-j> <ESC>:bp<CR>
map <C-k> <ESC>:bn<CR>
" 's'ave
map <S-s> <ESC>:w<CR>
" 's'ave
map <C-s> <ESC>:w<CR>
map <Tab> <C-w><C-w>
nnoremap <CR> :noh<CR><CR>:<backspace>
nnoremap K i<CR><Esc>
" exit insert mode within insert mode
inoremap jj <Esc>
" give C-p/C-n the filtering power of Up/Down in Command mode
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
"map <leader><Tab> <C-w><C-w>
map <leader>a :Chanstat<CR>
" 's'ql 'r'esults 'c'lose. Close results from dbext
map <leader>src :DBResultsClose<CR>
" 'c'lose. Close the current buffer w/out closing the window.
nmap <leader>c ::bp\|bd #<CR>
" 'd'iff. Show currently staged changes.
map <leader>d :Staged<CR>
map <leader>f <ESC>:NERDTreeFind<CR>
map <leader>g :GitGutterNextHunk<CR>
map <leader>h :Hangup<CR>
nmap <leader>l :set list!<CR>
map <leader>o :Workers<CR>
map <leader>p :set paste!<CR>
map <leader>r :Run<CR>
nmap <leader>s :source $MYVIMRC<CR>:noh<CR>
map <leader>t :TagbarToggle<CR>
map <leader>u :Unittest <C-r><C-w><CR>
nmap <leader>v :e $MYVIMRC<CR>
nnoremap <leader>w :call <SID>StripTrailingWhitespaces()<CR>
"nnoremap <leader>c :Copy<CR><CR>
" map <leader>h :if exists("g:syntax_on") <Bar>
" \ syntax off <Bar>
" \ else <Bar>
" \syntax on <Bar>
" \ endif <CR>
" colon, semi-colon switch
nnoremap ; :
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" $COMMANDS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
command! Ctags !ctags -R --verbose -f .tags
command! Copy !cat % | xclip -sel clip && echo "copied to clip board"
" gcc
command! GccRun !gcc % -o prog.out && chmod +x prog.out && ./prog.out && rm prog.out
command! -nargs=* GccCat !gcc % -o prog.out && chmod +x prog.out && cat <f-args> | ./prog.out && rm prog.out
" php
command! Cupdate !composer update
command! Cautoload !composer dumpautoload
"command! -nargs=* Test !phpunit <f-args>
command! -nargs=1 Unittest !cd %:h; cd -- "$(upfind -name 'phpunit.xml.dist')"; phpunit --debug --filter=<f-args> %
command! ViewTests !gnome-open ./bin/report/index.html
"asterisk
command! Hangup !asterisk -x 'channel request hangup all'
command! Chanstat !asterisk -x 'core show channels concise'
command! -nargs=* Release !yes y | php ext/is/nexusdomain/is/tools/asterisk_release.php <f-args>
" git commands
"command! Ann !git annotate %
"command! Stat !git status
command! -nargs=* Diff !git diff <f-args>
command! Staged Git! diff --staged
command! Workers !~/restartworkers.sh
" run scripts
command! Run !file=$(basename %);ext="${file\#\#*.}"; clear;
\ case $ext in
\ php)
\ php % | less
\ ;;
\ js)
\ node % | less
\ ;;
\ py)
\ python % | less
\ ;;
\ rb)
\ ruby % | less
\ ;;
\ *)
\ echo "i don't know what to do with .$ext files"
\ ;;
\ esac
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" COLORSCHEME
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
colorscheme default
hi Constant ctermfg=229
"hi String ctermfg=229
hi Statement ctermfg=117
hi Structure ctermfg=111
hi ColorColumn ctermbg=235
hi ExtraWhitespace ctermfg=161
hi IncSearch ctermfg=0 ctermbg=193 cterm=bold
hi Search ctermfg=0 ctermbg=193 cterm=bold
hi SpecialKey ctermbg=None
hi Todo ctermfg=Red ctermbg=None
hi htmlString ctermfg=Blue
hi NonText ctermfg=235 ctermbg=None
hi SpecialKey ctermfg=235 ctermbg=None
hi javaScriptReserved ctermfg=None
hi link phpFunctions phpRegion
hi link phpMethods phpRegion
match ExtraWhitespace /\s\+\%#\@<!$/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SYNTAX
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax keyword phpException finally
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" FUNCTIONS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" todo: get function out of here
" white space
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction