Skip to content

Instantly share code, notes, and snippets.

@fearofcode
Last active July 9, 2022 22:57
Show Gist options
  • Save fearofcode/5da1f3edf0d97f4f354cc713c8f487f9 to your computer and use it in GitHub Desktop.
Save fearofcode/5da1f3edf0d97f4f354cc713c8f487f9 to your computer and use it in GitHub Desktop.
basic Sublime Text 4 Clojure setup: Clojure-Sublimed + LSP
[
// Evaluate
{"keys": ["ctrl+enter"],
"command": "clojure_sublimed_eval",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Evaluate Buffer
{"keys": ["ctrl+b"],
"command": "clojure_sublimed_eval_buffer",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Interrupt Pending Evaluations
{"keys": ["ctrl+alt+c"],
"command": "clojure_sublimed_interrupt_eval",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Toggle Info
{"keys": ["ctrl+alt+i"],
"command": "clojure_sublimed_toggle_info",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Clear Evaluation Results
{"keys": ["ctrl+alt+l"],
"command": "clojure_sublimed_clear_evals",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// // Extras
// Toggle Stacktrace
{"keys": ["ctrl+alt+e"],
"command": "clojure_sublimed_toggle_trace",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Toggle Symbol Info
{"keys": ["ctrl+alt+d"],
"command": "clojure_sublimed_lookup_symbol",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Copy Evaluation Result
{"keys": ["ctrl+c"],
"command": "clojure_sublimed_copy",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Require Namespace
{"keys": ["ctrl+alt+r"],
"command": "clojure_sublimed_require_namespace",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Reindent Lines
{"keys": ["ctrl+alt+f"],
"command": "clojure_sublimed_reindent_lines",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Reindent Buffer
{"keys": ["ctrl+alt+shift+f"],
"command": "clojure_sublimed_reindent_buffer",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Insert New Line
{"keys": ["enter"],
"command": "clojure_sublimed_insert_newline",
"context": [{"key": "selector", "operator": "equal", "operand": "source.edn | source.clojure"},
{"key": "auto_complete_visible", "operator": "equal", "operand": false},
{"key": "panel_has_focus", "operator": "equal", "operand": false}]},
]

these are simple settings for a nice REPL-driven setup. Clojure-Sublimed has nice REPL integration and the LSP will autocomplete stuff from libraries. there's some overlap but they both have separate functions I think

  • install sublime text 4
  • install package control in sublime text ui.
  • install https://github.com/tonsky/Clojure-Sublimed via package control
  • package control install terminus
  • install clojure lsp native image from https://github.com/clojure-lsp/clojure-lsp/releases
  • install Alabaster theme (referenced in LSP.sublime-settings, hence why an optional aesthetic thing is mentioned here) with Package Control
  • copy LSP settings from LSP.sublime-settings into Preferences > Package Settings > LSP > Settings window. adjust command path as needed depending on where you put the LSP binary/JAR
  • copy Clojure-Sublimed keybindings from Default (Windows).default-keymap into Preferences: Clojure Sublimed Key Bindings window
  • open Subime settings and copy Preferences.sublime-settings in

to get a nice repl going with your code:

  • lein new <app_name> to start a new app. open that folder in Sublime
  • set layout to columns: 2 (Vew > Layout > Columns: 2)
  • select Terminus: Open Default Shell in Tab (View) in column you want repl in
  • run lein repl in project directory
  • run Clojure Sublimed: Connect
  • now run Clojure Sublimed commands like Ctrl+Alt+B to evaluate buffer

optional:

  • install whatever color scheme you want and change to that

aww yeah

sorry if I forgot anything above

{
"lsp_format_on_save": true,
"show_code_actions": "",
"clients": {
"clojure-lsp": {
"enabled": true,
"command": ["C:/Users/warre/clojure-lsp.exe"],
"selector": "source.clojure",
"initializationOptions": {}
}
}
}
{
"theme": "auto",
"ignored_packages":
[
"Vintage",
],
"color_scheme": "Alabaster Dark Mono.sublime-color-scheme",
"font_size": 18,
"scroll_speed": 0,
"tree_animation_enabled": false,
"animation_enabled": false,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment