This commit is contained in:
sayanarijit 2022-06-06 14:14:13 +00:00
parent 8b65bd67dd
commit 88dbd677da
5 changed files with 76 additions and 46 deletions

View File

@ -155,51 +155,62 @@
<p>If you need help debugging or understanding key bindings DYI way, you can
create a <code>test.lua</code> file with the following script, launch xplr with
<code>xplr --extra-config test.lua</code>, press <code>#</code> and play around.</p>
<pre><code class="language-lua">xplr.config.modes.builtin.default.key_bindings.on_key[&quot;#&quot;] = {
help = &quot;test&quot;,
messages = {
&quot;PopMode&quot;,
{ SwitchModeCustom = &quot;test&quot; },
},
}
xplr.config.modes.custom.test = {
name = &quot;test&quot;,
key_bindings = {
<pre><code class="language-lua">-- The global key bindings inherited by all the modes.
xplr.config.general.global_key_bindings = {
on_key = {
[&quot;1&quot;] = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
a = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
[&quot;`&quot;] = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
tab = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
esc = {
help = &quot;escape&quot;,
messages = {
{ LogInfo = &quot;global on_key(esc) called&quot; },
&quot;PopMode&quot;,
},
},
[&quot;ctrl-c&quot;] = {
help = &quot;terminate&quot;,
messages = {
&quot;Terminate&quot;,
},
},
},
}
-- Press `#` to enter the `debug key bindings` mode.
xplr.config.modes.builtin.default.key_bindings.on_key[&quot;#&quot;] = {
help = &quot;test&quot;,
messages = {
&quot;PopMode&quot;,
{ SwitchModeCustom = &quot;debug_key_bindings&quot; },
},
}
-- The `debug key bindings` mode.
xplr.config.modes.custom.debug_key_bindings = {
name = &quot;debug key bindings&quot;,
key_bindings = {
on_key = {
[&quot;1&quot;] = {
messages = {
{ LogInfo = &quot;on_key(1) called&quot; },
},
},
a = {
messages = {
{ LogInfo = &quot;on_key(a) called&quot; },
},
},
[&quot;`&quot;] = {
messages = {
{ LogInfo = &quot;on_key(`) called&quot; },
},
},
tab = {
messages = {
{ LogInfo = &quot;on_key(tab) called&quot; },
},
},
f1 = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
{ LogInfo = &quot;on_key(f1) called&quot; },
},
},
},

View File

@ -459,6 +459,10 @@ Defines where to show borders for the selection panel.</p>
<p>Set it to a file path to start fifo when xplr loads.
Generally it is used to integrate with external tools like previewers.</p>
<p>Type: nullable string</p>
<h4 id="xplrconfiggeneralglobal_key_bindings"><a class="header" href="#xplrconfiggeneralglobal_key_bindings">xplr.config.general.global_key_bindings</a></h4>
<p>Use it to define a set of key bindings that are available by default in
every <a href="https://xplr.dev/en/mode">mode</a>. They can be overwritten.</p>
<p>Type: <a href="https://xplr.dev/en/configure-key-bindings#key-bindings">Key Bindings</a></p>
</main>

View File

@ -781,6 +781,10 @@ Defines where to show borders for the selection panel.</p>
<p>Set it to a file path to start fifo when xplr loads.
Generally it is used to integrate with external tools like previewers.</p>
<p>Type: nullable string</p>
<h4 id="xplrconfiggeneralglobal_key_bindings"><a class="header" href="#xplrconfiggeneralglobal_key_bindings">xplr.config.general.global_key_bindings</a></h4>
<p>Use it to define a set of key bindings that are available by default in
every <a href="https://xplr.dev/en/mode">mode</a>. They can be overwritten.</p>
<p>Type: <a href="https://xplr.dev/en/configure-key-bindings#key-bindings">Key Bindings</a></p>
<div style="break-before: page; page-break-before: always;"></div><h3 id="node-types"><a class="header" href="#node-types">Node Types</a></h3>
<p>This section defines how to deal with different kinds of nodes (files,
directories, symlinks etc.) based on their properties.</p>
@ -1409,51 +1413,62 @@ of <a href="modes.html">modes</a> and the key mappings for each mode.</p>
<p>If you need help debugging or understanding key bindings DYI way, you can
create a <code>test.lua</code> file with the following script, launch xplr with
<code>xplr --extra-config test.lua</code>, press <code>#</code> and play around.</p>
<pre><code class="language-lua">xplr.config.modes.builtin.default.key_bindings.on_key[&quot;#&quot;] = {
help = &quot;test&quot;,
messages = {
&quot;PopMode&quot;,
{ SwitchModeCustom = &quot;test&quot; },
},
}
xplr.config.modes.custom.test = {
name = &quot;test&quot;,
key_bindings = {
<pre><code class="language-lua">-- The global key bindings inherited by all the modes.
xplr.config.general.global_key_bindings = {
on_key = {
[&quot;1&quot;] = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
a = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
[&quot;`&quot;] = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
tab = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
},
},
esc = {
help = &quot;escape&quot;,
messages = {
{ LogInfo = &quot;global on_key(esc) called&quot; },
&quot;PopMode&quot;,
},
},
[&quot;ctrl-c&quot;] = {
help = &quot;terminate&quot;,
messages = {
&quot;Terminate&quot;,
},
},
},
}
-- Press `#` to enter the `debug key bindings` mode.
xplr.config.modes.builtin.default.key_bindings.on_key[&quot;#&quot;] = {
help = &quot;test&quot;,
messages = {
&quot;PopMode&quot;,
{ SwitchModeCustom = &quot;debug_key_bindings&quot; },
},
}
-- The `debug key bindings` mode.
xplr.config.modes.custom.debug_key_bindings = {
name = &quot;debug key bindings&quot;,
key_bindings = {
on_key = {
[&quot;1&quot;] = {
messages = {
{ LogInfo = &quot;on_key(1) called&quot; },
},
},
a = {
messages = {
{ LogInfo = &quot;on_key(a) called&quot; },
},
},
[&quot;`&quot;] = {
messages = {
{ LogInfo = &quot;on_key(`) called&quot; },
},
},
tab = {
messages = {
{ LogInfo = &quot;on_key(tab) called&quot; },
},
},
f1 = {
messages = {
{ LogInfo = &quot;on_key called&quot; },
{ LogInfo = &quot;on_key(f1) called&quot; },
},
},
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long