Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ngya/phpcr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

49 Commits

Repository files navigation

#phpcr.vim Auto format php code.

Usage

  • insert mode press Enter (CR)

###Conventions and Style Reference:

  1. http://kohanaframework.org/3.0/guide/kohana/conventions
  2. http://pear.php.net/manual/en/standards.php
  3. https://github.com/php-fig/fig-standards/tree/master/accepted
// Correct: 
// Incorrect:
if($foo=='bar') 
if ($foo == 'bar')
$foo='bar'; 
$foo = 'bar';
$foo=(($bar>5)?($bar+$foo):strlen($bar))?Help::$foo%5:$bar%7; 
$foo = (($bar>5) ? ($bar + $foo) : strlen($bar)) ? Hleper::$foo % 5 : $bar % 7;
$foo=(string)$bar; 
$foo = (string) $bar;
if((string)$bar) 
if ( (string) $bar)
preg_replace('/(\d+) dollar/','1ドル euro',$str); 
preg_replace('/(\d+) dollar/', '1ドル euro', $str);
if(($foo&&$bar)||($b&&$c))
if (($foo AND $bar) OR ($b && $c))
$arr=array('key'=>array('key'=>'value'+'value2')) 
$arr = array('key' => array('key' => 'value' + 'value2'))
$a+=$b/$c-$d; 
$a += $b / $c - $d;
$sql = "select * from table1 where id = 11 and ip = '127.0.0.1'";
$sql = "SELECT *
 FROM table1
 WHERE id = 11 AND ip = '127.0.0.1'";
 
$db->from('table')->join('table2')->where(array('id'=>1));
$db->from('table')->join('table2')->where(array('id' => 1));

###.vimrc

syntax enable " 打开语法高亮 
syntax on " 开启文件类型侦测
filetype indent on " 针对不同的文件类型采用不同的缩进格式
filetype plugin on " 针对不同的文件类型加载对应的插件

More:

About

add space in php expressions and operators, make it look graceful.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%

AltStyle によって変換されたページ (->オリジナル) /