Key-mappings based on file-type?


#1

Is it possible to associate key-mappings with file-types? So that for example I could bind 2 commands to 1 key and upon pressing that key only 1 command would fire based on the file-type?


#2

Yes, it is possible to associate keybindings with file types, though rather complicated. It would be easier to just bind the two keybindings and then have them abort themselves if the file is not the required type. See the “Overloading Key Bindings” heading in the Flight Manual:

http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/

This, by the way, is how the Tab key is overloaded to do so many different things.