This guide helps you configure your editor to easily input Unicode curly quotes (' and ') for Cure charlist literals.
> Implementation Status: Charlist literals with Unicode curly quotes are fully implemented in the Cure lexer and tested (see test/stringlexertest.erl). However, in practice, most Cure code uses regular strings ("hello") for text. Charlists are primarily for Erlang interoperability when needed.
Cure uses different quote characters for different purposes:
| Character | Unicode | Usage | Example |
|-----------|---------|-------|---------|
| " | U+0022 | String literals | "hello" |
| ' | U+2018 | Charlist start | 'hello' |
| ' | U+2019 | Charlist end | 'hello' |
| : | U+003A | Atoms (recommended) | :my_atom |
| ' | U+0027 | Atoms (alternative) | 'my_atom' |
': Option + ]': Option + Shift + ]'' → With: '' (two single curly quotes)' (left): Compose < '' (right): Compose > 'Create a custom keyboard layout in ~/.config/xkb/symbols/custom:
partial alphanumeric_keys
xkb_symbols "cure_quotes" {
include "us(basic)"
key { [ apostrophe, quotedbl, U2018, U2019 ] };
};
Apply with: setxkbmap -option "custom:cure_quotes"
Save as cure_quotes.ahk:
; Cure Charlist Quotes
; Press Alt+[ for left curly quote
; Press Alt+] for right curly quote
![ ::SendInput {U+2018} ; Alt+[
!] ::SendInput {U+2019} ; Alt+]
Run the script on startup.
Add to keybindings.json:
[
{
"key": "alt+[",
"command": "type",
"args": { "text": "'" },
"when": "editorTextFocus && editorLangId == 'cure'"
},
{
"key": "alt+]",
"command": "type",
"args": { "text": "'" },
"when": "editorTextFocus && editorLangId == 'cure'"
}
]
Method 2: Snippets
Add to Cure language snippets:
{
"Charlist Literal": {
"prefix": "cl",
"body": "'$1'",
"description": "Insert charlist literal with curly quotes"
}
}
Method 3: Text Expander Extension
Install an extension like "Text Expander" and configure:
'c → ' (left curly quote)c' → ' (right curly quote)Add to .vimrc or init.vim:
" Cure charlist quotes
inoremap '
inoremap '
" Or use digraphs (Ctrl+K followed by code)
" '<' for U+2018, '>' for U+2019
Method 2: Abbreviations
" Auto-expand ''c to charlist quotes
autocmd FileType cure inoreabbrev ''c ''
Method 3: Custom Digraphs
digraphs c< 8216 " '<
digraphs c> 8217 " '>
Then use: Ctrl+K c < for '
Add to .emacs or init.el:
;; Cure charlist quotes
(define-key cure-mode-map (kbd "M-[")
(lambda () (interactive) (insert "'")))
(define-key cure-mode-map (kbd "M-]")
(lambda () (interactive) (insert "'")))
Method 2: Abbrev Mode
(define-abbrev cure-mode-abbrev-table "'c" "''")
Method 3: YASnippet
Create cure-mode/charlist.yasnippet:
# -_- mode: snippet -_-
# name: charlist
# key: cl
# --
'$1'$0
Add to Preferences → Key Bindings:
[
{
"keys": ["alt+["],
"command": "insert_snippet",
"args": {"contents": "'"}
},
{
"keys": ["alt+]"],
"command": "insert_snippet",
"args": {"contents": "'"}
}
]
Method 2: Snippets
Create cure-charlist.sublime-snippet:
cl
source.cure
Charlist Literal
cl'$END$'', Alt+] for 'Add to snippets.cson:
'.source.cure':
'Charlist Literal':
'prefix': 'cl'
'body': "'$1'"
Keybindings:
Add to keymap.cson:
'atom-text-editor[data-grammar="source cure"]':
'alt-[': 'snippets:insert-text-left-curly-quote'
'alt-]': 'snippets:insert-text-right-curly-quote'
If you're using a Cure language server, it can provide:
Auto-Closing Pairs:' automatically inserts 'char or cl → charlist literal template' for charlistsIf configuring your editor is too complex, you can:
snippets.txt with commonly-used patterns: '' (empty charlist)
'hello'
'world'
Create a test file test.cure:
module Test do
export [main/0]
import Std.Io [println/1]
def main(): Int =
# String literal (straight quotes)
let str = "hello"
println(str)
# Charlist literal (curly quotes) - stores as [104, 101, 108, 108, 111]
# let chars = 'hello'
# Atom (ASCII single quote)
let atom = :my_atom
0
end
Verify:
"hello" → String (UTF-8 binary)'hello' → Charlist (list of Unicode codepoints: [104, 101, 108, 108, 111]):my_atom → Atom (recommended syntax)'my_atom' → Atom (alternative ASCII single quote syntax)xxd or a Unicode inspector to verify charactersIf Unicode input is impossible in your environment, you can use ASCII single quotes for atoms instead:
# ASCII single quote for atoms (fully supported)
atom = 'my_atom'
# Or use colon prefix (recommended)
atom = :my_atom
Note: Charlists with Unicode curly quotes are implemented and tested in the compiler (see test/stringlexertest.erl), but are rarely used in practice. Most Cure code uses strings ("hello") for text and atoms (:atom) for symbolic values.
Found a better method for your editor? Please contribute:
See CONTRIBUTING.md for guidelines.
Need help configuring your editor?
Happy coding! 🎉