set bg=dark syntax on set title set nocompatible " php helpfuls " let php_sql_query = 1 let php_baselib = 1 let php_htmlInStrings = 1 let php_noShortTags = 1 let php_parent_error_close = 1 let php_parent_error_open = 1 let php_folding = 1 " some common helpful settings set shiftwidth=2 "do an incremental search set incsearch " Correct indentation after opening a phpdocblock and automatic * on every line set formatoptions=qroct " Wrap visual selectiosn with chars :vnoremap ( "zdi^V(z) :vnoremap { "zdi^V{z} :vnoremap [ "zdi^V[z] :vnoremap ' "zdi'z' :vnoremap " "zdi^V"z^V" " Detect filetypes "if exists("did_load_filetypes") " finish "endif augroup filetypedetect au! BufRead,BufNewFile *.pp setfiletype puppet au! BufRead,BufNewFile *httpd*.conf setfiletype apache au! BufRead,BufNewFile *inc setfiletype php augroup END " Nick wrote: Uncomment these lines to do syntax checking when you save augroup Programming " clear auto commands for this group autocmd! autocmd BufWritePost *.php !php -d display_errors=on -l autocmd BufWritePost *.inc !php -d display_errors=on -l autocmd BufWritePost *httpd*.conf !/etc/rc.d/init.d/httpd configtest autocmd BufWritePost *.bash !bash -n autocmd BufWritePost *.sh !bash -n autocmd BufWritePost *.pl !perl -c autocmd BufWritePost *.perl !perl -c autocmd BufWritePost *.xml !xmllint --noout autocmd BufWritePost *.xsl !xmllint --noout autocmd BufWritePost *.js !~/jslint/jsl -conf ~/jslint/jsl.default.conf -nologo -nosummary -process autocmd BufWritePost *.rb !ruby -c autocmd BufWritePost *.pp !puppet --parseonly augroup en " enable filetype detection: filetype on " make searches case-insensitive, unless they contain upper-case letters: set ignorecase set smartcase " my common spelling mistakes ;) abbreviate wierd weird abbreviate restaraunt restaurant "set ls=2 " allways show status line "set ruler " show the cursor position all the time "au BufNewFile,BufRead *.pls set syntax=dosini if &term == "xterm-color" fixdel endif " Enable folding by fold markers " this causes vi problems set foldmethod=marker " Correct indentation after opening a phpdocblock and automatic * on every " line set formatoptions=qroct " The completion dictionary is provided by Rasmus: " http://lerdorf.com/funclist.txt set dictionary-=~/phpfunclist.txt dictionary+=~/phpfunclist.txt " Use the dictionary completion set complete-=k complete+=k " {{{ Autocompletion using the TAB key " This function determines, wether we are on the start of the line text (then tab indents) or " if we want to try autocompletion function InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" else return "\" endif endfunction " Remap the tab key to select action with InsertTabWrapper inoremap =InsertTabWrapper() " }}} Autocompletion using the TAB key " {{{ Mappings for autogeneration of PHP code " There are 2 versions available of the code templates, one for the case, that " the close character mapping is disabled and one for the case it is enabled. " {{{ With close char mapping activated (currently active) " require, require_once map! =req /** * * * * @since */require '; map! =roq /** * * * * @since */require_once '; " include, include_once map! =inc /** * * * * @since */include '; map! =ioc /** * * * * @since */include_once '; " define map! =def /** * * * * @since * @access public*/define (', ';?',i " class map! =cla /** * * * * @since */class {?/\*\*/ \* $i " public/private methods map! =puf /** * * * * @since * @access public* @param * @return void*/public function ({?/\*\*/ \* $i map! =prf /** * * * * @since * @access private* @param * @return void*/private function _ ({?/\*\*/ \* $i " public/private attributes map! =pua /** * * * @var * @since */public $ = ;?/\*\*/ \* $i map! =pra /** * * * @var * @since */private $_ = ;?/\*\*/ \* $i " for loop map! =for for ($i = 0; $i ; $i++ {/ ;i " foreach loop map! =foe foreach ($ as $ => $ {/\ asi " while loop map! =whi while ( {/ )i " switch statement map! =swi switch ($ {case ':break;default:break;/)i " alternative map! =if if ( { else {/)i " }}} With close char mapping activated (currently active) " {{{ With close char mapping de-activated (currently in-active) " require, require_once "map! =req /** * * * * @since */require '';hi "map! =roq /** * * * * @since */require_once '';hi " include, include_once "map! =inc /** * * * * @since */include '';hi "map! =ioc /** * * * * @since */include_once '';hi " define "map! =def /** * * * * @since * @access public*/define ('', '');?',i " class "map! =cla /** * * * * @since */class {}?/\*\*/ \* $i " public/private methods "map! =puf /** * * * * @since * @access public* @param * @return void*/public function (){}?/\*\*/ \* $i "map! =prf /** * * * * @since * @access private* @param * @return void*/private function _ (){}?/\*\*/ \* $i " public/private attributes "map! =pua /** * * * @var * @since */public $ = ;?/\*\*/ \* $i "map! =pra /** * * * @var * @since */private $_ = ;?/\*\*/ \* $i " for loop "map! =for for ($i = 0; $i ; $i++) {}/ ;i " foreach loop "map! =foe foreach ($ as $ => $) {} " while loop "map! =whi while ( ) {}/ )i " switch statement "map! =swi switch ($) {case '':break;default:break;}/)i " alternative "map! =if if () {} else {}/)i " }}} With close char mapping de-activated (currently in-active) " }}} Mappings for autogeneration of PHP code