Editor extensions
Editor support covers both halves of a program: Tungsten kernels (.w) and Paint layouts
(.paint).
| Language | Visual Studio Code | Vim |
|---|---|---|
| Tungsten | Syntax highlighting, comment and bracket handling, and Unicode symbols typed by name | File detection, syntax highlighting, and optional Unicode input mappings |
| Paint | Syntax highlighting, and comment and bracket handling | File detection and syntax highlighting |
Getting the extensions: download the experimental SDK.
Visual Studio Code
Tungsten
The experimental SDK holds the extension unpacked, in <sdk>/share/tungsten/syntax_highlight/vscode/,
where <sdk> is the SDK's directory. Install it in the Visual Studio Code on your own machine: copy
that directory to ~/.vscode/extensions/tungsten there, and restart Visual Studio Code. In a Remote SSH window it runs there
too, so completions don't wait on the network.
The extension opens .w files as Tungsten. It highlights the language, comments lines with //
and blocks with /* */, and matches brackets, including a half-open range's [ and ). To see
which version is installed, open View › Output and choose Tungsten in the output list.
Unicode symbols by name
In a Tungsten file, type a backslash and a symbol's name, then pick the symbol from the completion
list. For example, \forall gives ∀. The list opens at the backslash and shows each symbol and
its meaning, and it narrows as you type. Picking an entry replaces the whole name, backslash
included, and leaves the text after it. Whether Tab or Enter accepts an entry follows your Visual
Studio Code suggestion keybindings.
Many symbols have more than one name: the usual LaTeX one and a shorter one. The operators and loop symbols:
| Names | Symbol | Meaning |
|---|---|---|
\forall, \all | ∀ | for all: loop prefix |
\in | ∈ | in: loop range |
\smallin | ∊ | in: loop range |
\leftarrow, \gets, \arrow | ← | assign (<-) |
\arrowplus | ←̟ | accumulate (<+-) |
\leftarrowplus | ⥆ | accumulate (<+-) |
\acc, \leftarrowonoplus | ⬲ | accumulate (<+-) |
\sum | ∑ | dot product sum |
\downarrow | ↓ | decreasing iterator |
\infty, \inf | ∞ | infinite iterator end (INF) |
\times | × | multiply (*) |
\oplus, \xor | ⊕ | xor (^) |
\bigoplus | ⨁ | xor (^) |
\wedge, \land | ∧ | logical and (&&) |
\vee, \lor | ∨ | logical or (||) |
\neg, \lnot | ¬ | logical not (!) |
\ne, \neq | ≠ | not equal (!=) |
\le, \leq | ≤ | less or equal (<=) |
\leqq | ≦ | less or equal (<=) |
\ge, \geq | ≥ | greater or equal (>=) |
\geqq | ≧ | greater or equal (>=) |
\sll, \twoheadmapsfrom | ⬶ | shift left (<<) |
\sar, \twoheadrightarrowtail | ⤖ | arithmetic shift right (x>>) |
\slr, \twoheadmapsto | ⤅ | logical shift right (>>) |
The list also has the characters a name can contain:
- Greek letters:
- every lowercase letter from
\alphato\omega, with\varepsilon(ε),\varphi(φ) and\varsigma(ς); - the uppercase letters that differ from Latin ones:
\Gamma,\Delta,\Theta,\Lambda,\Xi,\Pi,\Sigma,\Upsilon,\Phi,\Psiand\Omega; \nabla(∇), which can start a name.
- every lowercase letter from
- Superscripts and subscripts:
\^0to\^9give⁰to⁹, and\_0to\_9give₀to₉. - Marks:
\primegives′,\vecthe combining arrow above (v⃗), and\^Tthe transpose markᵀ.
Paint
The SDK holds it in <sdk>/share/paint/syntax_highlight/vscode/paint/; copy that directory to
~/.vscode/extensions/paint and restart Visual Studio Code.
The extension opens .paint files as Paint.
It highlights the language, comments blocks with (* *), and matches brackets.
Vim
The Vim support is plain syntax and ftdetect scripts for each language, which go in Vim's
standard syntax and ftdetect directories. The SDK holds them in
<sdk>/share/tungsten/syntax_highlight/vim/ and <sdk>/share/paint/syntax_highlight/vim/; copy
their syntax and ftdetect directories into ~/.vim/.
Restart Vim after installing them. .w files should report tungsten and .paint files should
report paint when you run :set filetype?.
Greek letters and mathematical symbols
The Tungsten Vim support provides an optional GreekKeymap() function
for your .vimrc. Once that function is installed, its buffer-local insert-mode mappings use a
colon prefix:
| Type in Insert mode | Inserts | Type in Insert mode | Inserts |
|---|---|---|---|
:alpha | α | :Alpha | Α |
:theta | θ | :Theta | Θ |
:phi | φ | :Phi | Φ |
:omega | ω | :Omega | Ω |
<- | ← | :prime | ′ |
:tilde | combining tilde ◌̃ | :hat | combining circumflex ◌̂ |
:: | literal : |
The mappings cover the Greek alphabet using the same lowercase/capitalized naming pattern shown above. They apply only to Tungsten buffers and are intentionally not enabled by the syntax plugin itself. Copy the complete function from the README rather than installing the examples in this table one at a time.
The keymap has no mapping for ∀, ∈ or ∞. Vim's built-in digraphs type them in Insert mode:
Ctrl-K FA gives ∀, Ctrl-K (- gives ∈, and Ctrl-K 00 gives ∞. Vim's =<
and >= digraphs give ≤ and ≥, which Tungsten reads as <= and >=.