Some improvements

This commit is contained in:
Nikita Ivanov 2022-06-15 23:19:27 +05:00
parent 694ecd495a
commit f224b98fe4
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133

View File

@ -21,14 +21,13 @@
.. ..
. .
.de Ex .de Ex
.PP .in +4n
.IP
.EX .EX
.. ..
. .
.de Ee .de Ee
.EE .EE
.PP .in
.. ..
. .
. .
@ -58,17 +57,7 @@ ctpv \- terminal previewer
.Ys .Ys
. .
.Sy .Sy
.B \-s .RB { \-s | \-c | \-e }
.I id
.Ys
.
.Sy
.B \-c
.I id
.Ys
.
.Sy
.B \-e
.I id .I id
.Ys .Ys
. .
@ -83,27 +72,25 @@ as well as an option to define custom ones.
. .
When When
.B ctpv .B ctpv
is given is given a file, it determines an appropriate preview for it and
.I file runs its script.
(and, optionally, other arguments (see The script produces preview content and prints it to standard output.
.IR SYNOPSIS )),
it determines an appropriate preview for it and runs its script.
The script produces preview content and prints it to
.IR stdout .
. .
.SS Integration .SS Integration
. .
The following snippets should be added to configuration files
of corresponding programs:
.
.TP .TP
\fIlf\fP file manager: \fIlf\fP file manager
.EX Add this snippet to
.I lf
configuration file (usually located at
.IR \(ti/.config/lf/lfrc ).
.IP
.Ex
set previewer ctpv set previewer ctpv
set cleaner ctpvclear set cleaner ctpvclear
&ctpv -s $id &ctpv -s $id
cmd on-quit $ctpv -e $id cmd on-quit $ctpv -e $id
.EE .Ee
. .
.SS How previews are selected .SS How previews are selected
. .
@ -167,15 +154,20 @@ Kill server with ID
. .
.SH CONFIGURATION .SH CONFIGURATION
. .
The configuration file format somewhat resembles one used by .B ctpv
uses a configuration file usually located at
.IR \(ti/.config/ctpv/config
(see
.IR FILES ).
Its format somewhat resembles one used by
.IR lf . .IR lf .
There are several commands that There are several \(lqcommands\(rq that can be used to change
behavior of previews or set different settings.
.BR ctpv .
Commands are separated by newlines. Commands are separated by newlines.
Comments start with number sign Comments start with number sign
.RB ( # ) .RB ( # )
like in many other formats. like in many other formats.
.PP
. .
.SS Defining custom previews .SS Defining custom previews
. .
@ -188,11 +180,13 @@ braces (this particular one utilizes the famous
.I cowsay .I cowsay
program): program):
. .
.PP
.Ex .Ex
preview cow .moo {{ preview cow .moo {{
cowsay < "$f" cowsay < "$f"
}} }}
.Ee .Ee
.PP
. .
Running Running
.I "ctpv\ file.moo" .I "ctpv\ file.moo"
@ -200,6 +194,7 @@ where
.I file.moo .I file.moo
contains \(lqsome text\(rq will produce the following output: contains \(lqsome text\(rq will produce the following output:
. .
.PP
.Ex .Ex
\# ___________ \# ___________
\# < some text > \# < some text >
@ -218,6 +213,7 @@ contains \(lqsome text\(rq will produce the following output:
\& ||\(mi\(mi\(mi\(miw | \& ||\(mi\(mi\(mi\(miw |
\& || || \& || ||
.Ee .Ee
.PP
. .
Variable Variable
.B $f .B $f
@ -253,21 +249,25 @@ command (see
You can specify MIME type instead of filename extension You can specify MIME type instead of filename extension
in preview definition: in preview definition:
. .
.PP
.Ex .Ex
preview json_example application/json {{ preview json_example application/json {{
# preview json files # preview json files
}} }}
.Ee .Ee
.PP
. .
And you also can omit subtype part of the MIME type And you also can omit subtype part of the MIME type
by replacing it with by replacing it with
.BR * . .BR * .
. .
.PP
.Ex .Ex
preview any_text_example text/* {{ preview any_text_example text/* {{
# this one applies to all text files # this one applies to all text files
}} }}
.Ee .Ee
.PP
. .
Setting subtype to Setting subtype to
.B * .B *
@ -282,9 +282,11 @@ To alter this behavior, you can use
.B priority .B priority
command to change preview priority: command to change preview priority:
. .
.PP
.Ex .Ex
priority cat priority cat
.Ee .Ee
.PP
. .
The snippet above sets priority of preview named \(lqcat\(rq to 1, The snippet above sets priority of preview named \(lqcat\(rq to 1,
thus now it's used for all text files. thus now it's used for all text files.
@ -296,9 +298,11 @@ to set priority other than 1 (may also be negative).
.B remove .B remove
command simply removes a preview (also works for built-in ones): command simply removes a preview (also works for built-in ones):
. .
.PP
.Ex .Ex
remove cat remove cat
.Ee .Ee
.PP
. .
. .
.SH FILES .SH FILES
@ -307,8 +311,8 @@ remove cat
.I $XDG_CONFIG_HOME/ctpv/config .I $XDG_CONFIG_HOME/ctpv/config
Configuration file. If Configuration file. If
.I $XDG_CONFIG_HOME .I $XDG_CONFIG_HOME
is empty or not set, defaults to is not set, defaults to
.IR $HOME/.config . .IR \(ti/.config .
. .
. .
.SH SEE ALSO .SH SEE ALSO