← Back to Documentation

Editor Setup for Cure String Literals

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.

Quick Reference

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' |

Operating System Methods

macOS

System-wide Keyboard Shortcuts: Text Substitution (Automatic):
  1. Open System Preferences → Keyboard → Text
  2. Add entries:

Linux

Compose Key Method:
  1. Set a compose key in your keyboard settings
  2. Use sequences:
XKB Custom Layout:

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"

Windows

AutoHotkey Script:

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.

Editor-Specific Configurations

VS Code

Method 1: Custom Keybindings

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:

Vim/Neovim

Method 1: Insert Mode Mappings

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 '

Emacs

Method 1: Custom Keybindings

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

Sublime Text

Method 1: Key Bindings

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

IntelliJ IDEA / WebStorm

Live Templates:
  1. Go to Settings → Editor → Live Templates
  2. Create new template group "Cure"
  3. Add template:
Keymap:
  1. Settings → Keymap
  2. Search for "Insert Live Template"
  3. Add shortcut: Alt+[ for ', Alt+] for '

Atom

Snippets:

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'

Language Server / LSP Support

If you're using a Cure language server, it can provide:

Auto-Closing Pairs: Snippet Completion: Diagnostics:

Copy-Paste Method

If configuring your editor is too complex, you can:

  1. Create a file snippets.txt with commonly-used patterns:
   '' (empty charlist)
   'hello'
   'world'
   
  1. Copy-paste as needed
  1. Or use a clipboard manager with pre-configured snippets

Testing Your Setup

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:

Troubleshooting

Characters Not Displaying

Issue: Curly quotes show as boxes or question marks Solution: Ensure your editor uses a Unicode-aware font:

Incorrect Character Inserted

Issue: Wrong Unicode character inserted Solution:

Auto-Pairing Conflicts

Issue: Editor's auto-pairing interferes with charlist quotes Solution:

Alternative: ASCII Syntax (Not Recommended)

If 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.

Contributing

Found a better method for your editor? Please contribute:

  1. Fork the Cure repository
  2. Update this document with your configuration
  3. Submit a pull request

See CONTRIBUTING.md for guidelines.

Resources

Support

Need help configuring your editor?

Happy coding! 🎉