Is there a shortcut to move selected code right or left?

I regularly make use of option+shift+up or down to move a line up or down. Sometimes I'd really like to just select a few characters, then move them right or left in the same way, usually when I'm going to wrap a piece of text with a JSX tag. I could just cut and paste, but it would be more convenient to just be able to move the code around similarly to the move line up or down function, especially since cutting and pasting causes WebStorm to have to refresh the error state which causes lag before I can just keep moving my cursor. 

Does anything like this exist? Thanks!

0

Does Tab/Shift+Tab (Edit > Indent/Unindent Selection) help?

0

No, I'm not looking to change the indentation, but the position of the selected characters within a line. For example, say I start with some text in a JSX file:
 

<div>
  Some text here
</div>

 

Then I decide I want Some text here to be a heading. I place my cursor before it and type <h2> and Webstorm autocloses the tag so it looks like this:
 

<div>
  <h2></h2>Some text here
</div>

 

I would like to be able to select the </h2> tag and move it right with a keyboard shortcut.
 

 

Alternatively, a shortcut to enclose the selected text with a tag would work too - so instead of placing my cursor at the beginning of Some text here, I would select the whole line before typing my enclosing tag. Some things have this kind of behavior such as curly braces or quotes, but I haven't seen a way to do it with HTML or JSX tags yet.

0

coppereyecat 

Alternatively, a shortcut to enclose the selected text with a tag would work too

Main Menu | Code | Surround with…” – it has an entry for surrounding with a Tag .. or even a Emmet expression.

(here I have a few custom Live Templates for certain tags that I use the most; even my own alternative for Tag for faster selecting)

1

Thanks Andriy, that looks like it will solve my problem!

0

请先登录再写评论。