vim: fix config and runtime
authorGeorge Sapkin <redacted>
Sat, 13 Dec 2025 16:19:44 +0000 (18:19 +0200)
committerGeorge Sapkin <redacted>
Fri, 19 Dec 2025 13:56:29 +0000 (15:56 +0200)
- Install shared runtime for both full and fuller.
- Switch big to huge as big is just an alias to normal.
- Fix default config path for tiny variant.
- Use upstream default config for both full and fuller.
- Don't mark default config files for backup.
- Don't mix variant files.
- Mark fuller variant config files for backup.
- Update configure arguments and remove deprecated ones.
- Remove deprecated configuration variables.
- Improve descriptions.
- Fix the following error by installing the missing runtime files for
  full and correctly installing the default config for tiny:

  E1187: Failed to source defaults.vim

- Fix the following fuller error by installing the missing directory in
  runtime:

  Error detected while processing /usr/share/vim/vim91/plugin/netrwPlugin.vim:
  line    7:
  E919: Directory not found in 'packpath': "pack/*/opt/netrw"

Fixes: https://github.com/openwrt/packages/issues/20203
Fixes: https://github.com/openwrt/packages/issues/28104
Signed-off-by: George Sapkin <redacted>
utils/vim/Makefile
utils/vim/files/defaults.vim [moved from utils/vim/files/vimrc with 100% similarity]
utils/vim/files/vimrc.full [deleted file]

index d9211b930aecbf4e0f15fd776c71cdc2c822c6ee..941f7b3ccaf7ca503de5e23bf60b3f47c8bd948a 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=vim
 PKG_VERSION:=9.1.1918
 PKG_XXD_VERSION:=2025.08.24
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 VIMVER:=91
 
 PKG_SOURCE_PROTO:=git
@@ -47,13 +47,17 @@ define Package/vim-full
   TITLE+= (Normal)
   PROVIDES:=vim
   CONFLICTS:=vim
+  DEPENDS:=vim-runtime
+  EXTRA_DEPENDS:=vim-runtime (=$(PKG_VERSION)-r$(PKG_RELEASE))
 endef
 
 define Package/vim-fuller
   $(call Package/vim/Default)
-  TITLE+= (Big)
+  TITLE+= (Huge)
   PROVIDES:=vim vim-full
   CONFLICTS:=vim vim-full
+  DEPENDS:=vim-runtime
+  EXTRA_DEPENDS:=vim-runtime (=$(PKG_VERSION)-r$(PKG_RELEASE))
 endef
 
 define Package/vim-runtime
@@ -74,71 +78,67 @@ define Package/xxd
   VERSION:=$(PKG_XXD_VERSION)
 endef
 
-define Package/vim-full/conffiles
-/usr/share/vim/vimrc
+define Package/vim/conffiles
 /root/.vimrc
 endef
 
-define Package/vim/conffiles
-/usr/share/vim/vimrc
-/root/.vimrc
+Package/vim-full/conffiles = $(Package/vim/conffiles)
+Package/vim-fuller/conffiles = $(Package/vim/conffiles)
+
+define Package/vim/description/default
+  Vim is an almost compatible version of the UNIX editor Vi.
 endef
 
 define Package/vim/description
- Vim is an almost compatible version of the UNIX editor Vi.
- (Tiny build)
+  $(call Package/vim/description/default)
+  Tiny build with minimal feature set.
 endef
 
 define Package/vim-full/description
- Vim is an almost compatible version of the UNIX editor Vi.
- (Normal build)
+  $(call Package/vim/description/default)
+  Normal build with standard set of features like syntax highlighting, menus,
+  mouse support, translations, spell checking, etc.
 endef
 
 define Package/vim-fuller/description
- Vim is an almost compatible version of the UNIX editor Vi.
- (Big build)
+  $(call Package/vim/description/default)
+  Huge build enables right-to-left language support, cscope, etc.
 endef
 
 define Package/vim-runtime/description
- Vim is an almost compatible version of the UNIX editor Vi.
- (Runtime files)
+  $(call Package/vim/description/default)
 (Runtime files)
 endef
 
 define Package/vim-help/description
- Vim is an almost compatible version of the UNIX editor Vi.
- (Help files)
+  $(call Package/vim/description/default)
 (Help files)
 endef
 
 define Package/xxd/description
- xxd creates a hex dump of a given file or standard input, it can also convert
- a hex dump back to its original binary form.
 xxd creates a hex dump of a given file or standard input, it can also convert
 a hex dump back to its original binary form.
 endef
 
 CONFIGURE_ARGS += \
-       --disable-gui \
-       --disable-gtktest \
-       --disable-xim \
-       --without-x \
-       --disable-netbeans \
-       --disable-cscope \
-       --disable-gpm \
        --disable-acl \
+       --disable-gtktest \
        --disable-libsodium \
+       --disable-netbeans \
        --disable-selinux \
-       --with-tlib=ncurses \
+       --enable-gpm=no \
+       --enable-gui=no \
        --with-compiledby="non-existent-hostname-compiled" \
+       --with-tlib=ncurses \
        --with-wayland=no
 
 CONFIGURE_VARS += \
-       ac_cv_header_elf_h=no \
        vim_cv_getcwd_broken=no \
        vim_cv_memmove_handles_overlap=yes \
        vim_cv_stat_ignores_slash=yes \
-       vim_cv_tgetent=zero \
        vim_cv_terminfo=yes \
-       vim_cv_toupper_broken=no \
-       vim_cv_tty_group=root \
-       vim_cv_tty_mode=0620
+       vim_cv_tgetent=zero \
+       vim_cv_toupper_broken=no
 
 ifneq ($(HOST_OS),Linux)
   TARGET_PATH_PKG:=$(CURDIR)/scripts:$(TARGET_PATH_PKG)
@@ -155,7 +155,7 @@ define Build/Compile/vim
                --with-features=tiny \
        )
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
-               DESTDIR="$(PKG_INSTALL_DIR)" all
+               DESTDIR="$(PKG_INSTALL_DIR)/vim_tiny" all
        $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_tiny
 endef
 endif
@@ -166,7 +166,7 @@ define Build/Compile/vim-full
                --with-features=normal \
        )
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
-               DESTDIR="$(PKG_INSTALL_DIR)" all
+               DESTDIR="$(PKG_INSTALL_DIR)/vim_normal" all
        $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_normal
 endef
 endif
@@ -174,11 +174,11 @@ endif
 ifneq ($(CONFIG_PACKAGE_vim-fuller),)
 define Build/Compile/vim-fuller
        $(call Build/Configure/Default, \
-               --with-features=big \
+               --with-features=huge \
        )
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
-               DESTDIR="$(PKG_INSTALL_DIR)" all
-       $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_big
+               DESTDIR="$(PKG_INSTALL_DIR)/vim_huge" all
+       $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_huge
 endef
 endif
 
@@ -190,10 +190,10 @@ endef
 endif
 
 define Build/Compile/vim-runtime
-       $(MAKE) -C $(PKG_BUILD_DIR)/src DESTDIR="$(PKG_INSTALL_DIR)" installrtbase
-       (cd $(PKG_INSTALL_DIR) && tar -cf $(PKG_BUILD_DIR)/docs.tar ./usr/share/vim/vim$(VIMVER)/doc)
-       rm -rf $(PKG_INSTALL_DIR)/usr/share/vim/vim$(VIMVER)/doc
-       rm -rf $(PKG_INSTALL_DIR)/usr/man
+       $(MAKE) -C $(PKG_BUILD_DIR)/src DESTDIR="$(PKG_INSTALL_DIR)/vim_runtime" installrtbase
+       (cd $(PKG_INSTALL_DIR)/vim_runtime && tar -cf $(PKG_BUILD_DIR)/docs.tar ./usr/share/vim/vim$(VIMVER)/doc)
+       $(RM) -r $(PKG_INSTALL_DIR)/vim_runtime/usr/share/vim/vim$(VIMVER)/doc
+       $(RM) -r $(PKG_INSTALL_DIR)/vim_runtime/usr/man
 endef
 
 define Build/Compile
@@ -208,7 +208,7 @@ define Package/vim/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_tiny $(1)/usr/bin/vim
        $(INSTALL_DIR) $(1)/usr/share/vim
-       $(INSTALL_CONF) ./files/vimrc $(1)/usr/share/vim/
+       $(INSTALL_CONF) ./files/defaults.vim $(1)/usr/share/vim
 endef
 
 define Package/vim-full/install
@@ -216,25 +216,23 @@ define Package/vim-full/install
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_normal $(1)/usr/bin/vim
        $(INSTALL_DIR) $(1)/usr/share/vim
        $(LN) vim $(1)/usr/bin/vimdiff
-       $(INSTALL_CONF) ./files/vimrc.full $(1)/usr/share/vim/vimrc
 endef
 
 define Package/vim-fuller/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_big $(1)/usr/bin/vim
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_huge $(1)/usr/bin/vim
        $(INSTALL_DIR) $(1)/usr/share/vim
        $(LN) vim $(1)/usr/bin/vimdiff
-       $(CP) $(PKG_INSTALL_DIR)/usr/share/vim/vim$(VIMVER) $(1)/usr/share/vim
-       $(INSTALL_CONF) ./files/vimrc.full $(1)/usr/share/vim/vimrc
 endef
 
 define Package/vim-runtime/install
-       $(CP) $(PKG_INSTALL_DIR)/* $(1)
-       rm -rf $(1)/usr/share/vim/vim$(VIMVER)/doc
+       $(CP) $(PKG_INSTALL_DIR)/vim_runtime/* $(1)
+       $(INSTALL_DIR) $(1)/usr/share/vim/vim$(VIMVER)/pack/dist/opt/netrw
+       $(RM) -r $(1)/usr/share/vim/vim$(VIMVER)/doc
 endef
 
 define Package/vim-help/install
-       tar -C $(1) -xf $(PKG_BUILD_DIR)/docs.tar
+       $(TAR) -C $(1) -xf $(PKG_BUILD_DIR)/docs.tar
 endef
 
 define Package/xxd/install
diff --git a/utils/vim/files/vimrc.full b/utils/vim/files/vimrc.full
deleted file mode 100644 (file)
index 5cd3669..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-set showcmd                    " show (partial) command in status line
-set showmatch                  " show matching brackets
-set incsearch                  " incremental search
-"set autowrite                 " automatically save before commands like :next and :make
-set nocompatible               " use Vim defaults instead of 100% vi compatibility
-set backspace=indent,eol,start " more powerful backspacing
-set autoindent                 " always set autoindenting on
-set linebreak                  " don't wrap words by default
-set textwidth=0                        " don't wrap lines by default
-set ruler                      " show the cursor position all the time
-
-set backupskip+=/etc/crontabs.*        " fix crontab -e
-
-if filereadable(expand("$VIMRUNTIME/syntax/synload.vim"))
-       syntax on
-endif
-if has("syntax") && &term =~ "xterm"
-       set t_Co=8
-       if has("terminfo")
-               set t_Sf=<Esc>[3%p1%dm
-               set t_Sb=<Esc>[4%p1%dm
-       else
-               set t_Sf=<Esc>[3%dm
-               set t_Sb=<Esc>[4%dm
-       endif
-endif
-
-" Uncomment out for line and/or relative numberig
-" set number
-" set rnu
git clone https://git.99rst.org/PROJECT