From 6a51794638a64e5d72a2c0b69d70b8402fc316aa Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Tue, 22 Mar 2022 17:59:48 +0200 Subject: [PATCH] nano: provide nano-full with most features enabled 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 --- utils/nano/Makefile | 44 +++++++++++++++++++++++++++++++++++-- utils/nano/files/nanorc | 8 +++++++ utils/nano/files/uci.nanorc | 17 ++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 utils/nano/files/nanorc create mode 100644 utils/nano/files/uci.nanorc diff --git a/utils/nano/Makefile b/utils/nano/Makefile index 156af90da5..d7bd910aa8 100644 --- a/utils/nano/Makefile +++ b/utils/nano/Makefile @@ -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 index 0000000000..fd5260c5a8 --- /dev/null +++ b/utils/nano/files/nanorc @@ -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 index 0000000000..8d27836fc0 --- /dev/null +++ b/utils/nano/files/uci.nanorc @@ -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:]]+$" + -- 2.30.2