6

I've been using vim for editing code for some time and now I want to use it effectively for programming in Standard ML. In emacs one can use sml-mode which allows one to open the SML intepreter (Moscow ML in my case) in a buffer and load the actual file.

Is it possible to run the Moscow ML interpreter and load the actual file from within vim?

2 Answers2

4

What I do is, I have the :make command set to run the file in Moscow ML. This can be accomplished by adding the following to your .vimrc:

" SML make code {{{
autocmd FileType sml setlocal makeprg=rlwrap\ mosml\ -P\ full\ '%'
" }}}

You then simply type :make while in an SML buffer, and it will run the code through Moscow ML for you. (rlwrap improves the REPL a bit, by extending it with readline functionality.)

Sebastian Paaske Tørholm
  • 49,493
  • 11
  • 100
  • 118
  • Thanks, it works though the output in the interactive prompt is printed before the input (there is no '-' prompt when typing either). Do you know if it is possible to have mosml open in a split window/buffer (or whatever it's called)? –  Sep 15 '12 at 22:44
  • You could use Conque, but I'm not too impressed with it. See http://stackoverflow.com/questions/1236563/how-to-run-a-terminal-inside-of-vim – Sebastian Paaske Tørholm Sep 16 '12 at 12:20
0

The vim-better-sml plugin adds built-in REPL and other neat features. Check it out: https://github.com/jez/vim-better-sml

You can follow the installation instructions here: https://github.com/jez/vim-better-sml#install

Junye Huang
  • 130
  • 1
  • 5