How to open file in keymap?


Hey, I want to open a specific file from project with shortcut. How can i do that in atom is there a package.For example I use advance-open-file is great but i want to open with shortcut.


You can do anything with the file and Atom’s API. Opening files is easy and straightforward. To be clear: you want to open a specific file that’s never going to change?


Yes i use laravel and sometime i have the same names for files.I just want to put the files somewere with a shortcut and when i press the desire shortcut to open the files in atom.


Add the following to your (File > Init Script…)

atom.commands.add 'atom-text-editor',
  'open:master-blade': (event) ->'path/to/master.blade.php')

Then add the following to keymap.cson (File > Keymap…)

  'ctrl+1': 'open:master-blade'


atom.commands.add ‘atom-text-editor’,
‘open:master-blade’: (event) ->‘C:\Users\Adrian\Documents\Projects\lara\panel\resources\views\master.blade.php’)

‘ctrl+1’: ‘open:master-blade’

It dosent open the files is the path correct write ?


It should work fine with absolute paths, but it’s hard to tell whether there’s a problem in your syntax. Please use the </> button in the editor to format your code. Otherwise the indentation is lost and your quotes are transformed.


Hello Adrian.

Please try the following modifications ->

### ###
atom.commands.add 'atom-text-editor',
  'open:master-blade': (event) ->'C:/Users/Adrian/Documents/Projects/lara/panel/resources/views/master.blade.php')
### keymap.cson ###
  'ctrl-1': 'open:master-blade'



Hey i put the code like you say. In Key Binding Resolver it’s shows open:master-blade, but it dosent open the file :(.


It work’s now my bad needed restart Thanks so much guys was lookink for this!!. Hope someone makes a package for this!


That is good news Adrian.

Interesting comment. What @idleberg (thank you) designed for you is specifically custom and too trivial for a package in my opinion. Or do you have an extended functionality in mind?


I was thinking to make a package like so. The user will have some field for the name of the file to open and another for the shortcut. Or when I access a file will enter a shortcut and a popup box will appear to enter the shortcut for that file and save.

Yeah is a little trivial but in my ideea if you work a long time for a project and have all the time same names for some files you can open the main one fast. Why i asked because I hate working with lot’s of tabs and sometime I close some of them then i need them back lol.I use advanced-open-file greate package.


There are packages that assist with project management and the management of tabs.

If you are wanting to develop a package you can have a look at the flight manual: