Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move Visual Studio cursor to the end of opening HTML tag

Visual studio will automatically complete a <div> for you when you finish the tag's >. This places the cursor in between the opening and closing tag like this:

<div>|</div>

(where the | is your cursor)

However, when you add a class (or other html attribute for that matter) to an html element, Visual studio will leave the cursor inside the quotes, like this:

<div class="foo|"></div>

Is there a command to automatically move the cursor to the first closing angle bracket like this:

<div class="foo">|</div>

It seems small, but I have to move my hand across the keyboard to move the cursor 2 spaces. The Edit.GotoBrace command, ctrl+], is not doing this for me as it places the cursor here:

<div class="foo"></d|iv>

for some reason.

like image 425
John Lieb-Bauman Avatar asked Dec 08 '14 21:12

John Lieb-Bauman


People also ask

How do you get to the end of tag in VSCode?

It is possible to do, but either using Ctrl + Shift + P -> "Emmet: Go to Matching Pair" or by manually setting a shortcut for it ( Ctrl + K Ctrl + S ).

How do you change the opening and closing tag at the same time VSCode?

You can use the Rename Symbol command to do this. Opening and closing tags will both be renamed. Alternatively, you can press Shift + Enter at step 3 to preview changes and then Shift + Enter again to apply them.

How do you move tags in VS code?

Using. Or from the command palette (Ctrl + Shift + P) with commands "Jump Tag - Next" and "Jump Tag - Previous".

How do I wrap a selection with an HTML tag in Visual Studio?

2 Answers. Visual Studio 2015 comes with a new shortcut, Shift+Alt+W, that wraps the current selection with a div. This shortcut leaves the text "div" selected, making it seamlessly changeable to any desired tag. This coupled with the automatic end tag replacement makes for a quick solution.


1 Answers

Don't think it's possible in VS. You can do the following:

  • Navigate word-by-word using Ctrl+SideArrow
  • Navigate the beginning or end of the line using Home or End.
  • Navigate the beginning or end of the document by using Ctrl+Home or Ctrl+End
  • Navigate the matching tag using Ctrl+[ or Ctrl+]
like image 107
Eugene Avatar answered Nov 15 '22 08:11

Eugene