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.
- Host: GitHub
- URL: https://github.com/chambln/kakoune-smart-quotes
- Owner: chambln
- License: mit
- Created: 2019-10-22T03:59:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T21:07:39.000Z (over 5 years ago)
- Last Synced: 2025-02-14T11:26:51.282Z (over 1 year ago)
- Topics: kakoune, plugin, smart-quotes
- Homepage:
- Size: 27.3 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
[](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).