/usr/share/doc/ne/html/Key-Bindings.html is in ne-doc 3.0.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>ne’s manual: Key Bindings</title>
<meta name="description" content="ne’s manual: Key Bindings">
<meta name="keywords" content="ne’s manual: Key Bindings">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="Command-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Configuration.html#Configuration" rel="up" title="Configuration">
<link href="Changing-Menus.html#Changing-Menus" rel="next" title="Changing Menus">
<link href="Configuration.html#Configuration" rel="prev" title="Configuration">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Key-Bindings"></a>
<div class="header">
<p>
Next: <a href="Changing-Menus.html#Changing-Menus" accesskey="n" rel="next">Changing Menus</a>, Up: <a href="Configuration.html#Configuration" accesskey="u" rel="up">Configuration</a> [<a href="Command-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Key-Bindings-1"></a>
<h3 class="section">5.1 Key Bindings</h3>
<a name="index-Key-bindings"></a>
<a name="index-Configuring-the-keyboard"></a>
<p><code>ne</code> allows you to associate any keystroke with any command. To
accomplish this task, you have to create a (possibly UTf-8) file named
<samp>.keys</samp> in your <samp>~/.ne</samp> directory. You can change
the default name (possibly specifying a complete path) using the
<code>--keys</code> argument (see <a href="Arguments.html#Arguments">Arguments</a>).
</p>
<p>The format of the file is very simple: each line starting with the ‘<samp>KEY</samp>’
sequence of capital characters is considered the description of a key binding.
Each line starting with ‘<samp>SEQ</samp>’ binds a character sequence to a key.
All other lines are considered comments. The format of a key binding
description is
</p>
<div class="example">
<pre class="example">KEY <var>hexcode</var> <var>command</var>
</pre></div>
<p>The <var>hexcode</var> value is the <small>ASCII</small> code of the keystroke. (For
special keys such as <tt class="key">Insert</tt> or function keys, you should take a
look at the file <samp>default.keys</samp> that comes with <code>ne</code>’s
distribution: it contains a complete, commented definition of
<code>ne</code>’s standard bindings that you can modify with a trial-and-error
approach.) The easiest way to see the code <code>ne</code> uses for a given
key is by using the <a href="KeyCode.html#KeyCode">KeyCode</a> command. It prompts you to press a
key, then reports the code for that key on the status bar.
</p>
<p>You can write just the hexadecimal digits, nothing else is
necessary (but a prefixing ‘<samp>0x</samp>’ is tolerated). For instance,
</p>
<div class="example">
<pre class="example">KEY 1 MoveSOL
</pre></div>
<p>binds to <kbd><span class="key">Control</span>-A</kbd> the action of moving to the start
of a line, while
</p>
<div class="example">
<pre class="example">KEY 101 LineUp
</pre></div>
<p>binds to the “cursor-up” key the action of moving the cursor
one line up.
</p>
<p><var>command</var> can be any <code>ne</code> command, including <code>Escape</code>
(which allows reconfiguring the menu activator) and <code>Macro</code>, which
allows binding complex sequences of actions to a single keystroke. The binding
of a macro is very fast because on the first call the macro is cached in memory.
See <a href="Macro.html#Macro">Macro</a>.
</p>
<p>Note that you cannot <em>ever</em> redefine <tt class="key">Return</tt> or <tt class="key">Escape</tt>. This
is a basic issue—however brain damaged is the current configuration, you will
always be able to exploit fully the menus and the command line.
</p>
<p>Besides the “standard” combinations (e.g.,
<kbd><span class="key">Control</span>-<var>letter</var></kbd>), it possible to program combinations
based on the <tt class="key">Meta</tt> key (a.k.a. <tt class="key">Alt</tt>). The situation in this
case is a bit more involved, because depending on the terminal emulator you are
using, the effect of the <tt class="key">Meta</tt> key can be widely different. For
instance, <code>xterm</code> raises the eighth bit of a character, so, for
instance,
</p>
<div class="example">
<pre class="example">KEY 81 MoveSOF
</pre></div>
<p>binds <kbd><span class="key">Control</span>-<span class="key">Meta</span>-a</kbd> to the action of moving to the
start of the document. However, <code>gnome-terminal</code> will emit the
character of ASCII code 1 prefixed with ESC instead (“<code>\x1b\x01</code>”). To handle this case,
<code>ne</code> provides codes from 180 on for <em>simulated <tt class="key">Meta</tt>
sequences</em>: for instance,
</p>
<div class="example">
<pre class="example">KEY 181 MoveSOF
</pre></div>
<p>binds the abovementioned sequence to the same action as
before. In general, the code 180+<var>x</var> corresponds to the sequence
ESC followed by the ASCII character of code <var>x</var>. Note that some of
these sequences may be disabled, if they conflict with existing sequences
of your terminal (for instance, ESC followed by ‘<samp>O</samp>’ is always
disabled because it prefixes several built-in keyboard sequences).
</p>
<p>As a final note, we remark that typing <kbd><span class="key">Meta</span>-a</kbd> on
<code>gnome-terminal</code> will produce an ESC followed by ‘<samp>a</samp>’ (“<code>\x1ba</code>”). Since it
is obviously easier to press just <tt class="key">Meta</tt> rather than <tt class="key">Meta</tt> and
<tt class="key">Control</tt> at the same time, it is a good idea to associate the same
sequence also to this combination, using
</p>
<div class="example">
<pre class="example">KEY 1E1 MoveSOF
</pre></div>
<p>Moreover, this setting provides the user with a second choice: one can
press <tt class="key">Escape</tt> followed by a letter instead of using modifiers.
</p>
<p>This is the approach used by default in <code>ne</code>: this way,
<tt class="key">Control</tt> with <tt class="key">Meta</tt> plus a letter should always work, and
<tt class="key">Meta</tt> should work sometimes (of course, if you’re sure to use
always the same kind of emulator you can bind more features). Again, the
best place to look at it’s <samp>default.keys</samp>.
</p>
<p>As stated above, each line starting with ‘<samp>SEQ</samp>’ binds a character sequence
to a key code. The format for a ‘<samp>SEQ</samp>’ binding is
</p>
<div class="example">
<pre class="example">SEQ "<var>sequence</var>" <var>hexcode</var>
</pre></div>
<p>where "<var>sequence</var>" is a double-quoted string of characters
(which can include escaped hexadecimals) followed by a hexadecimal key code
as described above for ‘<samp>KEY</samp>’ definitions.
</p>
<p>You should rarely need this, as properly configured systems already do
this for most keys. However, some key combinations (<tt class="key">Control</tt> in
conjunction with cursor keys for example) are usually not defined. If you
know the character sequence your system generates for such a combination, you may use
‘<samp>SEQ</samp>’ to bind that sequence to a particular key code if that sequence
isn’t already defined on your system. For example,
<tt class="key">Control</tt>-“cursor-left” may generate the sequence
<code>\x1b[1;5D</code>. The following lines bind that sequence to the <tt class="key">f10</tt>
key code ‘<samp>14A</samp>’, then bind that key code to the ‘<samp>HELP</samp>’ command.
</p>
<div class="example">
<pre class="example">SEQ "\x1b[1;5D" 14A
KEY 14A HELP
</pre></div>
<p>Sequences are inherently terminal- or terminal emulator-specific, so
their utility will vary depending on how many emulators you use. At least
they give you the posibility to use keys or key combinations that aren’t
covered by <code>curses</code>.
</p>
<p>The key binding file is parsed at startup. If something does not work,
<code>ne</code> exits displaying an error message. If you want <code>ne</code> to skip
parsing the key binding file (for instance, to correct the broken
file), just give <code>ne</code> the <code>--no-config</code> argument. See <a href="Arguments.html#Arguments">Arguments</a>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Changing-Menus.html#Changing-Menus" accesskey="n" rel="next">Changing Menus</a>, Up: <a href="Configuration.html#Configuration" accesskey="u" rel="up">Configuration</a> [<a href="Command-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|