7

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.

John Lieb-Bauman
  • 1,426
  • 12
  • 25

2 Answers2

2

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+]
Eugene
  • 126
  • 1
  • 4
0

You can do it typing directly this emmet shortcode and pressing ENTER, and it will leave you just where you want:

div[class=foo]

or

div.foo
gtamborero
  • 2,898
  • 27
  • 28