Skip to content

Instantly share code, notes, and snippets.

@catsby
Created July 29, 2010 15:55
Show Gist options
  • Save catsby/498485 to your computer and use it in GitHub Desktop.
Save catsby/498485 to your computer and use it in GitHub Desktop.
set nocompatible
set incsearch
set ai
set expandtab
set tabstop=4
set shiftwidth=4
set ignorecase
set smartcase
set scrolloff=3
set number
syntax on
set background=light
set foldmethod=syntax
set backupdir=./.backup,.,/tmp
set directory=.,./.backup,/tmp
set autowrite
set autoread
" Setup linting support for PHP. Running :make checks PHP syntax.
set makeprg=php\ -l\ %
set errorformat=%m\ in\ %f\ on\ line\ %l
" Adjust highlighting to enable SQL and HTML highlighting
let php_sql_query=1
let php_htmlInStrings=1
let php_show_pcre=1
" let php_folding=3
" When hitting F5, show all instances of the word under the cursor
map <F6> [I:let nr = input("Which one: ") <Bar>exe "normal " . nr . "[\t"<CR>
nnoremap <silent> <F8> :TlistToggle<CR><C-W>h
nnoremap <silent> <F9> :NERDTreeToggle<CR>
filetype plugin on
au FileType php set omnifunc=phpcomplete#CompletePHP
" Highlight text over the 80 character limit
:au BufWinEnter *.php let w:m1=matchadd('Search', '\%<81v.\%>77v', -1)
:au BufWinEnter *.php let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
:au BufWinEnter *.phtml call clearmatches()
" run file with PHP CLI (CTRL-M)
:autocmd FileType php noremap <C-M> :w!<CR>:!/usr/bin/php %<CR>
"
" PHP parser check (CTRL-L)
:autocmd FileType php noremap <C-L> :!/usr/bin/php -l %<CR>
" Improve omnicompletion
set completeopt=longest,menuone,preview
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment