Skip to content

Commit

Permalink
correctly determine filetype for nvimpager
Browse files Browse the repository at this point in the history
  • Loading branch information
wofr06 committed Aug 31, 2024
1 parent a094fc3 commit 3651e17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lesspipe.1
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ a preferred one can be forced for colorizing by setting the ENV variable
.I LESSCOLORIZER='pygmentize -O style=foo' (-P allowed as well)
.RE
.RS
.I LESSCOLORIZER='bat --style=foo --theme=bar'
.I LESSCOLORIZER='bat --style=foo --theme=bar' (default is theme ansi, style plain)
.RE
Syntax highlighting is activated, if the environment variable \fBLESS\fP
exists and contains the option \fI-R\fP
Expand Down
6 changes: 5 additions & 1 deletion lesspipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,11 @@ has_colorizer () {
[[ -n "$3" ]] && opt=(-l "$3" "$1") ;;
nvimpager)
opt=(-c "$1")
[[ -n "$3" ]] && opt=(-c "$1" -c "set filetype=$3") ;;
if [[ -n "$3" ]]; then
ft=${3##*/}
ft=${ft##*.}
opt=(-c "$1" --cmd "set filetype=$ft")
fi ;;
*)
return ;;
esac
Expand Down

0 comments on commit 3651e17

Please sign in to comment.