MEdit - Programmable Text Editor
Profiles
This page lists the profiles that are ready to use.
Do you have your own profile that you think is interesting? Send it to me and I'll put it on this page.
empty
You've already seen the empty profile in the tutorial.
It contains only one command: New file, which opens new
window for editing.
The only reason for this profile to exist is to give you a starting
point to exercise and to create your own profiles, if you think that
none of the others is good as a basis, but I'd rather suggest that you
create your own profiles by cloning existing ones.
pro
The pro profile contains a bunch of commands
that I think
can be useful in editing generic text files.
This is also a default profile.
Commands:
- New file - opens new window for editing
- Duplicate - opens new window with a copy of what is in the current window (I've found it convenient when editing important files)
- Open file - opens selected file
- Reload file - reloads the currently edited file
- Save file - saves file (it can ask you about file name, if there is no one yet)
- Save file as
- Close file - closes the current window
- Find - allows to search through the text, using exact matching or regular expressions
- Replace - replaces text in a file or in a selection, with various options
- Goto line - allows to jump immediately to the given line
- Set up mark - allows to mark the current place in the text and later come back to it
- Goto mark - jumps to one of marks
- Insert prefix - prepends some text to every line in the selected block
- Append postfix - appends some text to every line in the block
- Trim left - removes white characters from the beginning of each line in the block
- Trim right - removes white characters from the end of each line in the block
- Trim both sides
- To lower - changes all characters to lowercase
- To upper - changes all characters to uppercase
- Statistics - displays in the auxiliary window various statistics about the text
- Syntax full rescan - runs through all the text and highlights syntax
- About MEdit - displays the "about" message
- editor appearance - this is a script command that is executed automatically when the profile is loaded, it allows you to set many different options, like fonts, colors, wrapping, etc.
- editor behavior - it is executed automatically for every new window and allows you to set options managing the behavior, like autoindentation, when and where the back-ups are stored, etc.
- key bindings - executed automatically for every new window, defines keys (this includes accelerators)
- syntax rules - defines tag configurations and syntax rules (they can be defined in the form of regular expressions) - the syntax rules in this profile are completely idiotic, but are meant to show you how to write your own
Most of the commands display some information in the auxiliary
window.
In addition, there is a convenience menu bound to right-click on the
main window, where all the commands are grouped according to their
separators.
Note:
The syntax-highlighting engine is line-oriented and cannot operate on
patters spanning more than one line of text. It can be inconvenient in
environments where logical tokens can span many lines (for example
block comments in C and C++), but I have not found it to be a real
problem.
You can, of course, change the highlighting engine to fit your
particular needs. This is exactly what "programmable editor" means.
Note:
The syntax highlighting engine is based on regular expressions. If you
define many complicated rules for pattern matching (like in the cpp
profile), then be aware that full syntax rescan can take some time,
especially with bigger files.
On my machine, scanning a file that has more than thousand lines can
take a couple of seconds, and during that time MEdit seems to freeze.
During normal editing, only current line is taken for analysis and this
is always done on-the-fly and as an idle task, so that there are no
delays that would influence the comfort of work.
Note:
There is a naming convention in the list of commands (of course, you do
not have to follow it).
- Separators begin by "-- ", for example "-- File"
- Runnable script commands begin by capital letter, for example "New file"
- Text commands (macros) begin by small letter
- The scripts that are executed automatically, but at the same time are meant to be easily modified by user, begin by small letter, for example "editor appearance"
The last category are "option scripts". If you want to change some of the settings, open the script for editing (right-click on the list of commands followed by "Script" followed by "Edit script"). The settings are well commented, so you should find it easy to modify them, even if you are not a Tcl programmer.
cpp
The cpp profile was created for C and C++
programmers.
It contains all the commands that the pro profile has,
and provides some in addition:
- header paths - executed when the profile is loaded, defines the paths where header files should be searched
- Open header - allows to quickly find a header with the given name and open it in new editing window
- Indent - indents a block of code
- Unindent
- Comment - comments a block of text (a block of C++ code)
- Uncomment
- hello medit - inserts a boilerplate for a basic C++ program
The cpp profile defines syntax rules
so
that the C++ code looks quite nice (at least in my opinion). Feel free
to change the settings (colors, fonts, etc.).
The important thing in this profile is that the lines with #include
directives are specially highlighted and have mouse bindings so that
when you double-click on such a line, the appropriate header will open
in a new window.
tcl
The tcl profile was created for Tcl programmers.
It contains all the commands that the pro profile has,
and provides some in addition:
- Indent - indents a block of code
- Unindent
- Comment - comments a block of text (a block of Tcl code)
- Uncomment
The tcl profile defines syntax rules
for
Tcl.
html
The html profile was created for editing HTML
files.
It contains all the commands that the pro profile has,
and provides some in addition:
- simple page - insert the boilerplate for simple HTML page
- Comment - comments a block of text
- Uncomment
- Entify - changes the special characters: < > " & into HTML entities
- Unentify
- ... and a bunch of common HTML elements
The html profile defines syntax rules
for
HTML.
latex
The latex profile was created for editing LaTeX
files.
It contains all the commands that the pro profile has and
defines specific syntax rules for LaTeX.