Sublime Forum

Quick way to type console.log?


I was wondering what would be the fastest way to output ‘console.log’.
The autocomplete usually takes a few key presses and typing starting from ‘con’ and I was wondering what the fastest way to do this would be. Maybe through a custom hotkey?



The fastest way would be a keybinding, but there’s also snippets:

1 Like


Going the snippet route, example would be the following, which you can put in place with Tools > Developer > New Snippet. As a key you would use the insert_snippet command with an argument of contents that is the textual content of the snippet that should be inserted).

I use this one and have a version with the same tab trigger and different scopes for all of the languages that I regularly use that expands out to the appropriate way to log in that thing, so that the muscle memory of cw<tab> works everywhere.

Key bindings can similarly use context to only apply in certain file types, but I personally find that snippets keep me “in the flow” because this one comes up pretty often.

    <scope>source.ts, source.js</scope>
1 Like


Okay good suggestions. I will make a snippet for ‘con’. Thanks :slightly_smiling_face:



This is what I do. Create a utils.js file, in it put this

export const log = (content) => {


Import it into your JS file, then just type “log” and tab. Then it is not restricted to one editor
log(variable) tab

I have a lot of other exports that do work for me like propercase names, addEventListener etc