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).
This commit is contained in:
parent
294f2c6f66
commit
91ef78b58b
@ -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
|
||||
|
@ -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
|
||||
|
24
editors/vim/files/patch-runtime_defaults.vim
Normal file
24
editors/vim/files/patch-runtime_defaults.vim
Normal file
@ -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
|
21
editors/vim/files/patch-src_feature.h
Normal file
21
editors/vim/files/patch-src_feature.h
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user