Gedit: Difference between revisions

From Octave
Jump to navigation Jump to search
(using templates)
m (add link for gedit page)
Line 1: Line 1:
Gedit is the Gnome text editor. There's many plugins and options that may be able to improve your experience while coding with octave.
[ Gedit] is the Gnome text editor. There are many plugins and options that may be able to improve your coding experience.

== syntax highlight ==
== syntax highlight ==
Line 10: Line 10:

  <property name="line-comment-start">#</property>
  <property name="line-comment-start">#</property>

== Embedded Terminal ==
== Embedded Terminal ==

Revision as of 12:33, 12 June 2012

Gedit is the Gnome text editor. There are many plugins and options that may be able to improve your coding experience.

syntax highlight

Gedit has very good syntax highlight for GNU octave, specially since v3 when it was split into matlab and octave. It uses gtksourceview for it and the latest lang file can be downloaded from their repository.

Note that since matlab and GNU octave files have the same mimetypes and globs in gedit, your files may be highlighted using matlab rules. To easiest way to fix this is removing matlab.lang. The same happens with functions files which may be highlighted as Objective-C which can also be fixed by removing objc.lang. However, system updates may recreate these files and so you may want to keep removing these files. The lang files usually reside at /usr/share/gtksourceview-3.0/language-specs/

Code comment

One of the most useful plugins is code comment which allows to comment/uncomment several lines of code at the same. Simply select the lines and press Ctr+M to comment and Shift+Ctr+M to uncomment. There's one limitation though. While the syntax correctly recognizes both % and # as comment characters, the plugin must use only one. By default it uses #. If you want to change it to %, edit the file with the syntax highlight rule and in the metadata field change the value of line-comment-start:

<property name="line-comment-start">#</property>

Embedded Terminal

One of the gedit plugins allows to have an embedded terminal in the text editor window. By default, this terminal will show up on the bottom panel. If you prefer to move it to the side panel (maximize vertical space and see as many lines of code as possible), make the following changes on /usr/lib/gedit/plugins/ (or whatever your distro placed it).

<         side = window.get_side_panel()
<         side.add_item(self._panel, _("Terminal"), image)
>         bottom = window.get_bottom_panel()
>         bottom.add_item(self._panel, _("Terminal"), image)
<         side = self._window.get_side_panel()
<         side.remove_item(self._panel)
>         bottom = self._window.get_bottom_panel()
>         bottom.remove_item(self._panel)

Basically replace window.get_bottom_panel() with window.get_side_panel(). You might want to replace the side variable name to bottom but that is not actually necessary, it's only so that the variables name reflect the truth about them. The same hack can be used on other plugins to move them between the panels.

File Browser on side panel

Another useful plugin is the File browser pane that allows to easily access files from the side pane and navigate into directories to see the paths. Would be great to implement a new one, octave specific, with all the paths in the function search path.