Medit
From FrugalWiki
i18n |
---|
English |
Dansk |
Français |
Magyar |
Contents |
Medit
Light and simple text editor.
Features
- Syntax highlighting
- Configurable keyboard accelerators
- Extensible with plugins ( C, Python ) and tools ( Python, Lua, shell script )
Installation
Documentation
- No online documentation
- file:///usr/share/doc/medit/help/index.html installed from the package ( F1 in MEdit opens it in your browser )
Tools
Warning: The MEdit tools Lua API changed radically in version 1.0.0, old API and new API are incompatible.
Lua tools
Small scripts can be set up as tools in the Edit | Preferences... | Tools dialog.
When a tool's Files and Options conditions are matching the currently edited content, the tool is listed in the Tools menu or the context menu, depending on how it was defined.
To call the tools easier is better to associate shortcuts to them through Edit | Configure Shortcuts... | Tools
Tip: The following tools were written for MEdit older than version 1.0.0.
Duplicate current line
InsertText(LineEnd(),"\n"..GetText(LineStart(),LineEnd())) Down()
Delete current line
DeleteText(LineStart(),LineEnd()+1)
Move current line up
pos=GetInsert() start=LineStart() lend=LineEnd() for i=start,pos-1 do Left() end Select(lend-start) Cut() Delete() Up() NewLine() Up() Paste() for i=pos,lend-1 do Left() end
Move current line down
pos=GetInsert() start=LineStart() lend=LineEnd() for i=start,pos-1 do Left() end Select(lend-start) Cut() Delete() Down() NewLine() Up() Paste() for i=pos,lend-1 do Left() end
Selection to lowercase
Insert(Selection():lower())
Insert date & time
Note : if a selection exists, it will be used as format string.
sel=Selection() if sel then Insert(os.date(sel)) else Insert(os.date()) end
Shell tools
View man page
- Input
- Selection
- Output
- None, asynchronous
xargs -I '{}' xterm -T "man {}" -e bash -c "man {}"
Python tools
Tip: The following tools were written for MEdit version 1.0.0.
Duplicate line
end={ moo.LE_UNIX:'\n', moo.LE_MAC:'\r', moo.LE_WIN32:'\r\n', moo.LE_NATIVE:'\n' }[doc.get_line_end_type()] buffer = doc.get_buffer() line = doc.get_line_at_cursor() this = doc.get_line_text() doc.insert_text(this + end, buffer.get_iter_at_offset(doc.get_pos_at_line_end(line).get_offset() + 1)) doc.set_cursor_pos(buffer.get_iter_at_offset(doc.get_cursor_pos().get_offset() + len(this) + 1))
Delete line
buffer = doc.get_buffer() line = doc.get_line_at_cursor() doc.delete_text(doc.get_pos_at_line(line), buffer.get_iter_at_offset(doc.get_pos_at_line_end(line).get_offset() + 1))
Delete end of line
doc.delete_text(doc.get_cursor_pos(), doc.get_pos_at_line_end(doc.get_line_at_cursor()))
Move line up
line = doc.get_line_at_cursor() if line != 0: buffer = doc.get_buffer() this = doc.get_line_text() that = doc.get_line_text(line - 1) doc.replace_text(doc.get_pos_at_line(line - 1), doc.get_pos_at_line_end(line - 1), this) doc.set_cursor_pos(buffer.get_iter_at_offset(doc.get_cursor_pos().get_offset() - len(this) - 1)) doc.replace_text(doc.get_pos_at_line(line), doc.get_pos_at_line_end(line), that)
Move line down
line = doc.get_line_at_cursor() if line != doc.get_line_count() - 1: buffer = doc.get_buffer() this = doc.get_line_text() that = doc.get_line_text(line + 1) doc.replace_text(doc.get_pos_at_line(line + 1), doc.get_pos_at_line_end(line + 1), this) doc.set_cursor_pos(buffer.get_iter_at_offset(doc.get_cursor_pos().get_offset() + len(this) + 1)) doc.replace_text(doc.get_pos_at_line(line), doc.get_pos_at_line_end(line), that)
To lowercase
if doc.has_selection(): doc.replace_selected_text(doc.get_selected_text().lower())
Links
- http://mooedit.sourceforge.net/ http://medit.bitbucket.org/ Official site
- http://sourceforge.net/projects/mooedit/ SourceForge project
- https://bitbucket.org/medit/medit Bitbucket project
- http://frugalware.org/packages/14553 Frugalware package
- http://sites.google.com/site/tool4medit/ Tools collection ( third party )