Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5.4 KiB
Klammertext for Sublime Text
A Sublime Text port of the Emacs major mode for Klammertext
(doc/emacs/klammertext-mode.el). It brings syntax highlighting, delimiter
matching, and comment toggling to .kt and .k files. Behavior mirrors the
Emacs mode closely; where the two intentionally differ, the file headers say so.
Files
| File | Purpose |
|---|---|
Klammertext.sublime-syntax |
Syntax highlighting. Colors the text-removal constructs (#, ##, #[...]#) and the three @-tiers — application @, definition @@, system @@@ — each as an opening vs. a close, plus ^-escapes and verbatim @code ... code@ spans. |
Klammertext.py |
Plugin with two features that share one context-sensitive matcher: jump between an opening and its close, and live highlighting of the matching delimiter as the caret moves (mismatched or unbalanced delimiters flag in red). |
Default.sublime-keymap |
Binds jump-to-match to Ctrl+M, scoped to Klammertext files. |
Comments.tmPreferences |
Comment toggling: Ctrl+/ inserts # (line removal), Ctrl+Shift+/ wraps in #[ ... ]# (block removal). |
Breakers / Celeste / Mariana / Monokai / Sixteen .sublime-color-scheme |
Color overrides for Sublime's five built-in schemes — one hue system, full intensity on the dark schemes, scaled down on the light ones. Additive: they recolor only the Klammertext delimiters and leave the rest of each scheme unchanged. |
Klammertext_in_Sublime_Text.md |
This file. |
Installation
Put the files into a folder named Klammertext under Sublime's Packages
directory:
| Platform | Path |
|---|---|
| Linux | ~/.config/sublime-text/Packages/Klammertext/ |
| macOS | ~/Library/Application Support/Sublime Text/Packages/Klammertext/ |
| Windows | %AppData%\Sublime Text\Packages\Klammertext\ |
The quickest way to find it: Preferences → Browse Packages… opens the
Packages directory. Create the Klammertext folder there and copy the files
in. Sublime loads them live — no restart — and applies the syntax to .kt and
.k files automatically.
Use a dedicated folder (not Packages/User/) so the bundled keymap does not
merge into your personal one. If you want highlighting only, the
.sublime-syntax file alone works from Packages/User/.
The plugin targets Sublime Text 4: the live-highlight colors use Sublime's
adaptive region.* scopes, which were added in ST4.
Features and keys
| Trigger | Action |
|---|---|
open a .kt / .k file |
Syntax highlighting (automatic) |
| Ctrl+M | Jump between a klammer application's opening and closing @ (equivalent of the Emacs mode's C-c C-j) |
caret on a klammer @ |
The matching delimiter boxes automatically; a name mismatch or unbalanced delimiter boxes in red with a status-bar message (equivalent of show-paren-mode) |
| Ctrl+/ | Toggle line comment (#) |
| Ctrl+Shift+/ | Toggle block comment (#[ ... ]#) |
Ctrl+M is Sublime's own "go to matching bracket" key, reused here because the
built-in cannot match Klammertext's context-dependent @. macOS users who
prefer super+m can change it in Default.sublime-keymap.
Colors
Colors are installed automatically for all five of Sublime's built-in schemes.
Each *.sublime-color-scheme file (Breakers, Celeste, Mariana, Monokai,
Sixteen) is an additive override: Sublime merges it onto the matching scheme
by filename, recoloring only the Klammertext delimiters and leaving everything
else untouched. There is nothing to set up.
All five share one hue system — application blue, definition green, system orange, each opening bright and its close the same hue darker — shown at full intensity on the dark schemes (Monokai, Mariana) and scaled down for contrast on the light schemes (Breakers, Celeste, Sixteen). Removed text uses each scheme's own comment grey.
For any other scheme — a legacy .tmTheme such as Solarized, or a third-party
scheme — copy one of the included files to <Scheme Name>.sublime-color-scheme
in the package folder (its name is shown at Preferences → Settings under
color_scheme), choosing a light or dark source file to match the ground. The
exact values are in each file's header comment.
Keeping literal klammers in sync
Klammers whose content is verbatim (@code ... code@) are listed in three
places that must agree — a Sublime syntax/plugin cannot read the Emacs
defcustom, so the list is duplicated:
klammertext-literal-klammersindoc/emacs/klammertext-mode.el(the source of truth)LITERAL_KLAMMERSinKlammertext.py- the
@coderule andliteral_codecontext inKlammertext.sublime-syntax
All three are seeded with just code. When you add or remove a literal
klammer, change all three.
Not included
Whole-file semantic validation — persistent error underlines when the cursor is elsewhere, klammer-name completion, go-to-definition — is not part of this package. That would need a language server (used through the Sublime LSP package), a separate program, and is unrelated to the highlighting and matching provided here.
Troubleshooting
If the plugin does not seem to load, open View → Show Console for any error
message. Check that the files sit directly inside Packages/Klammertext/ (not
a nested subfolder) and that the current file's syntax reads "Klammertext" in
the status bar at the bottom-right of the window.