Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Sep 2022 16:07:05 GMT
From:      Adam Weinberger <adamw@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 91ef78b58bbb - main - editors/vim: Allow system vimrc, and include defaults.vim for vim-tiny
Message-ID:  <202209041607.284G75lf099010@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adamw:

URL: https://cgit.FreeBSD.org/ports/commit/?id=91ef78b58bbb458e079b717826f692984fc8100c

commit 91ef78b58bbb458e079b717826f692984fc8100c
Author:     Adam Weinberger <adamw@FreeBSD.org>
AuthorDate: 2022-09-04 16:00:01 +0000
Commit:     Adam Weinberger <adamw@FreeBSD.org>
CommitDate: 2022-09-04 16:07:01 +0000

    editors/vim: Allow system vimrc, and include defaults.vim for vim-tiny
    
    Two changes here (along with bumping to the latest upstream patch):
    
    1) In the previous Vim commit, support for the system-wide vimrc/gvimrc
       was dropped because we went through contortions to fix loading order
       and monkey around with various defaults.
    
       However, many people used that file for their system. This commit
       re-adds support for loading it. All work for untangling the mess of
       loading defaults.vim and preventing circular loads is left to the
       user. We just support loading that file; what you do with it is your
       call.
    
    2) vim-tiny is supposed to be the smallest possible Vim experience,
       being just the binary and no runtime library. However, without a
       viable defaults.vim, it's essentially just a larger, slower Vi.
       The vim-tiny package now ships with defaults.vim, which is patched
       to prevent errors from Vim loading the syntax library (which is not
       installed).
---
 editors/vim/Makefile                         |  9 +++++----
 editors/vim/distinfo                         |  6 +++---
 editors/vim/files/patch-runtime_defaults.vim | 24 ++++++++++++++++++++++++
 editors/vim/files/patch-src_feature.h        | 21 +++++++++++++++++++++
 4 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/editors/vim/Makefile b/editors/vim/Makefile
index 5df59d5429eb..932ff7cc5d32 100644
--- a/editors/vim/Makefile
+++ b/editors/vim/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	vim
-PORTVERSION=	9.0.0369
+PORTVERSION=	9.0.0379
 DISTVERSIONPREFIX=	v
 CATEGORIES=	editors
 
@@ -160,7 +160,7 @@ post-extract:
 	${INSTALL_DATA} ${FILESDIR}/vietnamese_viscii.vim ${WRKSRC}/runtime/keymap
 
 post-patch:
-	${ECHO_CMD} 'source $$VIMRUNTIME/defaults_freebsd.vim' >> ${WRKSRC}/runtime/defaults.vim
+	${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|' ${WRKSRC}/src/feature.h
 	${REINPLACE_CMD} -e 's|-liconv|${ICONV_LIB}|g; s|/usr/local|${LOCALBASE}|g' \
 		${WRKSRC}/src/auto/configure
 
@@ -172,12 +172,13 @@ post-configure:
 do-install:
 	${MKDIR} ${STAGEDIR}${DATADIR}/${VIM_VER}
 	${INSTALL_PROGRAM} ${WRKSRC}/src/vim ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_DATA} ${FILESDIR}/defaults_freebsd.vim ${STAGEDIR}${DATADIR}/${VIM_VER}/defaults.vim
+	${INSTALL_DATA} ${WRKSRC}/runtime/defaults.vim ${STAGEDIR}${DATADIR}/${VIM_VER}
+	${INSTALL_DATA} ${FILESDIR}/defaults_freebsd.vim ${STAGEDIR}${DATADIR}/${VIM_VER}
 	${INSTALL_MAN} ${WRKSRC}/runtime/doc/vim.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
 
 .else  # flavor != tiny
 post-install:
-	${INSTALL_DATA} ${FILESDIR}/defaults_freebsd.vim ${STAGEDIR}${DATADIR}/${VIM_VER}/
+	${INSTALL_DATA} ${FILESDIR}/defaults_freebsd.vim ${STAGEDIR}${DATADIR}/${VIM_VER}
 	${RM} ${STAGEDIR}${PREFIX}/bin/ex
 	${RM} ${STAGEDIR}${PREFIX}/bin/view
 .  for F in eview evim gview gvim gvimdiff rgview rgvim rview rvim vimdiff
diff --git a/editors/vim/distinfo b/editors/vim/distinfo
index fabbe4801854..abb472c05e19 100644
--- a/editors/vim/distinfo
+++ b/editors/vim/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1662223469
-SHA256 (vim-vim-v9.0.0369_GH0.tar.gz) = 990710ef46e581461e39f38778dd38654f1b61b5768f846553e7c16a8ecb3231
-SIZE (vim-vim-v9.0.0369_GH0.tar.gz) = 16822389
+TIMESTAMP = 1662305587
+SHA256 (vim-vim-v9.0.0379_GH0.tar.gz) = 24aba67af6eee677f367a7f58facfb1fa58cb0f9565c60a3fa5fc1a39e4c0481
+SIZE (vim-vim-v9.0.0379_GH0.tar.gz) = 16828444
diff --git a/editors/vim/files/patch-runtime_defaults.vim b/editors/vim/files/patch-runtime_defaults.vim
new file mode 100644
index 000000000000..0523e79e1ee2
--- /dev/null
+++ b/editors/vim/files/patch-runtime_defaults.vim
@@ -0,0 +1,24 @@
+We wrap `syntax on` in a try block so that it won't produce errors for
+vim-tiny, which doens't include the runtime library.
+
+We also source our own FreeBSD-specific defaults file.
+
+--- runtime/defaults.vim.orig	2022-09-04 15:43:53 UTC
++++ runtime/defaults.vim
+@@ -130,7 +130,9 @@ endif
+ " GUI (which always has colors).
+ if &t_Co > 2 || has("gui_running")
+   " Revert with ":syntax off".
+-  syntax on
++  try
++    syntax on
++  catch | endtry
+ 
+   " I like highlighting strings inside C comments.
+   " Revert with ":unlet c_comment_strings".
+@@ -152,3 +154,5 @@ if has('langmap') && exists('+langremap')
+   " compatible).
+   set nolangremap
+ endif
++
++source $VIMRUNTIME/defaults_freebsd.vim
diff --git a/editors/vim/files/patch-src_feature.h b/editors/vim/files/patch-src_feature.h
new file mode 100644
index 000000000000..88691a17bba4
--- /dev/null
+++ b/editors/vim/files/patch-src_feature.h
@@ -0,0 +1,21 @@
+This allows /usr/local/etc/vim/vimrc to be loaded as a system
+vimrc. Note that creating that file will prevent loading
+defaults.vim from Vim's runtime.
+
+--- src/feature.h.orig	2022-09-04 15:48:55 UTC
++++ src/feature.h
+@@ -710,12 +710,12 @@
+ /*
+  * SYS_VIMRC_FILE	Name of the system-wide .vimrc file.
+  */
+-// #define SYS_VIMRC_FILE	"/etc/vimrc"
++#define SYS_VIMRC_FILE	"%%ETCDIR%%/vimrc"
+ 
+ /*
+  * SYS_GVIMRC_FILE	Name of the system-wide .gvimrc file.
+  */
+-// #define SYS_GVIMRC_FILE	"/etc/gvimrc"
++#define SYS_GVIMRC_FILE	"%%ETCDIR%%/gvimrc"
+ 
+ /*
+  * DFLT_HELPFILE	Name of the help file.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209041607.284G75lf099010>