124 lines
4.1 KiB
HTML
124 lines
4.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
|
<title>Storing tools in files</title>
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<DIV CLASS="header" ID="header">
|
|
|
|
|
|
<table width="100%"><tr valign="top">
|
|
<td width="33%" align="left">Previous: <a href="prefs-user-tools.html">Managing tools</a></td>
|
|
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
|
|
<td width="33%" align="right">Next: <a href="user-tools-python.html">Python scripts</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
|
|
<H3>Storing tools in files</H3>
|
|
|
|
<!-- ##user-tools-files## -->
|
|
<P>
|
|
It is possible to create tools without using the <I>Preferences</I> dialog,
|
|
they can be stored in files in <CODE>tools</CODE> subfolder of the medit data
|
|
folders (or <CODE>tools-context</CODE> for tools which appear in the document context
|
|
menu). In particular, on Unix systems you can place files into
|
|
<CODE>$HOME/.local/share/medit/tools/</CODE> folder.
|
|
</P>
|
|
<P>
|
|
Names of the files in the <CODE>tools</CODE> folder are used as their menu item
|
|
labels, after stripping first three characters, so you can use trhee-character
|
|
prefix to affect the order of the menu items, e.g. you can have <CODE>00-Do Something</CODE>,
|
|
<CODE>01-Another tool</CODE> files to have them in that order in the menu. The files
|
|
may be of three types: files with extension "<CODE>.py</CODE>", they will be used
|
|
as Python scripts; files with extension "<CODE>.lua</CODE>", they will be used
|
|
as Lua scripts; and executable files, they will be executed in the same way
|
|
as shell commands.
|
|
</P>
|
|
<P>
|
|
To set parameters for a tool, place them on the first or the second line of the file in
|
|
the following format:
|
|
</P>
|
|
<PRE>
|
|
!! <em>key</em>=<em>value</em>; <em>key</em>=<em>value</em>; ... !!
|
|
</PRE>
|
|
<P></P>
|
|
<P>
|
|
<I>key</I> may be one of the following:
|
|
</P>
|
|
<TABLE BORDER="1">
|
|
<TR>
|
|
<TD><CODE>position</CODE></TD>
|
|
<TD>it can be <CODE>start</CODE> or <CODE>end</CODE>, and defines whether the menu item will be located at the start or at the end of the menu.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>id</CODE></TD>
|
|
<TD>the tool identificator.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>name</CODE></TD>
|
|
<TD>the tool name, i.e. the label used in the menu item. Overrides the file name.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>os</CODE></TD>
|
|
<TD><CODE>windows</CODE> or <CODE>unix</CODE>. If specified, then the tool will not be used when medit is running on a different operating system.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>accel</CODE></TD>
|
|
<TD>default keyboard accelerator used to invoke this tool.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>menu</CODE></TD>
|
|
<TD>the menu to place this tool into. By default the tools are located in the Tools menu, but they can be as well put into any other menu.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>langs</CODE></TD>
|
|
<TD>comma-separated list of languages for which this tool will be enabled.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>file-filter</CODE></TD>
|
|
<TD>defines for which files this tool will be enabled. The value has the same format as in the <I>Preferences</I> dialog.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>options</CODE></TD>
|
|
<TD>same as the <I>Options</I> entry content in the <I>Preferences</I> dialog.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
In addition to these, you can set input and output options for executable files:
|
|
</P>
|
|
<TABLE BORDER="1">
|
|
<TR>
|
|
<TD><CODE>input</CODE></TD>
|
|
<TD>can be <CODE>none</CODE>, <CODE>lines</CODE>, <CODE>selection</CODE>, or <CODE>doc</CODE>.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>output</CODE></TD>
|
|
<TD>can be <CODE>none</CODE>, <CODE>async</CODE>, <CODE>pane</CODE>, <CODE>insert</CODE>, or <CODE>new-doc</CODE>.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD><CODE>filter</CODE></TD>
|
|
<TD>the output filter name.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
</ul>
|
|
|
|
<hr>
|
|
<table width="100%"><tr valign="top">
|
|
<td width="33%" align="left">Previous: <a href="prefs-user-tools.html">Managing tools</a></td>
|
|
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
|
|
<td width="33%" align="right">Next: <a href="user-tools-python.html">Python scripts</a></td>
|
|
</tr></table>
|
|
|
|
</BODY></HTML>
|
|
|