Home Download Buy Blog Forum Support

Select all text between quotes/brackets?

Select all text between quotes/brackets?

Postby seeyou on Wed Aug 17, 2011 1:01 pm

Hi

I'm new to Sublime and loving it so far. I was just wondering if there was an equivalent to the VIM ability to select/delete everything between a pair of quotes, or brackets, or square brackets, etc? Or even just highlight it for deletion/overwriting?

As an added bonus, is there a way to make Sublime "Auto navigate" to the LAST auto-inserted quote/bracket? Ie. If I'm typing (' and Sublime inserts ') for me, but the cursor is still inbetween the quotes - if I press ) in Vim, it'll skip the cursor past the quote and the bracket, but in Sublime, I'd have to enter both quote and bracket to get to the end?

Many thanks in advance
seeyou
 
Posts: 5
Joined: Wed Aug 17, 2011 12:15 pm

Re: Select all text between quotes/brackets?

Postby sfranky on Wed Aug 17, 2011 1:52 pm

for your first question, I think ctrl+shift+space does what you need. It also selects the brackets, though...
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Select all text between quotes/brackets?

Postby seeyou on Thu Aug 18, 2011 5:47 am

Thanks - your tip actually led me onto examining the key bindings file more closely, and there was another command (ctrl+shift+m) right next to yours which does exactly what I want inside any kind of bracket. Combined with another plugin I found in the forums to do the same more reliably for quotes, and mission accomplished.

Now if I could just figure out the second part, and how to get autocomplete to pull from all open files/project files..
seeyou
 
Posts: 5
Joined: Wed Aug 17, 2011 12:15 pm

Re: Select all text between quotes/brackets?

Postby charlesroper on Thu Aug 18, 2011 7:41 am

seeyou wrote:I'm new to Sublime and loving it so far. I was just wondering if there was an equivalent to the VIM ability to select/delete everything between a pair of quotes, or brackets, or square brackets, etc? Or even just highlight it for deletion/overwriting?


The latest dev release now supports text objects in Vintage mode, so you can use, for example, the
Code: Select all
di"
and
Code: Select all
ci(
commands to do this (examples).

seeyou wrote:As an added bonus, is there a way to make Sublime "Auto navigate" to the LAST auto-inserted quote/bracket? Ie. If I'm typing (' and Sublime inserts ') for me, but the cursor is still inbetween the quotes - if I press ) in Vim, it'll skip the cursor past the quote and the bracket, but in Sublime, I'd have to enter both quote and bracket to get to the end?


Hmm, nice. I didn't know Vim did that. +1 for this feature. I've setup a Alt+Return binding that skips to the end of the line, but this would be better.
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am

Re: Select all text between quotes/brackets?

Postby chikamichi on Sun Oct 16, 2011 3:23 am

For the sake of info: as of build 2132 (but earlier I guess), inserting a ( will auto-insert the matching ), leaving the cursor in between, and typing ) will jump after the auto-inserted ), as in Vim.
chikamichi
 
Posts: 14
Joined: Sun Oct 16, 2011 2:26 am

Re: Select all text between quotes/brackets?

Postby Kaske on Thu Apr 12, 2012 10:18 am

seeyou wrote:Thanks - your tip actually led me onto examining the key bindings file more closely, and there was another command (ctrl+shift+m) right next to yours which does exactly what I want inside any kind of bracket. Combined with another plugin I found in the forums to do the same more reliably for quotes, and mission accomplished.

Now if I could just figure out the second part, and how to get autocomplete to pull from all open files/project files..


Could you tell me the name of the plugin?

Thanks.
Kaske
 
Posts: 7
Joined: Tue Apr 03, 2012 10:43 am
Location: Belgrade, Serbia

Re: Select all text between quotes/brackets?

Postby Kaske on Thu Apr 12, 2012 10:21 am

sfranky wrote:for your first question, I think ctrl+shift+space does what you need. It also selects the brackets, though...


Is there any way to select without brackets/quotes/etc.?
Kaske
 
Posts: 7
Joined: Tue Apr 03, 2012 10:43 am
Location: Belgrade, Serbia

Re: Select all text between quotes/brackets?

Postby bizoo on Thu Apr 12, 2012 10:48 am

Kaske wrote:
sfranky wrote:for your first question, I think ctrl+shift+space does what you need. It also selects the brackets, though...


Is there any way to select without brackets/quotes/etc.?

ctrl+shift+m work as you expect for brackets, trigger it one time for inside content and another time to add brackets.
For quotes I'm pretty sure there's no solution out of the box, must write a plugin (or maybe only with a keybinding if there is a way to ask the expand_selection command to expand to specific chars, only Jon could help here).
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Select all text between quotes/brackets?

Postby facelessuser on Thu Apr 12, 2012 1:32 pm

BracketHighlighter allows you to select strings without quotes or brackets. I think it is by default some goofy sequence like ["ctrl+shift+b", "ctrl+shift+s"], but you can change it something sensible. This was when I was still providing shortcuts in my plugins (there are so many shortcuts now it is hard to find free ones).
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: Select all text between quotes/brackets?

Postby Jim on Thu Apr 12, 2012 7:17 pm

charlesroper wrote:The latest dev release now supports text objects in Vintage mode,
More at>> (examples).


That's great. Thanks for the info.

Do anyone know if there will be more "text objects" implemented, like:
# "it" selects the text within the surrounding HTML/XML tag or container, with the greedier version being "at".
# "iw" selects the surrounding word, with the greedier version being "aw".
# "is" selects the surrounding sentence, with the greedier version being "as".
# "ip" selects the surrounding paragraph, with the greedier version being "ap".
(From examples)
Jim (on Windows Win7, now finally with ST3)
Jim
 
Posts: 40
Joined: Sun Feb 26, 2012 5:21 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: Clams, Google [Bot] and 18 guests