Move cursor to html tags in text editor

How do I move the cursor over HTML tags in a text editor like Sublime Text or whatever, instead of having to repeatedly press the ctrl+ keys arrow(not direct movement)?
Is there a shortcut available? If not, how can I create one for the Sublime Text editor?
This is how I want to move the cursor.

    <html>
       <p>
            "a"
       </p>
       <div>
            "b"
       </div>
    </html>

      

I want to move the cursor from position a to b using a shortcut.

+3


source to share


1 answer


I am not familiar with Sublime, but I heard that it is very similar to Textmate, it may be based on Textmate, I'm not sure.

I'm familiar with Textmate 1.5, but it has a feature that allows you to customize tab triggers and templates using the built-in Bundle editor.

Note: It's worth noting that a new version of Textmate is available. I believe the current version is 2.0, but I tried it and decided to stick with 1.5 because 2.0 implemented some major changes and I preferred to stick with what I was familiar and happy with.

The simplest example of how tab triggers can be used in Textmate would be ...

<table border="0" cellpadding="$1" cellspacing="0"><tr><td height="$2"><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table></td></tr></table>

      

This is a simple table separator that I use in emails instead of using transparent spacers. Inserting the table inside the table will prevent it from collapsing and will work as a cross-compatible alternative to transparent gifs for email campaigns.



With this set to Textmate, all I have to do is enter tspace

followed by Taband that code is auto-filled at the cursor position. Subsequent will Tabmove the cursor to each $ notation, which is Textmate syntax.

So, tspace

+ Tabgenerates code, + Tabjumps to $ 1, where I then fill in the corresponding value, + Tabjumps to $ 2, where I fill in the corresponding value + Tabjumps to the end of the code block.

Note: you can also set it where some placeholder will repeat, so if I mark $ 1 in multiple places it will auto-fill wherever the variable is the first time I fill it.

This is just the simplest example. There are other similar features in Textmate, and they are limited only by how complex you set them up.


Although, as I mentioned, I am not familiar with Sublime, I took a quick look at it and found this article which lays out exactly what I described and how it works in Sublime.

+2


source







All Articles