1
votes

I'm looking for a keyboard shortcut to select all text/contents between HTML attribute, such as:

<img src="https://example.com/wp-content/uploads/2018/26/imagename.jpg" alt="">

I want to select the entire text/path in src"...." and replace for multiple images, would be much help me there any option, now I have to do everything manually.

I know, there is shortcut key something similar to "Ctrl Shift A" but that is select tags and text between tags, I need the same for attribute selections, eg src, href and title etc...

Please let me know if anybody know and suggestion for this type of workflow, thanks.

3

3 Answers

4
votes

I'd highly recommend installing the Expand Selection to Quotes SublimeText3 plugin. Simply place the cursor anywhere inside quotes (single or double), and tap Ctrl+' to select all text content within the quotes.

I use this all the time for use-cases like yours, and it's especially useful for multi-line cursor navigation (i.e. say you have 10 active cursors across 10 non-identical HTML lines of code, and want to jump over an entire set of bracket-holding text for all 10 cursors, without getting them out of sync).

3
votes

As far as I know, there is no way to select the just the content of the HTML attribute with vanilla ST3.

However, you can select the content between quotes and the quotes themselves using Command + Shift + Spacebar (OSX) or CTRL + Shift + Spacebar (Windows).


If you have Emmet installed, you can use Command + Shift + period (select next) and Command + Shift + comma (select previous).

Source.

0
votes

I'm not sure if it worked this way at the time this post was written, but ⇧ Shift + + A (Expand Selection) works fine for me on Sublime 3 (build 4113) on OSX. I tested this by copying your snippet into an HTML file and after clicking on the text in the src tag, I was able to select the entire path (without the quotes).