Ⅰ. 插件描述
Indentation for SAS scriptsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/indsas'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/indsas'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/indsas'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/indsas
Ⅳ. 文档说明
A Perl script to indent a lousily indented or indentless SAS script.
Example:
indsas xxx.sas
or
indsas xxx.sas > new_xxx.sas
It can be invoked in VIM by adding a line to .vimrc file.
set ep=your_path_to_indsas/indsas
While you are editing a file with VIM, type this to indent the whole file
gg=G
if you want to go back to the current position after indenting, add this to your .vimrc
nmap gW magg=G'a
and you can type gW to indent the whole file at any position of the file.
NOTE:
1) indsas assumes the following SAS scripting(indenting) styles for input and merge statements:
==INPUT===
data a1;
infile 'xxxx.txt';
input
var1 $
var2 $
.......
;
run;
==MERGE===
data new;
merge
dat1(in=a)
dat2(in=b)
;
run;
2) indsas also assumes the following scripting style:
*PROC and DATA statements are always accompanied with RUN;
*DO,IF xxx THEN DO and ELSE DO should be closed by END;
*PROC SQL should be closed by QUIT;
3) This script is still very primitive and does not account for all other eccentric scripting styles.
4) indsas does not handle "cards" or "datalines" correctly. Please manually adjust those lines.
5) indsas was only tested in the unix/linux environment.