Reputation: 87
I am newbie starting out with using PyDev on Eclipse.
I got tired from re-importing packages whenever I were to create a new interactive console, so I explored for a solution to this. This led me to "Initial Commands" (Under Preferences -> PyDev -> Interactive Console -> Initial Commands) which is excellent.
I also noticed the "User Command" tab, which seems to allow running several scripts after inputting a hotkey. I created one, with the keybinding CTRL+A, but hitting this combination of keys in the interactive console does not seem to execute the script which i put under the "Command Text." section. Am I misunderstanding the purpose of the "User Command" option?
My attempts as to finding a solution were failing. The only reference to the "User Commands" tab on PyDev was a release note, stating
It's now possible to bind custom keybindings to help in passing custom commands to the interactive console (see: PyDev > Interactive Console > User Commands)
without really explaining the purpose
Upvotes: 1
Views: 240
Reputation: 7970
The user commands allow you to run, with cursor/focus on the editor*, some command in the console.
So if you set up a key binding for Ctrl+6 to be print(${text})
, then if you are in the editor and have "foo"
selected, pressing Ctrl+6 sends print("foo")
to the console. (Or creates a console if there is none already.)
I would have hoped that Ctrl+A simply would not have worked for you as that is the normal binding for select all. The UI does warn you if you try and use any key bindings that would cause a change to the key bindings preferences (e.g. Ctrl+/), but as Ctrl+A (and Ctrl+C etc) are handled differently, you get no warning and you simply lose the original functionality until you reedit the command.
* It sounds like a good feature request to be able to do the commands from the console too. Perhaps a pull request? http://www.pydev.org/developers.html
The commit that added the feature was 39d2065
Or at least a bug report: https://sw-brainwy.rhcloud.com/
Upvotes: 1