An open API service indexing awesome lists of open source software.

https://github.com/chambln/kakoune-smart-quotes

Kakoune plugin that converts 'straight' "quotes" to ‘curly’ “quotes” as you type.
https://github.com/chambln/kakoune-smart-quotes

kakoune plugin smart-quotes

Last synced: 11 months ago
JSON representation

Kakoune plugin that converts 'straight' "quotes" to ‘curly’ “quotes” as you type.

Awesome Lists containing this project

README

          

# Smart quotes for Kakoune

This simple [Kakoune](https://kakoune.org) plugin converts
typewriter-style straight quotes to typographically pleasing curly
quotes as you type.

'example' → ‘example’
"example" → “example”
I'm → I’m

[![Demonstration of smart quoting in
Kakoune](https://asciinema.org/a/GbokpvZb5accDhJI7cXNEb3Gb.svg)](https://asciinema.org/a/GbokpvZb5accDhJI7cXNEb3Gb)

## Installation

### Manual

Put a copy of or link to `smart-quotes.kak` anywhere within
`~/.config/kak/autoload/`.

### [plug.kak](https://gitlab.com/andreyorst/plug.kak)

Suggested configuration:

``` kak
plug chambln/kakoune-smart-quotes config %{
map global insert ": smart-quotes-insert \' ‘ ’"
map global insert ': smart-quotes-insert \" “ ”'
hook global \
WinSetOption \
filetype=(mail|markdown|restructuredtext|git-commit) \
smart-quotes-enable
}
```

## Usage

Manually enable smart quoting in the current window:

:smart-quotes-enable

Enable smart quoting for one insert session:

:smart-quotes-modei

Always use smart quoting for e.g. reStructuredText:

``` kak
# ~/.config/kak/kakrc
hook global WinSetOption filetype=restructuredtext smart-quotes-enable
```

Use Alt to smartly insert a quote:

``` kak
# ~/.config/kak/kakrc
map global insert ": smart-quotes-insert \' ‘ ’"
map global insert ': smart-quotes-insert \" “ ”'
```

Or use guillemets instead:

``` kak
# ~/.config/kak/kakrc
map global insert ": smart-quotes-insert \' ‹ › "
map global insert ': smart-quotes-insert \" « » '
```

### Notes

- Repeated keypresses cycle opening, straight, and closing quotes.
- `` bypasses smart-quotes whereas `\i` does not.
- A contraction at the beginning of a word should have an apostrophe
(`’`), but smart-quotes will erroneously insert an opening quote
(`‘`) instead; e.g.
- `the ‘80s` (incorrect) instead of `the ’80s` (correct),
- `fish ‘n’ chips` (incorrect) instead of `fish ’n’ chips`
(correct).