Difference between revisions of "Editors"
(Created page with "== Editors == Various editors with various tools for programming, such as syntax highlighting, exist. This page lists some examples of editors and how to configure them. '''...") |
|||
Line 12: | Line 12: | ||
==== Keyboard Shortcuts ==== | ==== Keyboard Shortcuts ==== | ||
− | A list of shortcuts can be found here: | + | A list of shortcuts can be found here: [//www.digilife.be/quickreferences/QRC/XEmacs%20Reference%20Card.pdf] |
− | [www.digilife.be/quickreferences/QRC/XEmacs%20Reference%20Card.pdf] | ||
{| class="wikitable" | {| class="wikitable" |
Revision as of 15:23, 11 April 2018
Editors
Various editors with various tools for programming, such as syntax highlighting, exist. This page lists some examples of editors and how to configure them.
This page is still under construction! If you feel something is missing or should be added please do so by yourself!
EMACS
To run emacs just enter
emacs [-nw]
in a terminal. Usually, this opens a new x-window. If you do not want to have a new window opened, you can run emacs with the -nw option (short for --no-window-system). In this case, the editor will have a simple, but fully functional interface in the terminal.
Keyboard Shortcuts
A list of shortcuts can be found here: [1]
Ctrl+X+C | quit jed |
Ctrl+X+S | save the current buffer into a file |
Ctrl+G | cancel the current operation (e.g., entering commands) |
Ctrl+Space | start/end region selection mode |
Ctrl+W | cut region |
Ctrl+Y | paste region |
Alt+X | enter and execute emacs command(s) |
syntax highlighting in s-lang
emacs does not have a build-in syntax highlighting for s-lang (jed does!), but our good friends from MIT have written one: slang-mode.el
Save the file at your preferred path and add the following lines to your .emacs file (that should automatically exist in your home directory).
(load "yourpreferredpath/slang-mode.el") (autoload 'slang-mode "slang-mode" "Mode for editing slang source files") (setq auto-mode-alist (append '(("\\.sl$" . slang-mode)) auto-mode-alist))
JED
In principle, jed is a clone of emacs, written in S-Lang by John E. Davis. To run jed, enter
jed
into a terminal. It is very easy to modify and extend, since you can define and run S-Lang functions to, e.g., apply a certain task to the current region, i.e., marked text.
Keyboard Shortcuts
Most of the emacs shortcuts and |Alt+Shift+X|enter and execute S-Lang command(s)| A list of intrinsic jed functions is found here: http://www.jedsoft.org/jed/doc/jedfuns.html
Note: the keys defining the shortcuts are give in some strange format, like "^X^C" for Ctrl+X+C. The string corresponds to the character send to the terminal. You can find out this string using
sed -n l
in a terminal. Try pressing Ctrl+X+C
Configuration
jed can be configured via the .jedrc file in your home directory, which has to contain S-Lang commands only. Thus, user-defined functions can be implemented here. Customizing jed is controlled by variables. Here is an example of a simple .jedrc:
No_Backups = 1; % create no backups of edited files DISPLAY_TIME = -1; % show time in 24h format in status bar C_BRA_NEWLINE = 0; % 0 / 1 => doesn't start / starts a block in braces on a new line C_BRACE = 0; % amount of space to indent brace C_INDENT = 2; % indentation of blocks HORIZONTAL_PAN = -1; % entire window will pan LINENUMBERS = 2; % show line and column number in status bar WRAP = 1<<31-1; % effectively disables wrapmode WRAP_DEFAULT = 1<<31-1; % effectively disables wrapmode % define additional keybindings setkey("uncomment_region_or_line","^X:"); % define the color scheme to use Color_Scheme_Path += ",/home/you/share/jed/color/"; % path to additional schemes set_color_scheme("white-gm"); % define a useless function and bind it to Alt+1 public define useless() { vmessage("this is useless"); } local_setkey("useless", "^[1");
Color Scheme
In the above example, the user-defined color scheme white-gm is used. This is the S-Lang file white-gm.sl in the Color_Scheme_Path:
% A color scheme for the terminal/console with white background % % Copyright (c) 2003 Günter Milde % Released under the terms of the GNU General Public License (ver. 2 or later) % % This scheme uses only the basic color set, so it should work with all % flavours of jed (tested with jed in rxvt and Linux console). % static variable bg = "white"; set_color("normal", "black", bg); set_color("status", "yellow", "blue"); set_color("region", "yellow", "blue"); set_color("operator", "blue", bg); % +, -, etc.. set_color("number", "blue", bg); % 10, 2.71, etc.. set_color("comment", "magenta", bg);% /* comment */ set_color("string", "blue", bg); % "string" or 'char' set_color("keyword", "blue", bg); % if, while, unsigned, ... set_color("keyword1", "red", bg); % malloc, exit, etc... set_color("delimiter", "blue", bg); % {}[](),.;... set_color("preprocess", "green", bg); set_color("message", "blue", bg); set_color("error", "red", bg); set_color("dollar", "red", bg); set_color("...", "red", bg); % folding indicator set_color ("menu_char", "yellow", "blue"); set_color ("menu", "white", "blue"); set_color ("menu_popup", "white", "blue"); set_color ("menu_shadow", "blue", "black"); set_color ("menu_selection", "white", "cyan");