Home Download Buy Blog Forum Support

Shortcut key trigger that inserts correct html break tag?

Shortcut key trigger that inserts correct html break tag?

Postby handycam on Wed Jan 11, 2012 3:26 pm

I can't find a shortcut to insert a BR tag with the correct version (for XHTML or HTML5, with or without trailing slash).

All there seems to be is typing <BR and them completing it, which only adds the >

It would be nice if command or control return or something similar will add the <br/> or <br>, in the scope of html files.

Or am I just missing it?
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Shortcut key trigger that inserts correct html break tag?

Postby C0D312 on Wed Jan 11, 2012 4:31 pm

You can add this to your user keybindings:
Code: Select all
  {
    "keys": ["ctrl+shift+enter"], "command": "insert_snippet", "args": {"contents": "<br/>"}, "context":
    [
      {
        "operand": "text.html",
        "operator": "equal",
        "match_all": true,
        "key": "selector"
      }
    ]
  }
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Shortcut key trigger that inserts correct html break tag?

Postby handycam on Wed Jan 11, 2012 4:35 pm

Thanks. Is there no way to have it "smart" as to whether or not to include the / ?
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Shortcut key trigger that inserts correct html break tag?

Postby philosopherdog on Wed Jan 11, 2012 8:16 pm

Does the tags extension do this?
philosopherdog
 
Posts: 35
Joined: Sat Nov 26, 2011 3:08 pm

Re: Shortcut key trigger that inserts correct html break tag?

Postby tito on Wed Jan 11, 2012 8:24 pm

philosopherdog wrote:Does the tags extension do this?

Is a very good addition, can be added
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 851
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Shortcut key trigger that inserts correct html break tag?

Postby handycam on Wed Jan 11, 2012 8:27 pm

philosopherdog wrote:Does the tags extension do this?


I don't see that in there.
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Shortcut key trigger that inserts correct html break tag?

Postby C0D312 on Wed Jan 11, 2012 8:35 pm

handycam wrote:Thanks. Is there no way to have it "smart" as to whether or not to include the / ?


Hmm... I don't know if this is possible with just a keybinding, might require a plugin... but it wouldn't be difficult.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am


Return to General Discussion

Who is online

Users browsing this forum: fstafforini, g4mby, Google [Bot], mamu and 38 guests