Skip to content

Instantly share code, notes, and snippets.

@hzlzh
Created July 17, 2012 08:31
Show Gist options
  • Save hzlzh/3128038 to your computer and use it in GitHub Desktop.
Save hzlzh/3128038 to your computer and use it in GitHub Desktop.
console.log() snippet for Sublime Text 2
<snippet>
<!-- put this file in /packages/User/<Folder Name>/console_log.sublime-snippet then restart your Sublime Text 2 -->
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>conl</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
<snippet>
<!-- put this in another file /packages/User/<Folder Name>/console_dir.sublime-snippet then restart your Sublime Text 2 -->
<content><![CDATA[console.dir($1);$0]]></content>
<tabTrigger>cond</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.dir()</description>
</snippet>
@IsmiKin
Copy link

IsmiKin commented Mar 28, 2014

Simple , fast and perfect :)

@Kaliz3au
Copy link

Thanks bro' :)

@oliverbenns
Copy link

Nice! Thanks :)

@aroc
Copy link

aroc commented Mar 17, 2015

+1. Thanks for this!

@SkullMasher
Copy link

That's also a nice introduction to sublime text hacking. Thanks.

@SkullMasher
Copy link

By the way to use this :

  • Tools > New Snippet
  • Paste the code. If you don't like 'conl' as trigger change it on line 4 tabTrigger.
  • Hit save. You should be in the correct folder by default (Sublime Text 3/Packages/User)
  • Name your snippet with whatever you want and put the .sublime-snippet extension at the end.
  • Get back to your js file and do try your trigger word you specified on line 4.
  • Profit !

@timurcatakli
Copy link

Thank you...

@s9eb
Copy link

s9eb commented Mar 3, 2016

Thx man ;)

@Horray
Copy link

Horray commented Jun 21, 2016

Awesome! Really nice one!

@daniel8881
Copy link

Great! thank you.

@vassyz
Copy link

vassyz commented Aug 22, 2016

I'm using Sublime Build 3114 and the process mentioned by @SkullMasher still stands, apart from the path to add a new snippet.
Now it seems to be Tools > Developer > New Snippet

@tiocadu
Copy link

tiocadu commented Oct 31, 2016

Really useful! Thanks!

@vlpak
Copy link

vlpak commented Dec 12, 2016

Hello everyone,
I am quite new in sublime, so, can someone tell if it is a program to see an output, like console.log("Hello!")?
But I still don't understand how does it work. I saved as instructed, then typed console.log("Hello!").sublime-conl and hit return
nothing happened, what did I do wrong?

@vlpak
Copy link

vlpak commented Dec 12, 2016

this is an output from the
console.log("Hello!");
Could not open file:
[Finished in 0.1s with exit code 3]
[cmd: ['/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc', '']]
[dir: /Applications/Sublime Text.app/Contents/MacOS]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

@GiuMagnani
Copy link

@vlpak No, this is just a snippet (or a shortcut) to write faster the console.log() command in JavaScript files or <scripts> tags in HTML. Check the instructions posted by @SkullMasher.

Then you can type "conl" and press the "tab" key and sublime will complete the rest.

@pablotrianda
Copy link

Thanks! Work perfectly!

@gonwms
Copy link

gonwms commented Mar 14, 2018

Thanks! @hzlzh @vlpak

@ljayz
Copy link

ljayz commented Mar 15, 2018

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment