How to selectively disable atom from creating a matching single quote and and backtick? This helps in programming in Scheme.
I tried Settings>Package>Bracket Matcher, if I disable Autocomplete bracket then it also disables matching brackets and matching double quotes. I want matching brackets and matching double quotes but not matching single quotes.
EDIT: This feature is now available in Atom.
The feature that you want is now available. Just delete the quotes from the Autocomplete Characters in Bracket Matcher package settings.
Edit -> preferences
from left choose packages
there is a search bar at the top search for Bracket-Matcher
then press setting from right side
look foo settings section and in that section look for something called auto Brackets. Uncheck it.
Unfortunately, it's an all or nothing deal (as of version 0.82.0).
Unchecking the "Autocomplete Brackets" box means no autocompleted closing single/double quotes, brackets, backticks, or parentheses.
You could always log an issue (search first and make sure one doesn't already exist) and request that this feature be extended.
Related
I would like to select matching parentheses/braces/brackets in Sublime. I don't mean to select the text between them, I mean just them; parentheses. So you can change one type to another without going back and fort. Its like having 2 cursors at the same time on them.
Check out the BracketHighlighter plugin in Package Control. Among other features for highlighting various types of bracket pairs and tags, it includes:
Bracket plugins that can jump between bracket ends, select content, remove brackets and/or content, wrap selections with brackets, swap brackets, swap quotes (handling quote escaping between the main quotes), fold/unfold content between brackets, toggle through tag attribute selection, select both the opening and closing tag name to change both simultaneously, etc.
I've used some of the features of this plugin in the past and I really like it. The author is also very responsive to bug reports and feature requests.
How to enclose curly braces in parenthesis in vim?
Initial string:
{a: b}
Final string:
({a: b})
The string possibly span multilines:
{
a: b
}
Assuming you are in normal mode and on any curly bracket character (opening or closing).
The manual/vanilla version (without any bracketing plugin) would be
c%(^R")
With:
^R meaning CTRL+R
the default register (") being filled with the content of the dictionary.
ca{ that should be used instead of c% if you're anywhere within the dictionary.
With my lh-brackets plugin, I would use v%( or vi{( -- unlike the vanilla version, will leave the default register unmodified.
With the popular surround plugin, I guess (I may be wrong as I've been using my plugin for decades) it would be something like ys%( or ysa{(.
PS: the fact your dictionary spans on several lines doesn't make any difference here.
With the vim-surround plugin you can visually select the text first e.g. va{, then surround with parentheses using S). I find it easier to remember this visual surround sequence v{motion}S<char> than the other options
How can I highlight matches for single quotes ('quotes') and double quotes ("double quotes")?
I read the docs and I saw there is something for brackets and tags:
"brackets_options":"foreground",
"brackets_foreground":"var(orange)",
"bracket_contents_options":"foreground",
"bracket_contents_foreground":"var(orange)",
"tags_options":"foreground",
"tags_foreground":"var(orange)",
but didn't found any solution for quotes.
Is there any option like "quote_options" or something like that with the same behavior as for brackets and tags?
I know about BracketHighlighter but this plugin is so slow and I generally prefer native options
I am working with:
PHP, HTML, JS
Default Mariana color scheme
Default theme
Sublime Text ver.: 3
There is no option to highlight quotes, but you can select all between the quote tags by using Selection | Expand selection to Scope or shortcut Ctrl + Shift + Space if you are looking for some functionality to "see" everything between the quotes.
Example when you click somewhere in between the quotes and use above mentioned functionality:
With the syntax highlighting in vim, I get the handy feature where the matching paren or bracket will be highlighted when I put the cursor over it. Is it possible to do the same thing for quotes?
While not eloquent, one workaround is to select everything inside of matching quotes. You can do this by using the command:
vi"
This will select everything in-between the quotes. However, you won't get proper results with nested quotes as it will match the first found ".
The problem with quotes is that they are symmetrical. It would be very hard to determine which quotes belong with each other.
For instance: "Which \"quotes\" go with each other in this statement?"
This has been discussed on the vim mailing lists a few times, as well as in the bug trackers of a few of the auto-delimiter type plugins. In every case that I've seen, it's been decided that this is better left as is.
The solution is here: Stackoverflow in matchquote except it has the unfortunate limitation that only the current line is considered.
matchit seems to comes close by allowing defining of multi-line matches of words such as if/endif but still no multi-line possibility that I can figure out to get matching for " and '.
VIM already highlights quoted text in a different color, so you can easily identify strings. Do you really need it to match quotes when the whole string is already highlighted?
From :h matchparen
The characters to be matched come from the 'matchpairs' option. You
can change the value to highlight different matches. Note that not
everything is possible. For example, you can't highlight single or
double quotes, because the start and end are equal.
The % key is one of the best features of vim: it lets you jump from { to }, [ to ], and so on.
However, it does not work by default with quotes: Either " or ', probably because the opening and closing quote are the same character, making implementation more difficult.
Thinking a bit more about the problem, I'm convinced that it should be implemented, by counting if the number of preceding quotes is odd or even and jumping to the previous or next quote, accordingly.
Before I try to implement it myself, I'd just like to know if someone already has?
Depending on your reason for needing this, there may be a better way to accomplish what you're looking for. For example, if you have the following code:
foo(bar, "baz quux")
^
and your cursor happens to be at the ^, and you want to replace everything inside the quotes with something else, use ci". This uses the Vim "text objects" to change (c) everything inside (i) the quotes (") and puts you in insert mode like this:
foo(bar, "")
^
Then you can start typing the replacement text. There are many other text objects that are really useful for this kind of shortcut. Learn (and use) one new Vim command per week, and you'll be an expert in no time!
Greg's answer was very useful but i also like the 'f' and 'F' commands that move the cursor forward and backward to the character you press after the command.
So press f" to move to the next " character and F" to move to the previous one.
I have found this technique very useful for going to the start/end of a very long quoted string.
when cursor is inside the string, visually select the whole string using vi" or vi'
go to start/end of the string by pressing o
press escape to exit visual select mode
this actually takes the cursor next to the start/end quote character, but still feels pretty helpful.
Edit
Adding Stefan's excellent comment here which is a better option for anyone who may miss the comment.
If you use va" (and va') then it will actually visually select the quotes itself as well.
– Stefan van den Akker
I'd like to expand on Greg's answer, and introduce the surround.vim plugin.
Suppose that rather than editing the contents of your quotes, you want to modify the " characters themselves. Lets say you want to change from double-quotes to single-quotes.
foo(bar, "baz quux")
^
The surround plugin allows you to change this to
foo(bar, 'baz quux')
^
just by executing the following: cs"' (which reads: "change the surrounding double-quotes to single-quotes").
You could also delete the quote marks simply by running: ds" (which reads: "delete the surrounding double-quotes).
There is a good introduction to the surround plugin here.
I know this question is old but here is a plugin to use % to match the corresponding double quote:
https://github.com/airblade/vim-matchquote