diff --git a/ChangeLog b/ChangeLog index a445d2c..ac78747 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ **************************************************************************** # ChangeLog for lesspipe.sh # **************************************************************************** +- add nvimpager as (preferred) colorizer +- if installed use nvim instead of vim for coloring with vimcolor - prefer bat styles and themes from ENV or command line over config file Version 2.13 May 10 2024 - added support for appimage and snap files diff --git a/README.md b/README.md index 1c2b9e0..9997455 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ the author by email. **LESS** can be used to switch on colored less output (should contain -R). **LESSCOLORIZER** can be set to prefer a highlighting program from the following - choices (`bat` `batcat` `pygmentize` `source-highlight` `vimcolor` `code2color`). + choices (`nvimpager` `bat` `batcat` `pygmentize` `source-highlight` `vimcolor` `code2color`). Otherwise the first program in that list that is installed will be used. ## 3. Required programs @@ -284,8 +284,9 @@ original html file contents, two colons are required in this case. ``` #### 5.1.1 Syntax highlighting choices The filter is able to do syntax highlighting for a wide variety of file - types. If installed, `bat`/`batcat` is used for coloring the output. If - not, `pygmentize`, `source-highlight`, `code2color` and `vimcolor` are + types. If installed, `nvimpager` is used for coloring the output. If + not, `bat`/`batcat`, `pygmentize`, `source-highlight`, `code2color` + and `vimcolor` are tried. Among these colorizers a preferred one can be forced for coloring by setting the ENV variable **LESSCOLORIZER** to the name of the colorizer. For `pygmentize` and `bat/batcat` a restricted set of options can be added: @@ -313,7 +314,7 @@ batcat --list-languages pygmentize -L lexers source-highlight --lang-list code2color -h -vimcolor -L +vimcolor -L (both for vimcolor and nvimpager) ``` ### 5.2 Colored Directory listing @@ -455,6 +456,7 @@ STDOUT and the commands executed to STDERR. - sxw2txt https://vinc17.net/software/sxw2txt (2010) - dtc https://git.kernel.org/cgit/utils/dtc/dtc.git (2023) - xmq https://github.com/libxmq/xmq/releases/latest (2024) +- nvimpager https://github.com/lucc/nvimpager (2025) ### 12.2 References - [1] http://www.greenwoodsoftware.com/less/ (less) diff --git a/lesspipe.1 b/lesspipe.1 index b8d92d1..6cc7fc9 100644 --- a/lesspipe.1 +++ b/lesspipe.1 @@ -96,9 +96,9 @@ file name. To get the original html file contents, two colons are required in this case. .SH OUTPUT COLORIZATION The filter is able to do syntax highlighting for a wide variety of -file types. If installed, \fIbat\fP/\fIbatcat\fP is used for -coloring the output. If not, \fIpygmentize\fP, \fIsource-highlight\fP, -\fIvimcolor\fP and \fIcode2color\fP are tried in turn. +file types. If installed, \fInvimpager\fP is used for +coloring the output. If not, \fIbat\fP/\fIbatcat\fP, \fIpygmentize\fP, +\fIsource-highlight\fP, \fIvimcolor\fP and \fIcode2color\fP are tried in turn. For bat/batcat the theme is set to \fIansi\fP and the style is set to \fIplain\fP which comes closer to the unfiltered output of \fBless\fP. These settings can be changed in \fI~/.config/bat/config\fP or by the diff --git a/lesspipe.sh b/lesspipe.sh index 94e2425..23665c3 100755 --- a/lesspipe.sh +++ b/lesspipe.sh @@ -429,7 +429,7 @@ has_colorizer () { [[ $2 == plain || -z $2 ]] && return prog=${LESSCOLORIZER%% *} - for i in bat batcat pygmentize source-highlight vimcolor code2color ; do + for i in nvimpager bat batcat pygmentize source-highlight vimcolor code2color ; do [[ -z $prog || $prog == "$i" ]] && has_cmd "$i" && prog=$i done [[ "$2" =~ ^[0-9]*$ || -z "$2" ]] || lang=$2 @@ -470,6 +470,9 @@ has_colorizer () { code2color|vimcolor) opt=("$1") [[ -n "$3" ]] && opt=(-l "$3" "$1") ;; + nvimpager) + opt=(-c "$1") + [[ -n "$3" ]] && opt=(-c "$1" -c "set filetype=$3") ;; *) return ;; esac