ChangeQuotes
Converts single to double or double to single quotes. Attempts to preserve correct escaping, though this could be improved I'm sure.
Details
Installs
- Total 50K
- Win 21K
- Mac 18K
- Linux 10K
Dec 30 | Dec 29 | Dec 28 | Dec 27 | Dec 26 | Dec 25 | Dec 24 | Dec 23 | Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 1 | 0 | 1 | 1 | 2 | 3 | 5 | 1 | 2 | 0 | 1 | 3 | 0 | 1 | 3 | 1 | 3 | 3 | 2 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 2 | 1 | 1 | 6 | 1 | 0 | 0 | 0 | 0 | 1 | 2 | 7 | 1 | 0 | 4 | 2 | 0 | 6 |
Mac | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 1 | 0 | 2 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 | 2 | 2 | 0 | 0 | 1 | 2 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 1 | 0 | 1 | 2 | 0 |
Readme
- Source
- raw.githubusercontent.com
ChangeQuotes
Converts single to double or double to single quotes. Attempts to preserve correct escaping, though this could be improved I'm sure.
Installation
- Using Package Control, install “ChangeQuotes”
Or:
Open the Sublime Text Packages folder
- OS X: ~/Library/Application Support/Sublime Text 3/Packages/
- Windows: %APPDATA%/Sublime Text 3/Packages/
- Linux: ~/.Sublime Text 3/Packages/ or ~/.config/sublime-text-3/Packages
Clone this repo
Keymaps
Put the following inside your .sublime_keymap
(Sublime Text
-> Preferences
-> Key Bindings
):
{ "keys": ["ctrl+shift+'"], "command": "change_quotes" }
Now you can toggle quotes with CTRL
+Shift
+'
.
How to use
Put your cursor inside the text that is in quotes and then execute the command to replace the quotes. No selection needed.
How to customize
Different languages have different quotes, and this plugin tries to support them all!
Open up ChangeQuotes.sublime-settings
to see the default config. You can get
there from the menu bar:
Preferences > Package Settings > Change Quotes > Settings - Default
There are two per-language settings you should pay attention to:
prefixes
- This helps with the string searching; in python, a string can start
with an identifier like u
or r
, and these will be “skipped” when changing
quotes.
quotes
- This list-of-lists defines all the quote characters that can be
cycled. If you are using ES6, and want to add support for backtick-strings /
interpolation-strings, you just need to add the backtick character to this list!
// without backtick-strings:
"source.js": {
"quotes": [["'", "\""]]
}
// with backtick-string support (ES6-only):
"source.js": {
"quotes": [["'", "\"", "`"]]
}
Commands
change_quotes
: Converts from single to double quotes. Uses the Sublime Text
grammar parsing, so it doesn't always “find” the quotes, for instance MarkDown
doesn't define special “string” syntax, and so this plugin can't be used. The
upside is we don't have to write / maintain a complex matching quote algorithm.