Sublime Forum

Quickly select tags and contents?

#1

Hi all.
I just started using ST2 last night, and I’m trying to get it set up for wordpress development.

When editing html, I would like to be able to quickly select sections of code, including the parent tags.
This makes copying and pasting html really fast. It’s a major convenience.

The only editor that I’ve found that can do this is the excellent and slowly dying Quanta+.

Can this be done in ST2?

1 Like

#2

Take a look at the Selection/Expand Selection to Tag menu item. You can hit the associated key binding several times to increase what’s selected.

0 Likes

#3

Thats close to what I want, but doesn’t quite hit it.

‘Expand Selection to Tag’ allows me to select the contents of my target tag, but excludes the tag itself. So I still have to do the extra work of re-creating the parent tag.

0 Likes

#4

Press the key binding again, and it’ll select the tag

1 Like

#5

I haven’t been using the keybinding for this command, and it doesn’t seem to work.

The menu gives the keybinding as ‘Shift + Ctrl + A’. But when I this keybinding, the selection only includes the tag name in the opening tag. Nothing else.

How can I access this command via the keyboard?

0 Likes

#6

@bobdobbs - press the keybinding twice, first time will select the contents, second time will include the selected tag :smile:

0 Likes

#7

Sounds like you have zencoding installed, which is overriding the default

1 Like

#8

Ahah!

I do indeed have zen-coding installed. I guess that explains the keystroke fail.

0 Likes

#9

I have ST2 on a Windows 10 box and ctrl+shift+A does nothing at all.

Thoughts?

0 Likes

#10

Another way is to first fold the tag and then select it. This is a technique you can use in any text editor and for any kind of block

0 Likes