Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Layout Techniques Display Modes Block vs. Inline Elements

Ctrl+Shift+W Bad idea

In this video Guil Hernandez mentions Ctrl+Shift+W to wrap the selected area with a div.... But as workspaces was released after this video that shortcut key actually closes workspaces!

I think that shortcut is for the Editor Sublime Text (that Guil uses in his videos) http://www.sublimetext.com/3

I use Linux and that shortcut closes Sublime Text, too :) Maybe only works for a Mac computer.

Emily Kelton
Emily Kelton
3,626 Points

I use Sublime on a Mac, and I'm pretty sure it's just Ctrl + W to wrap with a tag. Div is the default, but you can change it to any tag.

:) thanks for the hint Emily. Up to now I used ctrl&shift&w. But I love to press one key less.

6 Answers

Yes, it's a Sublime Text shortcut, though on Windows I know it's Alt+Shift+W by default:

From the default key bindings (Windows):

{ "keys": ["alt+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } },

You could add/change the key binding in Sublime Text by adding the line above to your user key bindings file (with or without the trailing comma, depending on whether you have anything else in there and where you put it).

So I just checked on a Mac and yes it's Ctrl+Shift+W:

{ "keys": ["ctrl+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } },

Whereas 'close window' on a Mac is Command+Shift+W:

{ "keys": ["super+shift+w"], "command": "close_window" },

(super is the command key...)

And on Windows, 'close window' is Ctrl+Shift+W:

{ "keys": ["ctrl+shift+w"], "command": "close_window" },

If you're not using Sublime Text, I'd highly recommend you check it out! Handy keyboard shortcuts is only the beginning of what it can do!

Muzafar Haq
Muzafar Haq
14,272 Points

I got it now, it is not CTRL+SHIFT+W it is ALT+SHIFT+W on windows 7 based sublime-3 editor, thanks. :)

Liviu Tudor
Liviu Tudor
7,061 Points

Sublime Text 3 on the mac => it is Ctrl + W = wrapp selected content in a div

Muzafar Haq
Muzafar Haq
14,272 Points

I used Ctrl+Shift+W on Sublime 3 on Windows, and it closed the sublime editor. I am lost?

Magnus Rydberg
Magnus Rydberg
4,683 Points

For those of you using Brackets as your editor Ctrl-Shift-W will not work. The shortcut will in fact close all files.

To be able to wrap files I installed a plugin just now:

https://github.com/pedelman/brackets-surround

I tried it and it works fine. After highlighting code and hitting Ctrl - Shift - J (or Cmd - Shift - J for Mac.) you are promoted to add the tag with which you want to wrap the code.

Nice approach there, I'm using Cloud 9 and still not a clue on how to get that short-cut working. I would appreciate it if someone knew about it.

Tina Maddox
Tina Maddox
28,102 Points

The problem I am having is that when I select the section I want to create the new <div>, hit Alt + Shift + w it selects more of the tags than I had selected.

Any suggestions on how to only keep the selected area I want?