Keymap.cson Not Visible

Hi guys, I have installed Juno, with Julia 0.6. I really like it, thanks to all involved.

I’ve been playing around and one thing I like to do when I’m in other IDE’s is press one key to save my script and run it at the same time. I’d like this key to be F5.

So from here:http://docs.junolab.org/latest/man/basic_usage.html#Adding-Your-Own-Shortcuts-1 I see that I am to edit the keymap.cson file. But it’s not in the location specified in that article, nor is it on my machine.

Should I just create it in the .Atom folder? And then add a few lines to it as suggested in that article, restart and bingo?

I don’t want to create it and find out it’s the wrong thing to do.

Just use Ctrl-Shift-P or Cmd-Shift-P to open the command pane and type in “keymap”. The first entry there should get your keymap file, which might also be json in newer Atom versions (not sure).

Hi thanks, this has gotten me part of the way there.

I opened the keymap.cson file (it is a cson file) and added the following code:

‘.platform-win32 .item-views > atom-text-editor[data-grammar=“source julia”]’:
‘ctrl-shift-alt-enter’: ‘julia-client:clear-console-and-run-file’

And in my init.coffee file:

‘.platform-win32 .item-views > atom-text-editor[data-grammar=“source julia”]’:
‘f5’: ‘julia-client:clear-console-and-run-file’

Just as per that article I linked to above. And this works in that it clears the console and runs the file. But what I really want is for it to save the file just before running too. All with the f5 key.

Is this doable?

EDIT: I just saw this page: Keymaps In-Depth

Man, I don’t really want to spend half a day learning how to drive Atom. It seems overly complicated and like a ‘black box’ in that there’s no list of available commands, few examples of syntax etc.

I can see that Atom probably can be configured to do anything. But how to get it to do what you want seems akin to learning another small language.

Any help appreciated.

atom.packages.onDidActivatePackage (p) ->
  if p.name is 'julia-client'
    juno = p.mainModule

    atom.commands.add '.item-views > atom-text-editor', 'julia-client:clear-console-and-run-file', ->
      atom.workspace.getActiveTextEditor().save()
      juno.runtime.evaluation.evalAll()
      juno.runtime.console.reset()

in your init.coffee should work in most cases (but error for Untitled buffers). Note however that there is no need to save files before evaluating them. Atom will also keep a copy of unsaved files if close it, so it’s pretty hard to lose progress.

See here should you want to have look into the available API a bit more in-depth.

Also, please escape code blocks in your posts with backticks (``` for codeblocks, ` for inline code) – makes it much easier on the eyes.

Thanks very much.