Skip to content

Instantly share code, notes, and snippets.

@jebberjeb
Last active September 12, 2019 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jebberjeb/21711bcac6c883b3d3de to your computer and use it in GitHub Desktop.
Save jebberjeb/21711bcac6c883b3d3de to your computer and use it in GitHub Desktop.
Vim Plugins w/ Scheme (Racket)

Vim + Racket

A less-known feature of Vim is support for Scheme, for scripting or otherwise. At the time of the original integration, the MZScheme package (a subset of PLTScheme) was used. Eventually, this became Racket. However, in Vim configuration, help, etc, mzscheme is referred to.

The following steps were performed on Ubuntu 14 Server, in order to compile Vim with Scheme support.

Version

To determine whether Vim has been compiled with support for Scheme:

In Vim, :version will likely display -mzscheme, reflecting a lack of Scheme support. Once the steps below are complete, this will become +mzscheme.

Step 1 - Install Racket

  • downloaded, extracted racket-5.3.6-src-unix.tgz (note version 5.3.6) from download.racket.com
  • ./configure --prefix=/usr
  • make
  • sudo make install

I believe, the key difference between this and **other installations was the creation of /usr/lib/libracket3m.a

Other Installations (that Vim couldn't link to)**

  • sudo apt-get install racket
  • latest (6.1.1) Ubunutu package from download.racket.com

**Both of these methods successfully installed Racket, but Vim's configure failed to properly link to Racket libs.

Step 2 - Compile Vim with Scheme Support

  • git clone https://github.com/b4winckler/vim.git ~/vim
  • cd ~/vim
  • make distclean
  • ./configure --enable-multibyte --with-features=big --prefix=/usr --enable-mzschemeinterp
  • make
  • sudo make install

Note that at the time of writing, this resulted in Vim version 7.4.430.

That's it!

Another look at :version should yield +mzscheme

Now in Vim :mz (+ 1 1) output is 2

Eval the current buffer :call mzeval(join(getline(1, $)))

Or :mzfile <filename>

:help mzscheme for more ways to interact with text, buffers, etc.

@AntoniosHadji
Copy link

AntoniosHadji commented Sep 2, 2019

This didn't work for me with racket 7.4 unix source.
Here's what did work:
vim/vim#2596 (comment)

@jebberjeb
Copy link
Author

This didn't work for me with racket 7.4 unix source.
Here's what did work:
vim/vim#2596 (comment)

Thanks. Been a while since I've tried it, but glad to know it's still doable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment