quinnj / Sublime-IJulia

An IJulia Frontend for Sublime Text 3
90 stars 16 forks source link

Key binding for starting IJulia in Sublime in One Step #13

Closed papamarkou closed 10 years ago

papamarkou commented 10 years ago

@karbarcca, do you know if it is easy to create a key binding so as to start IJulia in Sublime without having to i) first press ctrl+shift+p and then ii) choose Sublime-IJulia: Open new IJulia console? I would like to replace this two-step process by a single key combo, say ctrl+alt+j.

I went to Preferences -> Key Bindings - User, opened the file ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap and added the following:

[
  { "keys": ["ctrl+alt+j"], "command": "/opt/julia-dev/julia /home/theodore/.julia/IJulia/src/kernel.jl /home/theodore/.config/sublime-text-3/Packages/User/profile-0.json" }
]

However, as I found out, this is not the right way to go about it, as the XML parser doesn't know about the format of my command and its arguments. I don't have too much time to investigate and sort this, so I wanted to ask if this could be a possible feature that you and other users may like to consider to be added in the future ;)

quinnj commented 10 years ago

Definitely possible. I used to do this, but turns out it's discouraged for packages to provide the key-bindings since it's so easy for users and the fact that they often do provide their own bindings. Instead packages are encouraged to go through the command palette. Here's the code you need to set your own keybinding:

{ "keys": ["ctrl+alt+j"], "command": "i_julia_open"}
papamarkou commented 10 years ago

Awesome, this works! I personally find it much more practical to spawn Julia this way in Sublime, thanks!

quinnj commented 10 years ago

Yeah, I used the same approach for a while, glad you like it!