Le 28/12/2022 à 14:57, Martin Ziemer a écrit :
Am Wed, Dec 28, 2022 at 01:23:09PM +0000 schrieb Stuart Henderson:
On 2022/12/28 13:07, Joel Carnat wrote:
When using one of the Nerd Fonts in the terminal, you can get glyphs (icons)
rendered. The attached patch enables a flavor for sysutils/nnn that will
render mime types icons next to file listing. An example can be seen there:
https://i.imgur.com/kOld6HT.gif

Tested on OpenBSD/7.2-CURRENT/amd64, using xterm(1) and xfce4-terminal(1).
Works here too. (Just xterm)

Please add a note to DESCR describing the flavour and the requirement
for the additional fonts.

It would probably be better to provide ports for some of the more popular
of these fonts too, rather than having to tell people to go to a website
and download them..
This sounds like the best way to do it.

  V =                   4.7
  DISTNAME =            nnn-v${V}
  PKGNAME =             nnn-${V}
+REVISION =             1
not really important but some people will complain ;) this normally
starts at 0


Here is a patch for the corrected Makefile and modified DESCR files.

I can look at fonts/msttcorefonts and do the same thing for the Nerd Fonts. But there are 53 fonts, without a popularity note. Uncompressed, they take about 4GB. I only use one font and would probably not install such a huge package. I don't know about others. Maybe using FULLPKGNAME like with x11/windowmaker-lang would be the way to go so that one font is one package and people install the one(s) they want.

What do you think?

Regards,
Joel C.
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/nnn/Makefile,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 Makefile
--- Makefile	24 Nov 2022 10:25:40 -0000	1.22
+++ Makefile	28 Dec 2022 16:03:25 -0000
@@ -3,6 +3,7 @@ COMMENT =		the missing terminal file bro
 V =			4.7
 DISTNAME =		nnn-v${V}
 PKGNAME =		nnn-${V}
+REVISION =		0
 
 CATEGORIES =		sysutils
 
@@ -26,6 +27,13 @@ RUN_DEPENDS =		textproc/gsed
 MAKE_FLAGS =		CFLAGS_OPTIMIZATION=
 FAKE_FLAGS =		MANPREFIX="$(PREFIX)/man" \
 			PREFIX="${PREFIX}"
+
+FLAVORS =		nerd
+FLAVOR ?=
+
+.if ${FLAVOR:Mnerd}
+MAKE_FLAGS +=		O_NERD=1
+.endif
 
 USE_GMAKE =		Yes
 NO_TEST =		Yes
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/sysutils/nnn/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 DESCR
--- pkg/DESCR	7 May 2018 18:29:00 -0000	1.1.1.1
+++ pkg/DESCR	28 Dec 2022 16:03:25 -0000
@@ -18,3 +18,10 @@ Cool things you can do with nnn:
 - pin a directory you may need to revisit and jump to it anytime
 - lock the current terminal after a specified idle time
 - change directory on exit
+
+Flavors:
+	nerd    - build with support for Nerd Fonts to display glyphs.
+                  Nerd Fonts can be browsed and downloaded from the author's
+                  website https://www.nerdfonts.com/font-downloads.
+                  The font(s) must be installed in $HOME/.local/share/fonts/
+                  or in /usr/local/share/fonts/.

Reply via email to