- This support only Mac OSX. (I don't have windows...)
git clone https://github.com/hatappo/sublime-clojure
ln -s `pwd`/sublime-clojure $HOME/Library/Application\ Support/Sublime\ Text\ 3/Packages/sublime-clojure
Command + B
: Run with Inlein in *.clj, Run with Planck in *.cljs.Command + Shift + B
: Execute arbitrary command.
Tab
orCtrl + Space
-
Send a symbol of the cursol with
clojure.repl/doc
to sublime-REPL. -
Send a symbol of the cursol with
clojure.repl/source
to sublime-REPL. -
Send a block of the cursol with
clojure.core/macroexpand-1
to sublime-REPL. -
Send a block of the cursol with
clojure.core/macroexpand
to sublime-REPL.
The above commands are not registered in [keymap](Default (OSX).sublime-keymap).
You may use on command palette (Command + Shift + P
).
Consider a code like following.
(ns foo-bar.core
(:import java.util Date)
(:require [clojure.string :as s]))
(defn aaa [] (clojure.java.io/reader "http://....."))
(defn bbb [] (clojure.java.io/reader "http://....."))
(defn ccc [] (clojure.java.io/reader "http://....."))
Type Ctrl + Command + Shift + n
with your cursol is on any position on clojure.java.io/
phrase. Then...
(ns foo-bar.core
(:import java.util Date)
(:require [clojure.string :as s]
[clojure.java.io :as io]))
(defn aaa [] (io/reader "http://....."))
(defn bbb [] (io/reader "http://....."))
(defn ccc [] (io/reader "http://....."))
And all 4 io
aliases are automatically selected, so you can change your favorite alias name immediately if you don't like default alias name (io
in this case).
Of course, any case is handled well such as no ns
form or no require
/import
phrase.
If you edit source code files in a standard leiningen project structure, following features are recognize that.
ns
snippet.- Build commands of Leiningen.sublime-build,
- and file path in the stack trace.(You can move to the line of the file where the error occurred with double clicking the stack trace in a console.)
-
if you type in
ns
when you are editingfoo-bar/src/foo_bar/baz/aaa.clj
which is in a standard leiningen structured project, -
then a following snippet is inserted.
(ns foo-bar.baz.aaa
)
-
if you type in
require
, -
↓
(:require [namespace :as [namespace]])
-
And the first
namespace
text will be automaticaly selected. You can type in a arbitrary namespace text there. -
And more, if you type like
clojure.java.io
, the secondnamespace
which is alias of that is automatically replaced toio
. -
And if you type in
Tab
then the alias nameio
will be selected. You can type in another name if you would not like that.
-
Cljx.sublime-completions
Snippets which are common in both Clojure & ClojureScript. The build settings are wrote by reference to https://github.com/Foxboron/SublimeClojure -
Clojure.sublime-completions
Completions which are particular in only Clojure. Namespaces & vars are scraped from https://clojuredocs.org/core-library/vars by scrape-clj-completions.clj. -
ClojureScript.sublime-completions
Completions which are particular in only ClojureScript. Namespaces & vars are scraped from http://cljs.github.io/api/ by scrape-cljs-completions.clj. -
Inlein.sublime-completions
Completions which are particular in only Planck ClojureScript. -
Planck.sublime-completions
Completions which are particular in only Inlein Clojure.
-
Leiningen.sublime-build
Support Leiningen.
The build settings are wrote by reference to https://gist.github.com/Foredoomed/4103540 .
The command settings are generated bylein help | grep -E '^[a-z][-a-z]* +[A-Za-z].+$' | awk '{printf(" {\"cmd\": \"lein % -15s \"name\": \"lein %s\"},\n", $1"\",", $0)}'
. -
Inlein.sublime-build
Support Inlein.
The command settings are generated byinlein --help | grep '^--[[:alpha:]]*' | awk '{printf(" {\"cmd\": \"inlein % -19s \"name\": \"%s\"},\n", $1"\",", $1)}'
. -
Planck.sublime-build
Support Planck.
- clojure_inline_namespace_refactoring.py
- clojure_repl_sender.py
- Default (OSX).sublime-keymap
- Default.sublime-commands