Ⅰ. 插件描述
Sml for vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'chilicuil/vim-sml-coursera'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'chilicuil/vim-sml-coursera'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'chilicuil/vim-sml-coursera'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/chilicuil/vim-sml-coursera
Ⅳ. 文档说明
sml.vim
Sml + vim integration, originally for https://class.coursera.org/proglang-002/class/index
Requirements
- Vim 7.0+
- Sml http://www.smlnj.org/dist/working/110.76/
Installation
Vundle way (recommended), add the following to your $HOME/.vimrc file:
Bundle 'javier-lopez/sml.vim'
And run inside of vim::BundleInstall
- Pathogen way:
$ git clone https://github.com/javier-lopez/sml.vim.git ~/.vim/bundle/sml.vim
Manual (simplest if you've never heard of vundle or pathogen), download the zip file generated from github and extract it to $HOME/.vim
mv sml.vim*.zip $HOME/.vim
cd $HOME/.vim && unzip sml.vim*.zipUpdate the help tags from vim::helpt ~/.vim/doc/
Usage
On .sml files you can execute :make to run your current buffer on SML, it also indent and shows SML sintaxis. See :help sml.txt for detailed information.
Indentation & highlighting features
There are some differences (features) from standard Vim 7.4 files.
- No line wrapping (
textwidth = 0). - Indent
caseas follows:case x of
NONE => "none"
| SOME of str => str Indent
handleas follows:call_smth_dangerous
handle Err1 => 41| Err2 => 42- Indent functional pattern matching:
fun length [] = 0
| length _::xs = 1 + length xs - Indent
letafterfun:fun double_sum (x, y) =
let val sum = x + y
in 2*sum end - Fix indentation of
if/then/elsewhen using=. - Fix highlighting of
=>,:=. - Highlight record fields in type declaration, record creation and record patterns.
These features are also available as an independent plugin.