Introducing Beduino

Beduino (i.e, a Bedouin) is an effort to create THE Ocaml bundle for Vim. It includes all the handy features of vim-ocaml <>;, plus a lightweight interactive development cycle through tmux.


Because I'm a Vim user and I've found my workflow to be clumsy. In Haskell, I can simply press ":r" to reload the current Haskell file inside the REPL. In OCaml there isn't such shortcut, and I have to use #use "". But this process tends to become annoying very soon. Another option was to use plugins like Conque, but I believe in the motto "The right tool for the right job". I prefer to have the full power of a real shell under my fingers rather than a Vim plugin trying to emulate one. The plugin is VERY young, but for me it's already so damn useful: I can fire up Vim, press a couple of keystroke and have the buffer I'm currently editing automatically reloaded simply pressing <localleader>bb (mnemonic tips: Beduino (Eval) Buffer). In future releases the plugin will grow even more.


  • Vim >= 7.3 with Python support
  • rlwrap
  • tmux >= 1.6 (although 1.5 should work too)


Pathogen is your best friend.

Supported Features

  • Automatic management of the Beduino session (aka the underlying tmux session)
    • You don't have to worry about existing sessions: Beduino will connect to an existing session if he finds a valid one; In the same spirit, your Beduino session will be closed when you quit Vim
  • Send file to toplevel (stable)
    • Forget #use, simply press <localleader>bb
  • Send function to toplevel (experimental)

Key bindings

Beduino tries to leave your existing binding alone, using the concept of local map leader to allow more flexibility. Therefore, you are strongly encouraged to set a local leader, including this line in your .vimrc:

let maplocalleader = <your-favourite>

Done that, you can open your favourite OCaml file in Vim and press:

<localleader>bc "Start the Beduino server in another terminal window
<localleader>bb "Eval the whole buffer (i.e., #use "")
(after a visual selection) :call BeduinoEvalVisual() "Eval visual selection

Flags and Variables

This is a selection of variable to put inside your .vimrc to customize Beduino's behaviour:

  • g:beduino_default_terminal = <default:xterm>


  • I'm running Vim inside a Tmux session. I run Beduino connect but nothing happens:

    • Delete tmux temporary leftover. In a standard Linux system:

      rm -rf /tmp/tmux-1000

      This should fix the problem. If this fails, read below.

    • Try typing this in your running tmux session:

      unset TMUX

      I'm working on a way to automatize this and make it transparent to the final user.

Future directions

This plugin is the result of only an afternoon of hacking. I'm also a VimL beginner, so I don't expect the code to be polished at all. Bear in mind that at the current status a lot of thing are hardcoded:

  • Tmux buffers are written in a file called beduino.buff. In future releases I'll work to a way to make this process less invasive as possible.