Sublime Forum

Question regarding key-bnding and file extensions

#1

Is it possible to assign a key-binding that depends on the current file extension ?

What I would like to have is that e.g. ctrl-alt-f formats my javascript source if I’m currently working on a javascript file and if I’m working on a ruby file it should format my ruby file accordingly.

Regards
Roger

0 Likes

#2

You can create a .sublime-keymap file in $PACKAGE_PATH/Javascript/ and another in $PACKAGE_PATH/Ruby/ and this should do what you want.

$PACKAGE_PATH:
Windows: %APPDATA%\Sublime Text 2
OS X: ~/Library/Application\ Support/Sublime Text 2
Linux: ~/.config/sublime-text-2

0 Likes