Quantcast
Channel: php – ma.ttias.be
Viewing all articles
Browse latest Browse all 69

A vim configuration for the PHP developer

$
0
0

I'm a fan of vim. I cursed at it for 2 years before I loved it, but I wouldn't want any other editor anymore. However, I do require a few changes to the default behaviour of vim before it suits my needs when I'm doing PHP development.

Here's my current ~/.vimrc file I use.

" Vim configuration file

" No more "vi" compatibility
set nocompatible

" General vim stuff
filetype plugin on
filetype indent on
syntax on
set nowrap

" Default color
colorscheme desert

" I don't want those .swp files cluttering up my normal directories
" Gets very messy with version control
" So store them in a seperate directory
set directory=~/.vim/swap-files,~/tmp,.

" VCL stuff, for editing Varnish files
au BufRead,BufNewFile *.vcl :set ft=vcl
au! Syntax vcl source ~/.vim/syntax/vcl.vim

" Parse the php-fpm.conf file as a dosini
autocmd BufRead,BufNewFile /etc/php-fpm.conf set syntax=dosini

" Show nice info in ruler
set ruler
set laststatus=2

" Set standard setting for PEAR coding standards
set tabstop=4
set shiftwidth=4
set expandtab

" Auto indenting is just so nice
set autoindent
set smartindent

" When searching in vim, make sure the search hit is never at the bottom
set scrolloff=5

" This setting hurts you the most when first starting with vim: disable the arrowkeys. For navigation, use "hjkl"
" You'll probably want to disable these when first using vim.
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
vnoremap <up> <nop>
vnoremap <down> <nop>
vnoremap <left> <nop>
vnoremap <right> <nop>

" Source/reload .vimrc after saving .vimrc
autocmd bufwritepost .vimrc source $MYVIMRC

" Increase the history buffer for undo'ing mistakes
set history=1000
set undolevels=1000

" Enable at least 256 colors instead of the default 8 (I think?)
set t_Co=256

I also using the Varnish VCL syntax highlighting plugin provided by Steven Merril.


Viewing all articles
Browse latest Browse all 69

Trending Articles