Man: Difference between revisions
From wikinotes
(4 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
|} | |} | ||
</blockquote><!-- Tutorials --> | </blockquote><!-- Tutorials --> | ||
= Locations = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| <code>${XDG_CONFIG_HOME}/.lesskey</code> || user custom keybindings | |||
|- | |||
| <code>${PREFIX}/etc/syslesskey</code><br><code>C:\_syslesskey</code><br><code>C:\syslesskey.ini</code> || global custom keybindings | |||
|- | |||
|} | |||
</blockquote><!-- Locations --> | |||
= Configuration = | = Configuration = | ||
<blockquote> | <blockquote> | ||
== keybindings == | |||
<blockquote> | |||
Keybindings are set in your pager. Chances are you are interested in [[gnu less]]. | |||
</blockquote><!-- keybindings --> | |||
= Width = | = Width = | ||
<blockquote> | <blockquote> | ||
Line 33: | Line 50: | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
export MANROFFOPT="-P -c" | |||
# on linux, you can control less colours using -D | # on linux, you can control less colours using -D | ||
# -D{what}{modifier}{color} | # -D{what}{modifier}{color} | ||
Line 49: | Line 68: | ||
</blockquote><!-- Colours --> | </blockquote><!-- Colours --> | ||
</blockquote><!-- Configuration --> | </blockquote><!-- Configuration --> | ||
= Tips/Tricks = | |||
<blockquote> | |||
== Table of Contents == | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
#!/usr/bin/env bash | |||
# choose from table-of-contents in FZF for a man-page. | |||
header="$(man $@ | grep -n -E '^[A-Z]' | fzf +m)" | |||
[ $? -ne 0 ] && exit 1 | |||
linenum=$(echo $header | awk -F':' '{ print $1 }') | |||
env MANPAGER="${MANPAGER} +${linenum}G" man "$@" | |||
</syntaxhighlight> | |||
</blockquote><!-- Table of Contents --> | |||
</blockquote><!-- Tips/Tricks --> |
Latest revision as of 17:17, 19 February 2024
Unix manual pages.
Tutorials
gentoo wiki https://wiki.gentoo.org/wiki/Man_page
Locations
${XDG_CONFIG_HOME}/.lesskey
user custom keybindings ${PREFIX}/etc/syslesskey
C:\_syslesskey
C:\syslesskey.ini
global custom keybindings
Configuration
keybindings
Keybindings are set in your pager. Chances are you are interested in gnu less.
Width
Set manpage width with
$MANWIDTH
.man() { local width local default_width default_width=100 width=$(tput cols) test "$width" -gt "$default_width" && width=$default_width env MANWIDTH=$width man "$@" }Colours
export MANROFFOPT="-P -c" # on linux, you can control less colours using -D # -D{what}{modifier}{color} env MANPAGER='less -R -DdY -Duw --mouse --wheel-lines=5' man man # across linux and BSD, you can set environment variables for less colours # https://superuser.com/questions/117841/when-reading-a-file-with-less-or-more-how-can-i-get-the-content-in-colors export LESS_TERMCAP_mb=$'\E[1;31m' # begin bold export LESS_TERMCAP_md=$'\E[1;36m' # begin blink export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video export LESS_TERMCAP_se=$'\E[0m' # reset reverse video export LESS_TERMCAP_us=$'\E[1;32m' # begin underline export LESS_TERMCAP_ue=$'\E[0m' # reset underline
Tips/Tricks
Table of Contents
#!/usr/bin/env bash # choose from table-of-contents in FZF for a man-page. header="$(man $@ | grep -n -E '^[A-Z]' | fzf +m)" [ $? -ne 0 ] && exit 1 linenum=$(echo $header | awk -F':' '{ print $1 }') env MANPAGER="${MANPAGER} +${linenum}G" man "$@"