{"id":13706160,"url":"https://github.com/preservim/vim-textobj-quote","last_synced_at":"2025-04-11T02:09:51.544Z","repository":{"id":13937160,"uuid":"16636874","full_name":"preservim/vim-textobj-quote","owner":"preservim","description":"Use ‘curly’ quote characters in Vim","archived":false,"fork":false,"pushed_at":"2023-10-13T19:42:25.000Z","size":68,"stargazers_count":125,"open_issues_count":12,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T02:09:46.792Z","etag":null,"topics":["prose","vim","vim-plugin","vim-textobj-user","writing"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/preservim.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-08T05:36:28.000Z","updated_at":"2025-03-06T04:09:22.000Z","dependencies_parsed_at":"2024-11-13T14:45:49.769Z","dependency_job_id":null,"html_url":"https://github.com/preservim/vim-textobj-quote","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preservim%2Fvim-textobj-quote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preservim%2Fvim-textobj-quote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preservim%2Fvim-textobj-quote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preservim%2Fvim-textobj-quote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/preservim","download_url":"https://codeload.github.com/preservim/vim-textobj-quote/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328160,"owners_count":21085261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["prose","vim","vim-plugin","vim-textobj-user","writing"],"created_at":"2024-08-02T22:00:52.692Z","updated_at":"2025-04-11T02:09:51.521Z","avatar_url":"https://github.com/preservim.png","language":"Vim Script","readme":"# vim-textobj-quote\n\n[![Vader](https://github.com/preservim/vim-textobj-quote/workflows/Vader/badge.svg)](https://github.com/preservim/vim-textobj-quote/actions?workflow=Vader)\n[![Vint](https://github.com/preservim/vim-textobj-quote/workflows/Vint/badge.svg)](https://github.com/preservim/vim-textobj-quote/actions?workflow=Vint)\n\n\u003e “Extending Vim to better support typographic (‘curly’) quote characters.”\n\nWhile Vim is renowned for its text manipulation capabilities, it\nnevertheless retains a bias towards ASCII that stretches back to its vi\nroots on Unix. This can limit Vim’s appeal for those who prefer\ntypographic characters like “curly quotes” over ASCII \"straight quotes\" in\nthe prose and documentation they write.\n\nCore features of this plugin:\n\n* Text object supporting “typographic quotes”, incl. motion commands\n* Implemented with regular expressions via the [kana/vim-textobj-user][vt] plugin\n* Supports quoted strings containing contractions (`“don’t”`, e.g.)\n* Configurable to support [international variations in quotation marks][iq]\n\n[iq]: http://en.wikipedia.org/wiki/International_variation_in_quotation_marks\n\nIncludes four additional features:\n\n* _educate_ - automatic entry of ‘typographic quotes’ from the 'straight quote' keys\n* _replace_ - transform quotes from straight to typographic, and vice versa\n* _matchit_ - `%` matching for typographic quote pairs\n* _surround_ - surround a word or visual selection with quotes\n\n## Requirements\n\nRequires a recent version of Vim compiled with Unicode support.\n\n## Installation\n\nInstall using Pathogen, Vundle, Neobundle, or your favorite Vim package\nmanager.\n\nThis plugin has an essential dependency that you will need to install:\n\n* [kana/vim-textobj-user][vt] - a Vim plugin to create your own text objects without pain\n\n[vt]: https://github.com/kana/vim-textobj-user\n\n## Configuration\n\nBecause you won't want typographic quotes in your code, the behavior of\nthis plugin can be configured per file type. For example, to enable\ntypographic quote support in `markdown` and `textile` files, place in your\n`.vimrc`:\n\n```vim\nset nocompatible\nfiletype plugin on       \" may already be in your .vimrc\n\naugroup textobj_quote\n  autocmd!\n  autocmd FileType markdown call textobj#quote#init()\n  autocmd FileType textile call textobj#quote#init()\n  autocmd FileType text call textobj#quote#init({'educate': 0})\naugroup END\n```\n\nThe last `autocmd` statement initializes the plugin for buffers of `text`\nfile type, but disables the ‘educate’ feature by default. More on that\nbelow.\n\n## Motion commands\n\nMotion commands on text objects are a powerful feature of Vim.\n\nBy default, for motion commands, `q` denotes an operation on “double”\nquotes. `Q` for ‘single’ quotes. For example, with the `c` change\noperator:\n\n* `caq` - change _around_ “double” quotes - includes quote chars\n* `ciq` - change _inside_ “double” quotes - excludes quote chars\n* `caQ` - change _around_ ‘single’ quotes - includes quote chars\n* `ciQ` - change _inside_ ‘single’ quotes - excludes quote chars\n\nApart from `c` for change, you can `v` for visual selection, `d` for\ndeletion, `y` for yanking to clipboard, etc. Note that count isn’t\nsupported at present (due to limitations of the underlying\nvim-textobj-user) but repeat with `.` should work.\n\n_quote_’s motion command is smart too, able to distinguish between an\napostrophe and single closing quote, even though both are represented by\nthe same glyph. For example, try out `viQ` on the following sentence:\n\n```\n‘Really, I’d rather not relive the ’70s,’ said zombie Elvis.\n```\n\nYou can change these key mappings from their defaults in your `.vimrc`:\n\n```vim\nlet g:textobj#quote#doubleMotion = 'q'\nlet g:textobj#quote#singleMotion = 'Q'\n```\n\n## Additional features\n\nThe four additional features of this plugin include: _educate_, _matchit_,\n_replace_, and _surround_.\n\n### Educate\n\nThis plugin will ‘educate’ quotes, meaning that while in _Insert_ mode,\nyour straight quote key presses (`\"` or `'`) will be dynamically\ntransformed into the appropriate typographic quote characters.\n\nFor example, entering the following sentence without the _educate_ feature\nusing the straight quote keys:\n\n```\n\"It's Dr. Evil. I didn't spend six years in Evil Medical\nSchool to be called 'mister,' thank you very much.\"\n```\n\nAs expected all the quotes are straight ones. But with the _educate_\nfeature, the straight quotes are transformed into the typographic\nequivalent as you type:\n\n```\n“It’s Dr. Evil. I didn’t spend six years in Evil Medical\nSchool to be called ‘mister,’ thank you very much.”\n```\n\nYou can configure the default settings for the _educate_ feature in your\n`.vimrc`:\n\n```vim\nlet g:textobj#quote#educate = 1       \" 0=disable, 1=enable (def)\n```\n\nYou can change educating behavior with the following commands:\n\n* `Educate`\n* `NoEducate`\n* `ToggleEducate`\n\nAs seen above, educating behavior can be configured as a parameter in the\n`textobj#quote#init()` call.\n\n#### Entering straight quotes\n\nIn some cases, straight (ASCII) quotes are needed, such as:\n\n```\n“print \"Hello World!\"” is a simple program you can write in Python.\n```\n\nTo insert a straight quote while educating, enter `«Ctrl-V»` (mnemonic is\n_verbatim_) before the quote key:\n\n* `«Ctrl-V» \"` - straight double quote\n* `«Ctrl-V» '` - straight single quote\n\nNote that for units of measurement you’ll want to use the prime symbol(s)\nrather than straight quotes, as in:\n\n```\nStanding at 7′3″ (2.21 m), Hasheem Thabeet of the Oklahoma City Thunder\nis the tallest player in the NBA.\n```\n\n### Matchit support\n\n_matchit_ enables jumping to matching typographic quotes.\n\n* `%` - jump to the matching typographic (curly) quote character\n\nYou can configure this feature in your `.vimrc`:\n\n```vim\nlet g:textobj#quote#matchit = 1       \" 0=disable, 1=enable (def)\n```\n\n### Replace support\n\nYou can replace straight quotes in existing text with curly quotes, and\nvisa versa. Add key mappings of your choice to your `.vimrc`:\n\n```vim\nmap \u003csilent\u003e \u003cleader\u003eqc \u003cPlug\u003eReplaceWithCurly\nmap \u003csilent\u003e \u003cleader\u003eqs \u003cPlug\u003eReplaceWithStraight\n```\n\nBoth _Normal_ and _Visual_ modes are supported by this feature. (In\n_Normal_ mode, quotes in the current paragraph are replaced.)\n\nTo transform all quotes in a document, use _Visual_ mode to select the\nentire document.\n\n### Surround support\n\nBy default there are no key mappings for `surround` support.\n\n#### Basic support\n\nThis feature supports basic surround capabilities. Add to your `.vimrc`\nkey mappings of your choice:\n\n```vim\n\" NOTE: remove these mappings if using the tpope/vim-surround plugin!\nmap \u003csilent\u003e Sq \u003cPlug\u003eSurroundWithDouble\nmap \u003csilent\u003e SQ \u003cPlug\u003eSurroundWithSingle\n```\n\nThen you can use ‘motion commands’ to surround text with quotes:\n\n(an asterisk is used to denote the cursor position)\n\n* `visSq` - My senten\\*ce. =\u003e “My sentence.”\n* `visSQ` - My senten\\*ce. =\u003e ‘My sentence.’\n\n#### Using Tim Pope’s vim-surround\n\nUsing Tim Pope’s [vim-surround][] plugin your text object key mappings\nshould be available. For example,\n\n* `cs'q` - 'Hello W\\*orld' =\u003e “Hello World”\n* `cs\"q` - \"Hello W\\*orld\" =\u003e “Hello World”\n* `cs(q` - (Hello W\\*orld) =\u003e “Hello World”\n* `cs(Q` - (Hello W\\*orld) =\u003e ‘Hello World’\n\n[vim-surround]: https://github.com/tpope/vim-surround\n\n## Entering special characters\n\nSometimes you must enter special characters (like typographic quotes)\nmanually, such as in a search expression. You can do so through Vim’s digraphs\nor via your operating system’s keyboard shortcuts.\n\n| Glyph | Vim Digraph | OS X               | Description\n| ----- | ----------- | ------------------ | ----------------------------\n| `‘`   | `'6`        | `Opt-]`            | left single quotation mark\n| `’`   | `'9`        | `Shift-Opt-]`      | right single quotation mark\n| `“`   | `\"6`        | `Opt-[`            | left double quotation mark\n| `”`   | `\"9`        | `Shift-Opt-[`      | right double quotation mark\n| `‚`   | `.9`        |                    | single low-9 quote\n| `„`   | `:9`        | `Shift-Opt-w`      | double low-9 quote\n| `‹`   | `1\u003c`        | `Opt-\\`            | left pointing single quotation mark\n| `›`   | `1\u003e`        | `Shift-Opt-\\`      | right pointing single quotation mark\n| `«`   | `\u003c\u003c`        | `Opt-\\`            | left pointing double quotation mark\n| `»`   | `\u003e\u003e`        | `Shift-Opt-\\`      | right pointing double quotation mark\n| `′`   | `1'`        |                    | single prime\n| `″`   | `2'`        |                    | double prime\n| `–`   | `-N`        | `Opt-hyphen`       | en dash\n| `—`   | `-M`        | `Shift-Opt-hyphen` | em dash\n| `…`   | `,.`        | `Opt-;`            | horizontal ellipsis\n| ` `   | `NS`        |                    | non-breaking space\n| `ï`   | `i:`        | `Opt-U` `i`        | lowercase i, umlaut\n| `æ`   | `ae`        | `Opt-'`            | lowercase ae\n\nFor example, to enter left double quotation mark `“`, precede the digraph code\n`\"6` with `Ctrl-K`, like\n\n* `«Ctrl-K» \"6`\n\nAlternatively, if you’re on OS X, you can use `Opt-[` to enter this\ncharacter.\n\nFor more details, see:\n\n* `:help digraphs`\n\n## International support\n\nMany international keyboards feature keys to allow you to input\ntypographic quote characters directly. In such cases, you won’t need to\nchange the behavior of the straight quote keys.\n\nBut if you do, you can override the defaults. For example, those users\nediting most of their prose in German could change those defaults to:\n\n```vim\nlet g:textobj#quote#doubleDefault = '„“'     \" „doppel“\nlet g:textobj#quote#singleDefault = '‚‘'     \" ‚einzel‘\n```\n\nOr on a file type initialization...\n\n```vim\naugroup textobj_quote\n  autocmd!\n  autocmd FileType markdown call textobj#quote#init({ 'double':'„“', 'single':'‚‘' })\n  ...\naugroup END\n```\n\nOr in a key mapping...\n\n```vim\nnnoremap \u003csilent\u003e \u003cleader\u003eqd :call textobj#quote#init({ 'double':'„“', 'single':'‚‘' })\u003ccr\u003e\n```\n\n## See also\n\nIf you find this plugin useful, check out these others originally by [@reedes][re]:\n\n* [vim-colors-pencil][cp] - color scheme for Vim inspired by IA Writer\n* [vim-lexical][lx] - building on Vim’s spell-check and thesaurus/dictionary completion\n* [vim-litecorrect][lc] - lightweight auto-correction for Vim\n* [vim-pencil][pn] - rethinking Vim as a tool for writers\n* [vim-textobj-sentence][ts] - improving on Vim's native sentence motion command\n* [vim-thematic][th] - modify Vim’s appearance to suit your task and environment\n* [vim-wheel][wh] - screen-anchored cursor movement for Vim\n* [vim-wordy][wo] - uncovering usage problems in writing\n* [vim-wordchipper][wc] - power tool for shredding text in Insert mode\n\n[re]: http://github.com/reedes\n[cp]: http://github.com/preservim/vim-colors-pencil\n[lc]: http://github.com/preservim/vim-litecorrect\n[lx]: http://github.com/preservim/vim-lexical\n[pn]: http://github.com/preservim/vim-pencil\n[th]: http://github.com/preservim/vim-thematic\n[ts]: http://github.com/preservim/vim-textobj-sentence\n[wc]: http://github.com/preservim/vim-wordchipper\n[wh]: http://github.com/preservim/vim-wheel\n[wo]: http://github.com/preservim/vim-wordy\n\n## Future development\n\nIf you’ve spotted a problem or have an idea on improving this plugin,\nplease post it to the [GitHub project issue page][issues].\n\n[issues]: https://github.com/preservim/vim-textobj-quote/issues\n\n\u003c!-- vim: set tw=74 :--\u003e\n","funding_links":[],"categories":["plugins for writing","Vim Script"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreservim%2Fvim-textobj-quote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreservim%2Fvim-textobj-quote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreservim%2Fvim-textobj-quote/lists"}