Skip to content

Commit 78fcf9e

Browse files
committed
Update README, CHANGELOG, install.txt and 4.0.0.txt
1 parent b72dbd8 commit 78fcf9e

File tree

7 files changed

+242
-27
lines changed

7 files changed

+242
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### WIP
1+
### 4.0.0 - Aug 23, 2024
22

33
Syntax has been significantly reworked.
44

README.md

Lines changed: 63 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,70 @@
22

33
This package provides Clojure support for Sublime Text and includes:
44

5-
- Clojure and EDN syntax grammars (Sublime Text 3+)
6-
- Code formatter/indenter (Sublime Text 4075+)
7-
- nREPL, Socket REPL, ShadowCLJS REPL clients (Sublime Text 4075+)
5+
- Clojure syntax
6+
- Color scheme
7+
- Code formatter/indenter
8+
- Clients for nREPL, Socket REPL, ShadowCLJS REPL
9+
810

911
# Installation
1012

1113
`Package Control: Install Package``Clojure Sublimed`
1214

15+
1316
# Clojure syntax
1417

15-
<img src="https://raw.github.com/tonsky/Clojure-Sublimed/master/screenshots/syntaxes.png" width="463" height="362" alt="Syntaxes">
18+
<img src="https://raw.github.com/tonsky/Clojure-Sublimed/master/screenshots/syntaxes.png" width="710" height="796" alt="Syntaxes">
1619

17-
Clojure Sublimed ships with its own syntax definition for Clojure and EDN. Unlike default Clojure syntax, this package is:
20+
Clojure Sublimed ships with its own syntax definition for Clojure and EDN. Unlike default Clojure syntax, our syntax can:
1821

19-
- slightly more pedantic as per [EDN spec](https://github.com/edn-format/edn) and [Clojure Reader](https://clojure.org/reference/reader),
20-
- rigorously tested,
21-
- can be used to highlight rainbow parentheses,
22-
- punctuation and validation _inside_ regexps,
23-
- quoted and unquoted regions are marked for highlighting,
24-
- semantically correct tokenization, perfect for fonts with ligatures,
25-
- has separate EDN syntax, same way JSON is separate from JavaScript in Sublime Text.
22+
- mark reader comments `#_` with the following form, including stacked comments,
23+
- mark `comment` forms,
24+
- mark quoted/unquoted forms,
25+
- mark metadata,
26+
- mark parentheses nesting,
27+
- mark and validate punctuation inside regexps,
28+
- do semantically correct tokenization, perfect for fonts with ligatures,
2629

2730
How to enable? Assign syntax to Clojure files:
2831

29-
- open any clj/cljc/cljs file,
30-
- run `View``Syntax``Open all with current extension as...``Clojure Sublimed``Clojure (Sublimed)`.
32+
For each file type (.clj, .cljs, .cljc, .edn) do:
33+
34+
- Open any file with that extension
35+
- Go to menu -> `View``Syntax``Open all with current extension as...`
36+
- Select `Clojure (Sublimed)`
37+
38+
Want to put your parser to test? Check out [syntax_test_clojure.cljc](./test_syntax/syntax_test_clojure.cljc).
39+
40+
41+
# Color scheme
42+
43+
<img src="https://raw.github.com/tonsky/Clojure-Sublimed/master/screenshots/scheme.png" width="850" height="508" alt="Color Scheme">
44+
45+
To make best use of improved syntax definitions, Clojure Submiled offers its own color scheme:
46+
47+
- Cmd/Ctrl + Shift + P (Command Palette)
48+
- `UI: Select Color Scheme`
49+
- Select `Auto` -> `Clojure Sublimed Light` -> `Clojure Sublimed Dark`
50+
51+
These color schemes will work for other languages, too.
3152

32-
Want to put your parser to test? Check out [syntax_test_edn.edn](./test_syntax/syntax_test_edn.edn) and [syntax_test_clojure.cljc](./test_syntax/syntax_test_clojure.cljc).
3353

3454
# Formatter/indenter
3555

36-
Clojure Sublimed includes support for both [Simple Clojure Formatting rules](https://tonsky.me/blog/clojurefmt/) and [cljfmt](https://github.com/weavejester/cljfmt/).
56+
Clojure Sublimed includes support for both [Better Clojure Formatting](https://tonsky.me/blog/clojurefmt/) and [cljfmt](https://github.com/weavejester/cljfmt/).
3757

38-
Simple Clojure Formatting doesn’t require REPL connection, any Clojure runtime or external tools. It is enabled by default.
58+
Better Clojure Formatting doesn’t require REPL connection, Clojure runtime or external tools. It is enabled by default.
3959

40-
`cljfmt` requires `cljfmt` binary to be on `$PATH`. Enable it by setting `"formatter": "cljfmt"` in Clojure Sublimed settings.
60+
To enable `cljfmt`:
61+
62+
- Download `cljfmt` binary from `https://github.com/weavejester/cljfmt/releases/latest`
63+
- Add `cljfmt` to `$PATH`
64+
- Add `"clojure_sublimed_formatter": "cljfmt"` to `Preferences: Settings`
4165

4266
To reformat whole file, run `Clojure Sublimed: Reindent`. If you have non-empty selection, it will only reformat selected lines.
4367

44-
To enable reindenting/formatting on save, add `"format_on_save": true` to settings. ([See how to edit settings](#editing-settings))
68+
To enable reindenting/formatting on save, add `"clojure_sublimed_format_on_save": true` to `Preferences: Settings`.
4569

4670
To enable correct indentations as you type code, rebind `Enter` to `Clojure Sublimed: Insert Newline`:
4771

@@ -53,7 +77,6 @@ To enable correct indentations as you type code, rebind `Enter` to `Clojure Subl
5377
{"key": "panel_has_focus", "operator": "equal", "operand": false}]}
5478
```
5579

56-
Best way to do it is through running `Preferences: Clojure Sublimed Key Bindings`.
5780

5881
# REPL clients
5982

@@ -89,16 +112,23 @@ How to choose which REPL to use?
89112
1. Are you on JVM? Use Socket REPL.
90113
2. On JVM and only have nREPL? Use JVM nREPL.
91114
3. CLJS? Use ShadowCLJS REPL.
92-
4. Otherwise (e.g. babashka) use Raw nREPL.
115+
4. Otherwise (e.g. babashka, sci, ...) use Raw nREPL.
93116

94117
We intentionally excluded following features:
95118

96119
- [ ] Autocomplete. Static analysis is much simpler and much more reliable than requiring an always-live connection to the working app.
97120

98121
Look at [Sublime LSP](https://github.com/sublimelsp/LSP) with [Clojure LSP](https://github.com/clojure-lsp/clojure-lsp) or [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) with [clj-kondo](https://github.com/ToxicFrog/SublimeLinter-contrib-clj-kondo) if you need autocompletion.
99122

123+
100124
# How to use
101125

126+
Clojure Sublimed will not run your app for you. Use any other way, e.g.:
127+
128+
- Separate terminal app
129+
- Terminus plugin
130+
- Sublime Executor plugin
131+
102132
For Clojure apps:
103133

104134
1. Run Socket Server, e.g. with either
@@ -126,6 +156,7 @@ For other nREPL apps:
126156
1. Run nREPL server.
127157
2. Run `Clojure Sublimed: Connect to raw nREPL` command.
128158

159+
129160
## Evaluating code from buffer
130161

131162
From here you have three options:
@@ -150,16 +181,19 @@ By default, Clojure Sublimed will also print evaluation time if it takes more th
150181

151182
<img src="https://raw.github.com/tonsky/Clojure-Sublimed/master/screenshots/eval_elapsed.png" width="500" height="139" alt="Elapsed time">
152183

184+
153185
## Copying evaluation results
154186

155187
Sometimes you want to copy evaluation result. It is recommended to rebind `Cmd+C`/`Ctrl+C` from `copy` to `sublime_clojure_copy`. This will copy evaluation result if inside evaluated region and fallback to default `copy` otherwise.
156188

189+
157190
## Interrupting
158191

159192
If your evaluation runs too long and you want to interrupt it, run `Clojure Sublimed: Interrupt Pending Evaluations`:
160193

161194
<img src="https://raw.github.com/tonsky/Clojure-Sublimed/master/screenshots/interrupt.png" width="587" height="39" alt="Interrupt">
162195

196+
163197
## Opening stacktrace
164198

165199
If your evaluation failed, put your cursor inside failed region and run `Clojure Sublimed: Toggle Stacktrace`:
@@ -170,6 +204,7 @@ Clojure Sublimed will display stacktraces in a Clojure-friendly way. Compare wit
170204

171205
<img src="https://raw.github.com/tonsky/Clojure-Sublimed/master/screenshots/stacktraces.png" width="806" height="390" alt="Stacktraces">
172206

207+
173208
## Watches
174209

175210
Watches are great alternative to debug prints: they allow you to monitor intermediate values during function execution right in the editor.
@@ -184,6 +219,7 @@ This is how they work:
184219

185220
Watches are only supported in Socket REPL.
186221

222+
187223
## Looking up symbol
188224

189225
To show symbol info, run `Clojure Sublimed: Toggle Symbol Info`:
@@ -192,6 +228,7 @@ To show symbol info, run `Clojure Sublimed: Toggle Symbol Info`:
192228

193229
Universal `Clojure Sublimed: Toggle Info` command acts as either `Toggle Stacktrace` or `Toggle Symbol Info`, depending on context.
194230

231+
195232
## Binding keys to eval custom code
196233

197234
Every project is different, and sometimes it’s convenient to run a piece of code so often you’d want it on a shortcut. It might be a namespace reload, test execution, database reconnect, linter, formatter — possibilities are endless.
@@ -226,6 +263,7 @@ Reload code with [clj-reload](https://github.com/tonsky/clj-reload):
226263
"args": {"code": "(clj-reload.core/reload)"}}
227264
```
228265

266+
229267
## Transforming code before eval
230268

231269
You can also modify eval to run a transformed version of code under cursor/inside selection.
@@ -289,10 +327,12 @@ Run test under cursor at work:
289327

290328
![](./screenshots/test_under_cursor.gif)
291329

330+
292331
## Clearing results
293332

294333
Finally, to clear evaluation results run `Clojure Sublimed: Clear Evaluation Results`.
295334

335+
296336
## Editing settings
297337

298338
To edit settings, run `Preferences: Clojure Sublimed Settings` command.
@@ -311,6 +351,7 @@ in `Clojure Sublimed.sublime-settings` becomes
311351

312352
in `Preferences.sublime-settings`. Settings from `Preferences.sublime-settings` take priority.
313353

354+
314355
## Session-wide settings
315356

316357
It is sometimes desirable to set dynamic Clojure vars for the whole session. To do that, edit `"eval_shared"` setting. For example:
@@ -321,6 +362,7 @@ It is sometimes desirable to set dynamic Clojure vars for the whole session. To
321362

322363
This will be applied to every evaluation.
323364

365+
324366
# Default Key Bindings
325367

326368
Clojure Sublimed comes with no keybindings enabled by default to guarantee they won’t conflict with any other extension (Sublime Text’s limitation).

messages/4.0.0.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Clojure Sublimed 4.0.0
2+
----------------------
3+
4+
Two major new features:
5+
6+
# Code formatting
7+
8+
By default, Clojure Sublimed uses [Better Clojure Formatting style](https://tonsky.me/blog/clojurefmt/).
9+
10+
Starting with 4.0.0, you can switch to `cljftm` instead:
11+
12+
- Download `cljfmt` binary from `https://github.com/weavejester/cljfmt/releases/latest`
13+
- Add `cljfmt` to `$PATH`
14+
- In Sublime Text, open `Preferences: Settings`
15+
- Add `"clojure_sublimed_formatter": "cljfmt"`
16+
17+
# Color scheme
18+
19+
4.0.0 ships major improvement in syntax definitons for Clojure.
20+
21+
To make best use of them, we now offer color scheme that makes use of many of these features.
22+
23+
- Cmd/Ctrl + Shift + P (Command Palette)
24+
- `UI: Select Color Scheme`
25+
- Select `Auto` -> `Clojure Sublimed Light` -> `Clojure Sublimed Dark`
26+
27+
These color schemes will work for other languages, too.

messages/install.txt

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,84 @@
11
Hi there! Thank you for installing Clojure Sublimed.
22

3-
A few important points to help you get started:
3+
How to get started:
44

5-
- Assign `Clojure (Sublimed)` syntax to your Clojure files: `View` → `Syntax` → `Open all with current extension as...` → `Clojure Sublimed` → `Clojure (Sublimed)` (this step is required for everything else to work)
6-
- Make sure you have nREPL version 0.8+
7-
- Connect using `Clojure Sublimed: Connect`
8-
- Configure key bindings using `Preferences: Clojure Sublimed Key Bindings`
5+
6+
Associate syntax with *.clj* files (only needs to be done once)
7+
---------------------------------------------------------------
8+
9+
For each file type (.clj, .cljs, .cljc, .edn) do:
10+
11+
- Open any file with that extension
12+
- Go to menu -> `View` → `Syntax` → `Open all with current extension as...`
13+
- Select `Clojure (Sublimed)`
14+
15+
16+
Key bindings
17+
------------
18+
19+
Sublime has no good way to ship optional key bindings with plugin. So
20+
21+
- Cmd/Ctrl + Shift + P (Command Palette)
22+
- `Preferences: Clojure Sublimed Key Bindings`
23+
- Copy examples from the left to your config on the right
24+
25+
I recomment at least:
26+
27+
- Evaluate
28+
- Evaluate Buffer
29+
- Interrupt Pending Evaluations
30+
- Clear Evaluation Results
31+
- Reindent
32+
- Insert New Line
33+
34+
35+
Code formatting
36+
---------------
37+
38+
By default, Clojure Sublimed uses [Better Clojure Formatting style](https://tonsky.me/blog/clojurefmt/).
39+
40+
If you want to use `cljftm`:
41+
42+
- Download `cljfmt` binary from `https://github.com/weavejester/cljfmt/releases/latest`
43+
- Add `cljfmt` to `$PATH`
44+
- In Sublime Text, open `Preferences: Settings`
45+
- Add `"clojure_sublimed_formatter": "cljfmt"`
46+
47+
Color scheme
48+
------------
49+
50+
If you want to try our color scheme:
51+
52+
- Cmd/Ctrl + Shift + P (Command Palette)
53+
- `UI: Select Color Scheme`
54+
- Select `Auto` -> `Clojure Sublimed Light` -> `Clojure Sublimed Dark`
55+
56+
These color schemes will work for other languages, too.
57+
58+
59+
Running your app
60+
----------------
61+
62+
Clojure Sublimed will not run your app for you. A few alternatives instead:
63+
64+
- Use separate terminal app
65+
- Terminus plugin
66+
- Sublime Executor plugin
67+
68+
69+
Connecting to REPLs
70+
-------------------
71+
72+
Depending on what type of REPL your run, use following commands:
73+
74+
- JVM nREPL → `Clojure Sublimed: Connect to nREPL JVM`
75+
- Shadow CLJS client-side → `Clojure Sublimed: Connect to shadow-cljs`
76+
- Shadow CLJS server-side → `Clojure Sublimed: Connect to raw nREPL`
77+
- Socket REPL on JVM → `Clojure Sublimed: Connect to Socket REPL`
78+
- Any other nREPL (babashka, sci, ...) → `Clojure Sublimed: Connect to raw nREPL`
79+
80+
Clojure Sublimed can only run one REPL connection per window.
81+
82+
Minimal supported nREPL version is 0.9.
983

1084
Read more at https://github.com/tonsky/Clojure-Sublimed/blob/master/README.md

screenshots/scheme.png

239 KB
Loading

screenshots/syntaxes.png

105 KB
Loading

0 commit comments

Comments
 (0)