GEdit/Python execution plugin?

2019-03-11 09:55发布

I'm just starting out learning python with GEdit plus various plugins as my IDE.

Visual Studio/F# has a feature which permits the highlighting on a piece of text in the code window which then, on a keypress, gets executed in the F# console.

Is there a similar facility/plugin which would enable this sort of behaviour for GEdit/Python? I do have various execution type plugins (Run In Python,Better Python Console) but they don't give me this particular behaviour - or at least I'm not sure how to configure them to give me this. I find it useful because in learning python, I have some test code I want to execute particular individual lines or small segments of code (rather then a complete file) to try and understand what they are doing (and the copy/paste can get a bit tiresome)

... or perhaps there is a better way to do code exploration?

Many thx

Simon

8条回答
SAY GOODBYE
2楼-- · 2019-03-11 10:34

The closest to a decent IDE... Install gedit-developer-plugins (through synaptic || apt-get) and don't forget to enable (what you need) from gEdit's plugins (Edit->Preferences [tab] plugins) and happy coding

查看更多
叼着烟拽天下
3楼-- · 2019-03-11 10:36

I installed iPython console in gedit and do most of my simple scripting in it, but gedit is a very simple editor, so it'll not have some advance feature like an IDE

But if you want code exploring, or auto completion, I recommend a real IDE like Eclipse.

If you just want a editor, KomodoEdit is fine.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-03-11 10:40

For python, You can use "external tools plugin":

#!/bin/sh
python3 "$GEDIT_CURRENT_DOCUMENT_PATH"

Option of external tool: Save: Current Document Input: Current Document Output: Display in bottom panel

Language: Python or Python3

Don't forget the quotes around $GEDIT_CURRENT_DOCUMENT_PATH....

查看更多
The star\"
5楼-- · 2019-03-11 10:42

I think what you're looking for is http://live.gnome.org/Gedit/Plugins/BetterPythonConsole.

You hit F5 and it runs the code in your file in a IDLE-like console. I don't know if it can only run selected code. (I don't think it can) but you can always copy the needed code in a new window and run it from there.

Have a look through the plugin list for other interesting stuff: http://live.gnome.org/Gedit/Plugins

查看更多
beautiful°
6楼-- · 2019-03-11 10:44

To answer your second question, and hopefully guide you in a direction you'll be happier with, I think you ought to consider trying some different editors. There are many with more powerful code exploration features than GEdit has. Check out this post:

What IDE to use for Python?

查看更多
Ridiculous、
7楼-- · 2019-03-11 10:44

What I do is keep a file called python_temp.py. I have a shortcut to it in my dock. I use it as a scratch pad. Whenever I want to quickly run some code, I copy the code, click the shortcut in the doc, paste in the text and hit f5 to run. Quick, easy, simple, flexible.

查看更多
登录 后发表回答