I use EPIC in my work and recently started trying Komodo IDE. But as a light "everyday" editor in my system, I installed
mooedit . Not everything in it is perfect, but some things can be tweaked, which will be discussed.
First, choose a color scheme. All of them are taken from Gtk-shnyh, so go
here and choose. For some reason I do not digest the white background, I stop on the blue. And we finish to taste, getting something in the middle a la Midnight Commander, FAR-ovsky Colorer and, admittedly, Turbo Vision of the times of the Borlands. Immediately striking the lack of a separate color for the brackets. We fix this by
def: special-constant in
perl.lang (for other languages, probably, similarly - taking into account the use of
def: special-constant there ). Copy the file to
~ / .local / share / medit-1 / language-specs / and add:
<styles> <style id="special-constant" _name="Brackets" map-to="def:special-constant"/>
')
<definitions> <context id="perl" class="no-spell-check"> <include> <context ref="special-constant"/>
<define-regex id="special-constant" extended="true"> \( | \) | \[ | \] | \{ | \} </define-regex> <context id="special-constant" style-ref="special-constant"> <match>\%{special-constant}</match> </context>
Accordingly, in the file
~ / .local / share / medit-1 / language-specs / our-style.xml :
<style name="perl:special-constant" foreground="#66FFFF"/>
Result:
Now add the syntax check:
Something is wrong ... There is not enough transition to lines with errors.
For this, the lines in the output should be of the form
filename: line_number [: position] . The position is not available to us, but with the line number the question can be solved. Put the script in
~ / bin / with something like this:
We register it as a utility instead of
perl -c . Now clicking on the line with the error will take us to the right place in the editor window.
The next step is to set the source formatting with
perltidy . Everything is not so simple here. The fact is that if there are syntax errors, the source code in the editor window will simply be erased, do not understand what. To avoid this, we first run the check, and then format it. We use the Lua script, as it allows us not to unconditionally display the result in the editor window, but only when necessary:
filename = doc.get_filename() codefile = os.tmpname() rc = os.execute(string.format("/usr/bin/perl -c \"%s\" > \"%s\" 2>&1",filename,codefile)) if rc == 0 then tidyfile = os.tmpname() os.execute(string.format("/usr/bin/perltidy -nsak=\"if elsif unless for while\" -pt=0 -i=4 -bl -vt=2 -vtc=2 -boc -st \"%s\" > \"%s\"",filename,tidyfile)) out = io.open(tidyfile,"r") doc.select_all() doc.replace_selected_text(out:read("*a")) doc.save() os.remove(tidyfile) else out = io.open(codefile,"r") moo.error_dialog(string.format("Run syntax check!\n\n%s",out:read("*a"))) end os.remove(codefile)
There is one drawback to this method: we cannot get an output window, so in case of syntax errors, we have to show a dialog. Using a similar script in Python instead of Lua does not really help: we can get an object for output from it, but only if it already exists can we not create a new one. Author mooedit already notified of this, promised to think :)
Well, we hang all these utilities on separate buttons:
In the same way, you can add the launch of the script with the editor output to the notification area (everything is trivial here), and the launch of an external debugger (but these are
separate tears a separate conversation), and something else.