Skip to content
Shaun Mahood edited this page Mar 18, 2017 · 6 revisions

DEPRECATION NOTICE: Please do not edit this wiki. Instead submit pull requests to https://github.com/clojure/clojurescript-site

The up to date version of this page can be found at https://clojurescript.org/tools/vim

Using Vim with ClojureScript

Paredit

Emacs users are used to the paredit plugin that makes it easy to keep parenthesis balanced. Vim users can get the same effect with paredit.vim.

Multi-repl, single environment, evaluating forms from Vim

Dependencies

  • Install Tmux
  • Install tslime.vim
  • Install Leiningen plugin: lein-repls
    • Also install the cljsh script on your path

Configure Lein repl

In project.clj add:

  :repl-init myapp.repl

In src/clj/myapp/repl.clj:

(ns myapp.repl
  (:use [cljs.repl.browser :only (repl-env)])
  (:require [cljs.repl]))

(defn repljs []
  (cljs.repl/repl (repl-env)))

Run repls

  • Open two TMux sessions in your project root directory
  • Run lein repls in one of them
    • This is your "server" or "macros" or "clj" repl
  • Run cljsh in the other one
    • This is your "client" or "cljs" repl
    • Eval (repljs)

Connect VIM

  • Open two instances of Vim
    • One in your src/clj directory and one in src/cljs directory
  • Press ^c^c in each, selecting the right TMux session when prompted
Clone this wiki locally