~leon_plickat/nfm

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Add nfm.ini(5) man page

Details
Message ID
<20220514162631.5987-1-mail@hmachet.com>
DKIM signature
pass
Download raw message
Patch: +224 -2
---
 build.zig     |   1 +
 doc/nfm.1     |   4 +-
 doc/nfm.ini.5 | 221 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 224 insertions(+), 2 deletions(-)
 create mode 100644 doc/nfm.ini.5

diff --git a/build.zig b/build.zig
index 7152c71430f8..99fe6d2025f5 100644
--- a/build.zig
@@ -12,6 +12,7 @@ pub fn build(b: *Builder) void {
    exe.install();

    b.installFile("doc/nfm.1", "share/man/man1/nfm.1");
    b.installFile("doc/nfm.ini.5", "share/man/man5/nfm.ini.5");

    const run_cmd = exe.run();
    run_cmd.step.dependOn(b.getInstallStep());
diff --git a/doc/nfm.1 b/doc/nfm.1
index 9435f1445cac..943839b16be6 100644
--- a/doc/nfm.1
+++ b/doc/nfm.1
@@ -107,7 +107,7 @@ runtime by opening an empty command prompt and inserting file paths yourself.
This is a list of which functions are bound to which keys by default.
If you are interested in the description of the bound functions or want to know
how to configure your own binds, read
.BR nfm (5).
.BR nfm.ini (5).
.
.ad l
.RS
@@ -226,4 +226,4 @@ Leon Henrik Plickat
.
.
.SH SEE ALSO
.BR nfm (5)
.BR nfm.ini (5)
diff --git a/doc/nfm.ini.5 b/doc/nfm.ini.5
new file mode 100644
index 000000000000..63ca36bafd3a
--- /dev/null
+++ b/doc/nfm.ini.5
@@ -0,0 +1,221 @@
.TH NFM.INI 5 2022-05-09 "git.sr.ht/~leon_plickat/nfm"
.
.SH NAME
.P
.B nfm.ini
\- Configuration file for
.BR nfm (1)
.
.SH DESCRIPTION
.P
On startup
.B nfm
will look for a file in the following locations, in this order:
.IP
\(bu
.IR $XDG_CONFIG_HOME/nfm/config.ini .
.IP
\(bu
If unset
.I $XDG_CONFIG_HOME
defaults to
.I \(ti/.config/
.IP
\(bu
.I /etc/nfm/config.ini
.P
Format of the
.I ini
file is:
.IP
.EX
[<section>]
# This is a commentary (Note that \(aq;\(aq is not a commentary)
<option-name> = <value>;
.EE
.P
An example config with the default values is provided in the
.I example/
directory.
.
.SH SECTION
.
.SS main
.TP
.B opener
Default opener to use when committing files.
.IP
\(bu Default: xdg-open
.
.SS keybinds
.P
Add a keybind, if the keybind already exists it will be overwritten by the one
in the config.
.IP
<key> = <function>;
.P
Modifiers allowed:
.IP
.EX
\(bu \fBM\-\fR<key> \- Alt
\(bu \fBC\-\fR<key> \- Control
.EE
.
.SS bookmarks
.P
Add a keybind to directly open a directory when you are in the
.B bookmark
view.
.IP
<key> = \(dq<directory>\(dq;
.P
For example, add
.I \(ti/image/
to \(aqi\(aq and
.I \(ti/.config/nfm/
to \(aqAlt-o\(aq:
.IP
.EX
[bookmark]
i = \(dq~/image\(dq;
M-o = \(dq\(ti/.config/nfm\(dq;
.EE
.
.SH FUNCTIONS
.P
.BR nfm (1)
provides some built-in functions that you can bind to a key.
.TP
.B cursor-move-down
Move the cursor down.
.TP
.B cursor-move-up
Move the cursor up.
.TP
.B enter-parent-dir
Go back to the parent directory.
.TP
.B commit-file-at-cursor
Open the file under the cursor.
.TP
.B cursor-move-to-top
Move the cursor to the top of the list.
.TP
.B cursor-move-to-bottom
Move the cursor to the bottom of the list.
.TP
.B cursor-move-page-up
Move the cursor to the top of the list.
.TP
.B cursor-move-page-down
Move the cursor to the bottom of the list.
.TP
.B jump-back
Go back to the initial directory.
.TP
.B toggle-hidden-files
Display hidden files.
.TP
.B commit-marks
Open the files marked.
.TP
.B clear-marks
Remove the marks to all files marked.
.TP
.B invert-marks
Invert the files marked. That is, files marked will be unmarked and unmarked
one will be marked.
.TP
.B mark-file-at-cursor
Marked the file under the cursor.
.TP
.B cursor-move-to-next-mark
Move cursor to the next marked file.
.TP
.B open-select
Open select input buffer.
.TP
.B open-search
Open the search input buffer.
.TP
.B cursor-move-to-next-match
Move cursor to the next match of the search.
.TP
.B set-view-files
Open the nav view.
.TP
.B toggle-view-filesystems
Toggle the filesystems view.
.TP
.B toggle-view-bookmarks
Toggle the bookmarks view.
.TP
.B quit
Quit
.BR nfm .
.TP
.B open-cmd
Open the command input buffer.
.P
The
.B open-cmd()
.RB and\  run()
functions takes strings arguments and allows to use custom shell commands.
.P
Commands will be executed with:
.IP
/bin/sh \-c <command>
.P
There is some variables that you can use in the command strings:
.RS
.TP
.B %f
Replace with the selected file name.
.TP
.B %c
Put the cursor at this position when opening the command input buffer.
.RE
.TP
.BI open-cmd (\(dq<command>\(dq)
The
.B open-cmd()
function open the command input buffer with a shell command already written
in it. You can then edit it or run the command with the
.B enter
key.
.IP
For example:
.IP
.EX
.in +4n
C-m = open-cmd(mkdir );
x = open-cmd(trash-put %f);
o = open-cmd(%c %f); # The cursor will be put at the place before the
                       file name.
.EE
.TP
.BI run (\(dq<command>\(dq)
The
.B run()
function is very powerful, it works as
.B open-cmd()
but instead of opening the command input buffer, it will runs the command
immediately without any confirmation.
.IP
The command is run in foreground, meaning you can use TUI applications.
.IP
For example:
.IP
.EX
.in +4n
I = run(mediainfo %f | less);
X = run(hexedit %f);
M-f = run("${EDITOR:-kak}" "$(fd -tf | fzy -l 20)");
.EE
.
.SH SEE ALSO
.P
.al
.nh
.BR nfm (1)
.
-- 
2.36.1
Reply to thread Export thread (mbox)