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 47K
- Win 20K
- Mac 18K
- Linux 9K
Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | Mar 16 | Mar 15 | Mar 14 | Mar 13 | Mar 12 | Mar 11 | Mar 10 | Mar 9 | Mar 8 | Mar 7 | Mar 6 | Mar 5 | Mar 4 | Mar 3 | Mar 2 | Mar 1 | Feb 28 | Feb 27 | Feb 26 | Feb 25 | Feb 24 | Feb 23 | Feb 22 | Feb 21 | Feb 20 | Feb 19 | Feb 18 | Feb 17 | Feb 16 | Feb 15 | Feb 14 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 4 | 6 | 0 | 6 | 3 | 4 | 4 | 5 | 4 | 3 | 8 | 2 | 3 | 3 | 5 | 5 | 5 | 5 | 1 | 2 | 1 | 9 | 4 | 4 | 1 | 4 | 5 | 2 | 8 | 5 | 7 | 5 | 2 | 4 | 4 | 6 | 8 | 3 | 6 | 4 | 3 | 3 | 2 | 3 | 7 |
Mac | 0 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 3 | 2 | 4 | 3 | 3 | 0 | 3 | 2 | 2 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 2 | 1 | 3 | 4 | 2 | 1 | 1 | 2 | 3 | 1 | 0 |
Linux | 0 | 0 | 1 | 1 | 2 | 0 | 0 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 4 | 2 | 1 | 2 | 0 | 0 | 2 | 1 | 4 | 2 | 1 | 1 | 0 | 1 | 3 | 0 | 1 | 1 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 4 | 2 | 1 |
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.