一个新的PHP的vim缩进脚本 [英] A new vim indent script for php
问题描述
如果你使用GVIM编写php,你会欣赏这个新的缩进脚本:
在那里下载:
http://www.vim.org/scripts/download_...hp?src_id=3710
或者这里:
http://www.2072productions.com/vim/indent/php.vim
描述:(你可以找到 http://www.vim.org/scripts/script.php?script_id=1120 )
特点:
- 缩进完美 PHP代码
- 注释或非PHP代码不会破坏算法
示例:(行空间的开头被____替换)
<?php
if($ foo =" thing")//因为你看到一个打开的括号不需要正确缩进:)
____ if(foo(some))
____ {
________ somethingelse(" blabla");
?>
< html>
< head>
< title>某些HTML代码< / title>
< script type =" text / javascript">
var truc = 0;
if(truc){
____没什么();
}
< / script>
< / head>
< body>
< b>这里有一些结束括号}}< / b>
< / body>
< / html>
< ;?
________ Somethingelse(true);
____}
?>
- 非PHP代码是像PHP代码那样缩进的,所以javascript代码也缩进了:)
- 快速优化的缩进,脚本知道何时缩进大块并跳过一些不必要的测试...
- 支持折叠(折叠不要打破缩进)
- 正确缩进非支架块 (比如语言C)
例如:
<?php
if(!isset($ History_lst_sel))
____if(!isset($ History_lst_sel))
________if(!isset($ History_lst_sel)){
____________ $ History_lst_sel = 0;
________}否则
____________ $ foo =" truc";
____else
_______ $ bla =" foo";
$ command_hist = TRUE;
?>
- 直接缩进,文字在您输入时缩进。
- 开关/外壳正确缩进
- 脚本源代码非常好评论
- 据我所知没有bug :)
那是所有人!
享受:)
安装详情
:
确保文件的名称是php.vim并将其复制到你的vimfiles / indent文件夹下。
foo =" thing")//如你所见,打开的支架不需要正确缩进:)
____ if(foo(" something))
____ {
________ somethingelse(" blabla");
?>
< html>
< head>
< title>一些HTML代码< / title>
>
< script type =" text / javascript">
var truc = 0;
if(truc){
____没有();
}
< / script>
< / head>
< body>
< b>这里有一些结束括号}}< / b>
< / body>
< / html>
< ;?
________ Somethingelse(true);
____}
?>
- 非PHP代码缩进就像PHP代码一样,所以javascript代码也缩进了:)
- 快速优化的缩进,脚本知道何时缩进大块并跳过一些不必要的测试...
- 支持折叠(折叠不要打破缩进)
- 正确缩进非约束块 (比如语言C)
例如:
<?php
if(!isset(
< blockquote> History_lst_sel))
____if(!isset(
History_lst_sel))
________if(!isset(
If you are coding php using GVIM, you will appreciate this new indent script:
Download there:
http://www.vim.org/scripts/download_...hp?src_id=3710
or here:
http://www.2072productions.com/vim/indent/php.vim
Description: (that you can find at http://www.vim.org/scripts/script.php?script_id=1120 )
Features:
- Indent "perfectly" PHP code
- Comment or non-PHP code doesn''t break the algorithm
Example: (start of line spaces are replaced by ____)
<?php
if ($foo="thing") // as you see an opened bracket isn''t needed to indent correctly :)
____if (foo("something"))
____{
________somethingelse("blabla");
?>
<html>
<head>
<title>SOME HTML CODE</title>
<script type="text/javascript">
var truc=0;
if (truc) {
____nothing();
}
</script>
</head>
<body>
<b>some closing bracket here }}</b>
</body>
</html>
<?
________Somethingelse(true);
____}
?>
- Non-PHP code is indented like PHP code would be, so javascript code is indented too :)
- Fast optimized indenting, the script knows when it''s indenting large blocks and skip some unecessary tests...
- Support folding (folds don''t break the indenting)
- Indent correctly "non bracketted blocks" (like in language C)
Exemple:
<?php
if (!isset($History_lst_sel))
____if (!isset($History_lst_sel))
________if (!isset($History_lst_sel)) {
____________$History_lst_sel=0;
________} else
____________$foo="truc";
____else
_______$bla= "foo";
$command_hist = TRUE;
?>
- Direct indenting, the text is indented as you type it.
- switch/case are indented correctly
- Script source code very well commented
- Bug free as far as I know :)
That''s all folks!
Enjoy :)
install details
:
Just make sure the name of the file is php.vim and copy it under your vimfiles/indent folder.
foo="thing") // as you see an opened bracket isn''t needed to indent correctly :)
____if (foo("something"))
____{
________somethingelse("blabla");
?>
<html>
<head>
<title>SOME HTML CODE</title>
<script type="text/javascript">
var truc=0;
if (truc) {
____nothing();
}
</script>
</head>
<body>
<b>some closing bracket here }}</b>
</body>
</html>
<?
________Somethingelse(true);
____}
?>
- Non-PHP code is indented like PHP code would be, so javascript code is indented too :)
- Fast optimized indenting, the script knows when it''s indenting large blocks and skip some unecessary tests...
- Support folding (folds don''t break the indenting)
- Indent correctly "non bracketted blocks" (like in language C)
Exemple:
<?php
if (!isset(
History_lst_sel))
____if (!isset(
History_lst_sel))
________if (!isset(
这篇关于一个新的PHP的vim缩进脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!