Kate: Difference between revisions
(Created page with "Kate is a multi-document, multi-view text editor for KDE. Very well adapted to octave. Features syntax highlighting, embedded terminal, and [http://kate-editor.org/about-kate/...") |
m (fix octaverc settings) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
and setting | and setting | ||
Priority 0 for Filetype : Scientific/Matlab and | Priority 0 for Filetype : Scientific/Matlab and | ||
Priority 1 for Filetype : Scientific/Octave (the important | Priority 1 for Filetype : Scientific/Octave (the important being that it is higher than the Matlab one) | ||
== Comment/uncomment == | == Comment/uncomment == | ||
Kate can comment/uncomment several lines of code at the same time. Simply select the lines and press {{Key|Ctr+D}} to comment and {{Key|Shift+Ctr+D}} to uncomment. | Kate can comment/uncomment several lines of code at the same time. Simply select the lines and press {{Key|Ctr+D}} to comment and {{Key|Shift+Ctr+D}} to uncomment. | ||
For the current (april 2012 | For the current default (april 2012, octave.xml version 1.01), | ||
the added comment start at the beginning of the line. | the added comment start at the beginning of the line. | ||
Line 45: | Line 45: | ||
Quit kate, then, as root, {{Codeline|cd /usr/share/kde4/apps/katepart/syntax/ && patch -p7 --backup < /tmp/kate_highlight_octave.xml.patch}} | Quit kate, then, as root, {{Codeline|cd /usr/share/kde4/apps/katepart/syntax/ && patch -p7 --backup < /tmp/kate_highlight_octave.xml.patch}} | ||
== Embedded terminal == | |||
Integrates a terminal to the editing window. | |||
Settings/Configure kate/Application/Plugins/Terminal tool view | |||
(by the way, you can select also the Find in file tool, quite handy) | |||
Then the terminal can be hidden/shown by clicking on the corresponding button at the bottom of the window. | |||
=== multiple terminals === | |||
It is possible to switch between several terminals using screen. | |||
Right click on the terminal / configure current profile / Command => | |||
{{Codeline|/bin/bash -c screen}} | |||
Then create a new session by {{Key|Ctr+a c}} (which means hold {{Key|Ctrl}}, hit {{Key|a}} then {{Key|c}}). | |||
To go to previous session : {{Key|Ctr+a p}}. | |||
To go to next session : {{Key|Ctr+a n}}. | |||
To go kill current session : {{Key|Ctr+a k}}. | |||
== set EDITOR to kate == | |||
On the command line, or in your {{Path|~/.octaverc}}, add the line | |||
{{Codeline|EDITOR("kate %s")}} | |||
then typing in octave {{Codeline|edit myfunc}} will open myfunc.m in the current kate session | |||
[[Category:Editors]] |
Latest revision as of 14:16, 18 March 2014
Kate is a multi-document, multi-view text editor for KDE. Very well adapted to octave. Features syntax highlighting, embedded terminal, and much more.
Syntax highlighting[edit]
Either Matlab or Octave syntax highlighting for m-file can be chosen in
Tools/Mode/Scientific menu
The default for *.m files can be defined to be octave by going to
Settings/Configure kate/Editor Component/"Open/Save"/Modes & filetypes
and setting Priority 0 for Filetype : Scientific/Matlab and Priority 1 for Filetype : Scientific/Octave (the important being that it is higher than the Matlab one)
Comment/uncomment[edit]
Kate can comment/uncomment several lines of code at the same time. Simply select the lines and press Ctr+D to comment and Shift+Ctr+D to uncomment.
For the current default (april 2012, octave.xml version 1.01), the added comment start at the beginning of the line.
In order to have the # to begin like the indented text, just patch /usr/share/kde4/apps/katepart/syntax/octave.xml. First save the following file in /tmp for instance
--- /usr/share/kde4/apps/katepart/syntax/octave.xml.orig 2012-04-18 14:21:07.428924481 +0200 +++ /usr/share/kde4/apps/katepart/syntax/octave.xml 2012-04-18 14:29:38.699954596 +0200 @@ -2209,11 +2209,11 @@ <general> <comments> - <comment name="singleLine" start="%" /> - <comment name="singleLine" start="#" /> + <comment name="singleLine" start="% " position="afterwhitespace"/> + <comment name="singleLine" start="# " position="afterwhitespace"/>, </comments> <keywords casesensitive="1"/> </general> </language> -<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> +<!-- kate: space-indent on; indent-width 4; replace-tabs on; -->
The last change is not relevant for the comments.
Quit kate, then, as root, cd /usr/share/kde4/apps/katepart/syntax/ && patch -p7 --backup < /tmp/kate_highlight_octave.xml.patch
Embedded terminal[edit]
Integrates a terminal to the editing window.
Settings/Configure kate/Application/Plugins/Terminal tool view
(by the way, you can select also the Find in file tool, quite handy)
Then the terminal can be hidden/shown by clicking on the corresponding button at the bottom of the window.
multiple terminals[edit]
It is possible to switch between several terminals using screen. Right click on the terminal / configure current profile / Command =>
/bin/bash -c screen
Then create a new session by Ctr+a c (which means hold Ctrl, hit a then c).
To go to previous session : Ctr+a p.
To go to next session : Ctr+a n.
To go kill current session : Ctr+a k.
set EDITOR to kate[edit]
On the command line, or in your ~/.octaverc, add the line
EDITOR("kate %s")
then typing in octave edit myfunc
will open myfunc.m in the current kate session