Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Introducing Beduino

http://pancake.io/89929b/img/bedouin.jpg

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

http://pancake.io/89929b/img/simple_session.png

Why?

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 "myfile.ml". 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.

Prerequisites

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

Installation

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 "file.ml")
(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>

FAQ

  • 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.

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.