|
@@ -181,6 +181,7 @@ norm_name() {
|
|
|
eman() {
|
|
|
# Dir we are storing the converted files
|
|
|
local -r base_dir='/tmp/autoless'
|
|
|
+ local -r convert='groff -spte -mandoc -Thtml'
|
|
|
local -a pages_arr
|
|
|
|
|
|
mkdir $base_dir 2>/dev/null
|
|
@@ -190,14 +191,19 @@ eman() {
|
|
|
# Find the path to the page and format its name
|
|
|
local page=$(man -w $page)
|
|
|
(($? != 0)) && continue # Skip missing pages
|
|
|
-
|
|
|
+
|
|
|
# Format the page name
|
|
|
local page_base=$(basename $page)
|
|
|
- local page_path=$base_dir/${page_base/bz2/html}
|
|
|
+ local page_path=$base_dir/${page_base/%.*/.html}
|
|
|
pages_arr+=($page_path)
|
|
|
|
|
|
- # Convert pages to HTML
|
|
|
- bzcat $page | groff -spte -mandoc -Thtml >${page_path} 2>/dev/null
|
|
|
+ # Convert to HTML
|
|
|
+ if [[ $page_base == *bz2* ]] ; then
|
|
|
+ bzcat $page | $convert >${page_path} 2>/dev/null
|
|
|
+ else
|
|
|
+ # Handle uncompressed files
|
|
|
+ $convert $page >${page_path} 2>/dev/null
|
|
|
+ fi
|
|
|
done
|
|
|
|
|
|
elinks -force-html ${pages_arr[@]}
|
|
@@ -288,7 +294,6 @@ complete -F _root_command doas
|
|
|
source /usr/share/bash-completion/completions/man
|
|
|
complete -F _comp_cmd_man eman m
|
|
|
|
|
|
-
|
|
|
#------------------------------------------------------------------------------
|
|
|
# Binding scripts
|
|
|
#------------------------------------------------------------------------------
|
|
@@ -313,6 +318,9 @@ _surround() {
|
|
|
if [[ -z "$cursor_to_end" ]] ; then
|
|
|
line="$line$open$close"
|
|
|
point=$((${#line} - 1))
|
|
|
+ elif [[ "${line:$point:1}" == ' ' ]] ; then
|
|
|
+ line="$start_to_cursor$open$close$cursor_to_end"
|
|
|
+ ((point++))
|
|
|
else
|
|
|
case $action in
|
|
|
all)
|
|
@@ -330,6 +338,7 @@ _surround() {
|
|
|
READLINE_POINT=$point
|
|
|
}
|
|
|
|
|
|
+
|
|
|
# Bindings using the '_surround' function
|
|
|
bind -m vi-insert -x '"(":"_surround all \( \)"'
|
|
|
bind -m vi-insert -x '"\"":"_surround all \" \""'
|