nano: provide nano-full with most features enabled
authorHannu Nyman <hannu.nyman@iki.fi>
Tue, 22 Mar 2022 15:59:48 +0000 (17:59 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Thu, 24 Mar 2022 18:31:10 +0000 (20:31 +0200)
Provide a new variant, nano-full, that enables almost
all functionality of nano. Only libmagic file type detection
has been left out.

Ship with a minimal /etc/nanorc that the user can modify.
nanorc documentation at
https://www.nano-editor.org/dist/latest/nanorc.5.html

Provide color highlighting for the uci config files.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(cherry picked from commit 6a51794638a64e5d72a2c0b69d70b8402fc316aa)

utils/nano/Makefile
utils/nano/files/nanorc [new file with mode: 0644]
utils/nano/files/uci.nanorc [new file with mode: 0644]

index 156af90da580b66eff1970025d897a7aa97358a0..d7bd910aa870042edc92251f7758649e574c15de 100644 (file)
@@ -46,6 +46,12 @@ define Package/nano-plus
   VARIANT:=plus
 endef
 
+define Package/nano-full
+  $(call Package/nano/Default)
+  TITLE:=GNU nano text editor (all features, Unicode)
+  VARIANT:=full
+endef
+
 define Package/nano/description
   Nano is a small and simple text editor for use on the terminal.
 
@@ -63,8 +69,25 @@ define Package/nano-plus/description
   $(call Package/nano/description)
 endef
 
-ifeq ($(BUILD_VARIANT),plus)
-# plus variant with more features included
+define Package/nano-full/description
+  nano-full - all features, including syntax highlighting (also uci),
+  multibuffer, Unicode/UTF-8, nanorc, some key bindings.
+  (libmagic-based file type detection is disabled)
+
+  Example /etc/nanorc is included. nanorc documentation at
+  https://www.nano-editor.org/dist/latest/nanorc.5.html
+
+  $(call Package/nano/description)
+endef
+
+ifeq ($(BUILD_VARIANT),full)
+# full variant with almost all features included
+  CONFIGURE_ARGS += \
+       --disable-extra \
+       --disable-libmagic \
+       --enable-utf8
+else ifeq ($(BUILD_VARIANT),plus)
+# plus variant with some features included
   CONFIGURE_ARGS += \
        --enable-help \
        --enable-justify \
@@ -95,6 +118,14 @@ endif
 CONFIGURE_VARS += \
        ac_cv_header_regex_h=no \
 
+define Package/nano-plus/conffiles
+/etc/nanorc
+endef
+
+define Package/nano-full/conffiles
+/etc/nanorc
+endef
+
 define Package/nano/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
@@ -104,6 +135,15 @@ define Package/nano-plus/install
        $(call Package/nano/install,$1)
 endef
 
+define Package/nano-full/install
+       $(call Package/nano/install,$1)
+       $(INSTALL_DIR) $(1)/etc $(1)/usr/share/nano
+       $(INSTALL_CONF) ./files/nanorc $(1)/etc/nanorc
+       $(INSTALL_DATA) ./files/uci.nanorc $(1)/usr/share/nano
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/nano/* $(1)/usr/share/nano
+endef
+
 $(eval $(call BuildPackage,nano))
 $(eval $(call BuildPackage,nano-plus))
+$(eval $(call BuildPackage,nano-full))
 
diff --git a/utils/nano/files/nanorc b/utils/nano/files/nanorc
new file mode 100644 (file)
index 0000000..fd5260c
--- /dev/null
@@ -0,0 +1,8 @@
+## General Settings ##
+set multibuffer         # Open multiple files
+set linenumbers         # show line numbers Alt+N to toggle
+
+## Syntax highlighting ##
+include /usr/share/nano/*.nanorc
+include /usr/share/nano/extra/*.nanorc
+
diff --git a/utils/nano/files/uci.nanorc b/utils/nano/files/uci.nanorc
new file mode 100644 (file)
index 0000000..8d27836
--- /dev/null
@@ -0,0 +1,17 @@
+## Syntax highlighting for OpenWrt uci config files.
+
+syntax uci "/etc/config/*"
+comment "#"
+
+# Keywords
+color green "\<(package|config|option|list)\>"
+
+# Comments.
+color cyan "(^|[[:blank:]])#.*"
+
+# Strings.
+color yellow ""([^"\]|\\.)*"|'([^'\]|\\.)*'"
+
+# Trailing whitespace.
+color ,green "[[:space:]]+$"
+