===VimFormatter===
**注意:**请先查看GeshiFormatter,在GeshiFormatter能满足你需求的情况下,它是一个更好的选择。
**功能:**这是一个调用Vim([[http://www.vim.org Vi IMproved]])进行处理的[[CooCooFormatter Formatter]],它利用了Vim支持对大量不同种类文件进行语法高亮度显示的功能,让CooCooWakka的代码框支持更多的语法高亮度显示。
**注意:**该Formatter理论上支持任何vim支持的文件类型,但并没有完全接受测试,如果发现问题,请[[与我联系]]
**需求:**
CooCooWakka 0.0.7.8或以上。
默认设置是针对安装了Vim(调试环境为版本6.2)的Linux/UNIX平台;
如果在Windows下使用,请修改formatters/vim.php中的$vim_cmd为相应vim路径(未经过测试)。
**作者:**CooYip
By **CooYip** at Wed January 7, 2004, 2:49 pm.
===问题===
暂时没有找到比较好的配色解决方案。
===使用方法===
%%(vim:filetype)
your code here
%%
其中filetype设为代码的文件类型,(下面会有一个Vim6.2默认支持的文件类型的列表)
如
%%(vim:c)
#include <stdio.h>
void main(){
/* your code */
}
%%
%%(vim:c)
#include <stdio.h>
void main(){
/* your code */
}
%%
===效果===
显示diff文件:
%%(vim:diff)
14c14
< // $Id: wakka.php,v 1.38 2003/11/30 07:18:50 cooyeah Exp $
---
> // $Id: wakka.php,v 1.43 2004/01/07 07:44:42 cooyeah Exp $
17c17
< define("COO_VERSION","0.0.7.5");
---
> define("COO_VERSION","0.0.7.7");
424c424
< else if (preg_match("/^.+\@.+$/", $tag))
---
> else if (preg_match("/^.+\@.+\..+$/", $tag))
429c429,438
< else
---
>
> /*
> //Link to "network neighbour"
> //uncomment it to enable
> else if (preg_match("/^\\\\.+/",$tag)) //Link to "network neighbour"
> {
> return "<a href=\"$tag\">$text</a>";
> }*/
>
> else
706c715
< function Format($text, $formatter = "wakka")
---
> function Format($text, $formatter = "wakka",$args=)
708c717
< return $this->IncludeBuffered("formatters/".$formatter.".php", "<i>Formatter \"$formatter\" not found</i>", compact("text"));
---
> return $this->IncludeBuffered("formatters/".$formatter.".php", "<i>Formatter \"$formatter\" not found</i>", compact("text","args"));
760a770,772
> function IsManager($user=){
> return ($this->IsAdmin($user)||$this->UserIsOwner($user));
> }
1054,1055c1066
<
< // do our stuff!
---
> // do our stuff!
1117a1129
> magicQuotesSuck($_REQUEST);
1288d1299
<
1294d1304
<
%%
===Which File types are available in Vim6.2 by default?===
[table]
||2html||diff||jgraph||pf||specman||
||a65||diva||jproperties||php||spec||
||aap||dns||jsp||phtml||spice||
||abaqus||docbksgml||kix||pic||splint||
||abc||docbk||kscript||pike||spup||
||abel||docbkxml||kwt||pilrc||spyce||
||acedb||dosbatch||lace||pine||sqlforms||
||ada||dosini||latte||plm||sqlj||
||aflex||dot||lex||plp||sql||
||ahdl||dracula||lftp||plsql||sqr||
||amiga||dsl||lhaskell||pod||squid||
||aml||dtd||lifelines||postscr||sshconfig||
||ampl||dtml||lilo||po||sshdconfig||
||antlr||dylanintr||lisp||povini||stp||
||ant||dylanlid||lite||pov||strace||
||apachestyle||dylan||logtalk||ppd||st||
||apache||ecd||lotos||ppwiz||svn||
||art||edif||lout||procmail||syncolor||
||asm68k||eiffel||lpc||progress||synload||
||asmh8300||elf||lprolog||prolog||syntax||
||asm||elmfilt||lscript||psf||tads||
||asn||erlang||lss||ptcap||tags||
||aspperl||esqlc||lua||purifylog||takcmp||
||aspvbs||eterm||lynx||python||takout||
||atlas||exim||m4||qf||tak||
||automake||expect||mailcap||quake||tasm||
||ave||exports||mail||radiance||tcl||
||awk||fetchmail||make||ratpoison||terminfo||
||ayacc||fgl||manual||rcslog||texinfo||
||baan||focexec||man||rcs||texmf||
||basic||form||maple||rc||tex||
||bc||forth||masm||readline||tf||
||bdf||fortran||mason||README.txt||tidy||
||bib||foxpro||master||rebol||tilde||
||bindzone||fstab||matlab||registry||tli||
||blank||fvwm2m4||mel||remind||trasys||
||btm||fvwm||mf||resolv||tsalt||
||b||gdb||mgp||rexx||tsscl||
||catalog||gdmo||mib||rib||tssgm||
||cdl||gedcom||mma||robots||tssop||
||cfg||gkrellmrc||mmix||rpcgen||uc||
||cf||gnuplot||modconf||rpl||uil||
||changelog||gpg||model||rtf||valgrind||
||change||gp||modsim3||ruby||vb||
||chaskell||groff||modula2||r||verilog||
||cheetah||grub||modula3||samba||vgrindefs||
||ch||gsp||monk||sas||vhdl||
||clean||gtkrc||moo||sather||viminfo||
||clipper||haskell||mp||scheme||vim||
||cl||hb||msidl||scilab||virata||
||cobol||help||msql||screen||vrml||
||colortest||hercules||mush||sdl||vsejc||
[/table]