Ⅰ. 插件描述
Sycamore code conventions made easy.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jronhovde/vim-se-conventions'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jronhovde/vim-se-conventions'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jronhovde/vim-se-conventions'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jronhovde/vim-se-conventions
Ⅳ. 文档说明
# vim-se-conventions
Sycamore code conventions made easy.
Version 1.05.6 - Oct 28 2015
Installation/Setup
If you don't have a preferred installation method, I recommend
installing pathogen.vim, and
then simply copy and paste:
cd ~/.vim/bundle
git clone git@github.com:JRonhovde/vim-se-conventions.git
If not using the Pathogen plugin manager, just create a directory called plugin in your ~/.vim/ folder and place the .vim file from this repo there:
cd ~/.vim
mkdir plugin
Include a visual mode remap for the SEConventions command:
vnoremap <leader>sec <esc>:SEConventions<CR>
Use this command by visually selecting a block of code (pressing v while in command mode) and the pressing <leader>sec. By default, "<leader>" is set to backslash("").
This command will update most of the HTML contained within visually selected print() statements to Sycamore standards. Starting with v1.05, SEC will also convert SQL 'for' loops to use mysql_fetch_assoc() syntax.
Alternatively, the :SEConventions(:SEC) command accepts line numbers. :SEConventions 100 200 will modify lines 100 to 200, inclusive. Given only one argument, it will modify from that line to the end of the file.
If you encounter any problems, try updating the plugin from git:
cd ~/.vim/bundle/vim-se-conventions
git pull origin master
If the problem persists, it can be brought to my attention by creating an issue on GitHub
Comprehensive list:
Add
tableclass to allTABLEelementsse-boldclass to allTRelements that have gray backgrounds (#cfcfcforse-bg-gray)
Remove
width=100%orwidth:100%from TABLEbackground-color:white;or#ffffff;bgcolor=whiteor#ffffff;border=0cellpadding=#cellspacing=#- newline chars
\npreceding the end of a print statement"); href=''andreturn false;- HTML
width=or CSSwidth:fromTRelements <font>and</font>tags that containface=$titlefontandsize=1 or 2when
TABLEelement has the cooresponding font class (size=1->se-font-smallandsize=2->se-font)
<B>tags andse-boldclasses contained withinTRelements with these-boldclass- Left text alignment (HTML, CSS, or
se-leftclass) onTDelements - Empty
styleandclassattributes - Extra spaces within HTML elements and around opening and closing parentheses for
print()statements
Replace/Change
- Gray(
#cfcfcf), light gray(#efefef), pink(#ffcfcf), and school color($titlefont) background colors to
- respective
se-bgclasses
<font>tags withface=$titlefontandsize=1 or 2(opposite of the font class on theTABLEelement) to
- appropriate class on the
TD
widthattributes onTDandTABLEelements to CSS properties- Right and center text alignment (HTML or CSS) to appropriate
se-class for($i=0;$i<$rsc;$i++)towhile($mysql_row = mysql_fetch_assoc($rs)) {.$var = mysql_result($rs, $i, "Var")to$var = $mysql_row["Var"]
Unchanged
- TR
heightattributes <font>tags that contain attributes other thanface=$titlefontandsize=1 or 2<font>tags not preceded by aTDelement on the same line- Anything that would normally be replaced by:
.se-red
.se-tall-row
.se-font-title
.se-top
.se-nowrap
.se-nobold
.se-wrap
.se-striped-green
printf() lines