-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·281 lines (216 loc) · 7.09 KB
/
vimrc
File metadata and controls
executable file
·281 lines (216 loc) · 7.09 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
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
" Just gimme vim!
set nocompatible
" Set leader
let mapleader = ","
" Set filetype stuff to on
filetype on
filetype plugin on
filetype indent on
syntax enable
" Add a custom directory to vim runtime path
set runtimepath+=~/.vim/local
"---------------------------------------------------------------------------
" Vunlde configuration
"---------------------------------------------------------------------------
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" GitHub repos
Bundle 'flazz/vim-colorschemes'
Bundle 'torandu/vim-bufexplorer'
Bundle 'wincent/Command-T'
Bundle 'scrooloose/nerdtree'
Bundle 'tpope/vim-surround'
Bundle 'edsono/vim-matchit'
Bundle 'vim-scripts/taglist.vim'
Bundle 'StanAngeloff/php.vim'
" Install snipmate dependencies:
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/snipmate-snippets"
" Install snipmate:
Bundle "garbas/vim-snipmate"
"---------------------------------------------------------------------------
" standard configuration
"---------------------------------------------------------------------------
" Show line numbers
set number
" No wrap by default
set nowrap
" Tabstops are 4 spaces
set tabstop=2
set shiftwidth=2
" set the search scan to wrap lines
set wrapscan
" set the search scan so that it ignores case when the search is all lower
" case but recognizes uppercase if it's specified
set ignorecase
set smartcase
" set the forward slash to be the slash of note. Backslashes suck
set shellslash
" Make command line two lines high
set ch=2
" set visual bell -- i hate that damned beeping
set vb
" Allow backspacing over indent, eol, and the start of an insert
set backspace=2
" Make sure that unsaved buffers that are to be put in the background are
" allowed to go in there (ie. the "must save first" error doesn't come up)
set hidden
" Set the status line the way i like it
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n\ [%b][0x%B]
" tell VIM to always put a status line in, even if there is only one window
set laststatus=2
" Don't update the display while executing macros
set lazyredraw
" Show the current command in the lower right corner
set showcmd
" Show the current mode
set showmode
" Hide the mouse pointer while typing
set mousehide
" Set up the gui cursor to look nice
set guicursor=n-v-c:block-Cursor-blinkon0
set guicursor+=ve:ver35-Cursor
set guicursor+=o:hor50-Cursor
set guicursor+=i-ci:ver25-Cursor
set guicursor+=r-cr:hor20-Cursor
set guicursor+=sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
" set the gui options the way I like
set guioptions=ac
" This is the timeout used while waiting for user input on a multi-keyed macro
" or while just sitting and waiting for another key to be pressed measured
" in milliseconds.
"
" i.e. for the ",d" command, there is a "timeoutlen" wait period between the
" "," key and the "d" key. If the "d" key isn't pressed before the
" timeout expires, one of two things happens: The "," command is executed
" if there is one (which there isn't) or the command aborts.
set timeoutlen=800
" Keep some stuff in the history
set history=100
" These commands open folds
set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo
set foldmethod=manual
" When the page starts to scroll, keep the cursor 8 lines from the top and 8
" lines from the bottom
set scrolloff=8
" Make the command-line completion better
set wildmenu
" Set the textwidth to be unlimited
set textwidth=0
" Turn tabs into spaces
set expandtab
" Add ignorance of whitespace to diff
set diffopt+=iwhite
" Enable search highlighting
set hlsearch
" Incrementally match the search
set incsearch
" cd to the directory containing the file in the buffer
nmap <silent> ,cd :lcd %:h<CR>
nmap <silent> ,md :!mkdir -p %:p:h<CR>
" Turn off that stupid highlight search
nmap <silent> ,n :set invhls<CR>:set hls?<CR>
" set text wrapping toggles
" nmap <silent> ,w :set invwrap<CR>:set wrap?<CR>
set wrap
set linebreak
" Toggle NERDTree
map <silent> ,p :execute 'NERDTreeToggle ' . getcwd()<CR>
" Make the NERDTree window a little wider
let g:NERDTreeWinSize = 40
" Toggle taglist
map <silent> ,mt :execute 'TlistToggle'<CR>
" SnipMate Reload snippets
" nmap ,rr :call ReloadSnippets(&filetype)<CR>
" Flush Command-T
map <silent> ,f :execute 'CommandTFlush'<CR>
" Map CTRL-E to do what ',' used to do
nnoremap <c-e> ,
vnoremap <c-e> ,
" Buffer commands
noremap <silent> ,bd :bd<CR>
" Edit the vimrc file
nmap <silent> ,ev :e $MYVIMRC<CR>
nmap <silent> ,sv :so $MYVIMRC<CR>
" Syntax coloring lines that are too long just slows down the world
set synmaxcol=2048
" Set F3 to toggle paste mode
set pt=<F3>
" Convert file to HTML from markdown and place generated HTML in buffer
map ,mdc :!m2h.php % \| pbcopy <CR>
"-----------------------------------------------------------------------------
" Set up the window colors and size
"-----------------------------------------------------------------------------
if has("gui_running")
set guifont=Menlo:h13
set background=dark
colorscheme moria
if !exists("g:vimrcloaded")
winpos 0 0
if ! &diff
"winsize 130 90
set columns=180
set lines=76
else
"winsize 227 90
set columns=180
set lines=76
endif
let g:vimrcloaded = 1
endif
endif
:nohls
"---------------------------------------------------------------------------
" PHP mappings
"---------------------------------------------------------------------------
" PHP function reference
function! OpenPhpFunction (keyword)
let proc_keyword = substitute(a:keyword , '_', '-', 'g')
try
exe 'pedit'
catch /.*/
endtry
exe 'wincmd P'
exe 'enew'
exe "set buftype=nofile"
exe "setlocal noswapfile"
exe 'silent r!lynx -dump -nolist http://us3.php.net/'.proc_keyword
exe 'norm gg'
" exe 'call search("____________________________________")'
exe 'call search("Description")'
exe 'norm dgg'
exe 'call search("User Contributed Notes")'
exe 'norm dGgg'
endfunction
inoremap <D-d> <Esc>h:call OpenPhpFunction('<c-r><c-w>')<CR>:wincmd p<CR>la
nnoremap <D-d> :call OpenPhpFunction('<c-r><c-w>')<CR>:wincmd p<CR>
vnoremap <D-d> :call OpenPhpFunction('<c-r><c-w>')<CR>:wincmd p<CR>
" Close window above
inoremap <D-e> <C-\><C-O><C-w>k<C-\><C-O>:q<CR>
nmap <D-e> <C-w>k:q<CR>
" PHP auto complete
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
" Check PHP syntax
map ,ml :!/Applications/MAMP/bin/php/php5.3.13/bin/php -l %<CR>
map ,mo :call RunPHP()<CR>
function! RunPHP ()
let filename = expand("%:p")
let root = getcwd()
exe 'cd %:p:h'
" exe 'echomsg filename'
exe 'enew'
exe 'set buftype=nofile'
exe 'setlocal noswapfile'
exe 'r!/Applications/MAMP/bin/php/php5.3.13/bin/php ' . filename
exe 'norm gg'
exe 'cd ' . root
endfunction
"---------------------------------------------------------------------------
" UltiSnips settings
"---------------------------------------------------------------------------
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "LeeSnips"]