From: Aric Belsito <lluixhi@gmail.com>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [RFC] New eclass vim-runtime
Date: Fri, 8 Sep 2017 15:27:24 -0700 [thread overview]
Message-ID: <20170908222724.GA20930@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 606 bytes --]
This is really messy at the moment because I'm not sure whether the vim
team is interested, and I didn't want to put in the effort if it's just
going to be rejected, but I'm posting what I have here to start some
kind of discussion.
At the moment functions/other things need to be described, among other
issues. I have not yet tested to see if everything is still working with
vim, though I believe it works with neovim.
I'm also adding a patch file for vim-plugin.eclass, vim-doc.eclass and
vim-spell.eclass
I have a bug open on the bugtracker as well:
https://bugs.gentoo.org/612644
--
Aric Belsito
[-- Attachment #2: vim_eclasses.patch --]
[-- Type: text/x-diff, Size: 6845 bytes --]
From 08411b7ade20df1138c28b9a70679b7acf350f87 Mon Sep 17 00:00:00 2001
From: Aric Belsito <lluixhi@gmail.com>
Date: Tue, 5 Sep 2017 14:21:08 -0700
Subject: [PATCH] vim-runtime.eclass: new eclass
Gentoo-Bug: https://bugs.gentoo.org/612644
---
eclass/vim-doc.eclass | 40 ++++++++++++++++++++++++----------------
eclass/vim-plugin.eclass | 31 +++++++++++++------------------
eclass/vim-spell.eclass | 8 ++------
4 files changed, 39 insertions(+), 40 deletions(-)
create mode 100644 eclass/vim-runtime.eclass
diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass
index 5f281eba25f2..c4fa9ed22a44 100644
--- a/eclass/vim-doc.eclass
+++ b/eclass/vim-doc.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# This eclass is used by vim.eclass and vim-plugin.eclass to update
@@ -10,22 +10,28 @@
# DEPEND in vim-plugin or by whatever version of vim is being
# installed by the eclass.
+inherit vim-runtime
+
+run_helptags() {
+ # Update tags; need a vim binary for this
+ if [[ -n "$1" ]]; then
+ einfo "Updating documentation tags in $2"
+ DISPLAY= $1 -u NONE -n \
+ '+set nobackup nomore' \
+ "+helptags $2/doc" \
+ '+qa!' </dev/null &>/dev/null
+ fi
+}
update_vim_helptags() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
local vimfiles vim d s
# This is where vim plugins are installed
- vimfiles="${EROOT}"/usr/share/vim/vimfiles
+ vimfiles="${EPREFIX}$(vimfiles_directory)"
if [[ $PN != vim-core ]]; then
- # Find a suitable vim binary for updating tags :helptags
- vim=$(type -P vim 2>/dev/null)
- [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
- [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null)
- if [[ -z "$vim" ]]; then
- ewarn "No suitable vim binary to rebuild documentation tags"
- fi
+ vim="$(vim_binary)"
fi
# Make vim not try to connect to X. See :help gui-x11-start
@@ -59,14 +65,16 @@ update_vim_helptags() {
fi
# Update tags; need a vim binary for this
- if [[ -n "$vim" ]]; then
- einfo "Updating documentation tags in $d"
- DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
- '+set nobackup nomore' \
- "+helptags $d/doc" \
- '+qa!' </dev/null &>/dev/null
- fi
+ run_helptags $vim $d
done
+ # For neovim, just run :helptags on the tag directory
+ if use nvim ; then
+ [[ -d $vimfiles/doc ]] || break
+
+ # Update tags; need a vim binary for this
+ run_helptags $vim $vimfiles
+ fi
+
[[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
}
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index cdc24a15cf6f..f99693aeeb11 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vim-plugin.eclass
@@ -7,18 +7,13 @@
# @BLURB: used for installing vim plugins
# @DESCRIPTION:
# This eclass simplifies installation of app-vim plugins into
-# /usr/share/vim/vimfiles. This is a version-independent directory
+# $(vimfiles_directory). This is a version-independent directory
# which is read automatically by vim. The only exception is
# documentation, for which we make a special case via vim-doc.eclass.
-inherit vim-doc
+inherit vim-doc vim-runtime
EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
-VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
-
-DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION}
- >=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION} )"
-RDEPEND="${DEPEND}"
if [[ ${PV} != 9999* ]] ; then
SRC_URI="mirror://gentoo/${P}.tar.bz2
https://dev.gentoo.org/~radhermit/vim/${P}.tar.bz2"
@@ -27,7 +22,7 @@ SLOT="0"
vim-plugin_src_install() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
- local f
+ local f vimfiles="${EPREFIX}$(vimfiles_directory)"
if use !prefix && [[ ${EUID} -eq 0 ]] ; then
ebegin "Fixing file permissions"
@@ -59,11 +54,11 @@ vim-plugin_src_install() {
# Install remainder of plugin
cd "${WORKDIR}"
- dodir /usr/share/vim
- mv "${S}" "${ED}"/usr/share/vim/vimfiles
+ dodir "$(dirname $vimfiles)"
+ mv "${S}" "${D%/}$vimfiles"
# Fix remaining bad permissions
- chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed"
+ chmod -R -x+X "${D%/}$vimfiles" || die "chmod failed"
}
vim-plugin_pkg_postinst() {
@@ -79,21 +74,21 @@ vim-plugin_pkg_postrm() {
# Remove empty dirs; this allows
# /usr/share/vim to be removed if vim-core is unmerged
- find "${EPREFIX}/usr/share/vim/vimfiles" -depth -type d -exec rmdir {} \; 2>/dev/null
+ find "${EPREFIX}$(vimfiles_directory)" -depth -type d -exec rmdir {} \; 2>/dev/null
}
# update_vim_afterscripts: create scripts in
-# /usr/share/vim/vimfiles/after/* comprised of the snippets in
-# /usr/share/vim/vimfiles/after/*/*.d
+# $(vimfiles_directory)/after/* comprised of the snippets in
+# $(vimfiles_directory)/after/*/*.d
update_vim_afterscripts() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
- local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after
+ local d f afterdir="${EPREFIX}$(vimfiles_directory)"/after
# Nothing to do if the dir isn't there
[ -d "${afterdir}" ] || return 0
- einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
+ einfo "Updating scripts in ${afterdir}"
find "${afterdir}" -type d -name \*.vim.d | \
while read d; do
echo '" Generated by update_vim_afterscripts' > "${d%.d}"
@@ -101,7 +96,7 @@ update_vim_afterscripts() {
sort -z | xargs -0 cat >> "${d%.d}"
done
- einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
+ einfo "Removing dead scripts in ${afterdir}"
find "${afterdir}" -type f -name \*.vim | \
while read f; do
[[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \
diff --git a/eclass/vim-spell.eclass b/eclass/vim-spell.eclass
index 2844ea9d995e..5126f8fa19ce 100644
--- a/eclass/vim-spell.eclass
+++ b/eclass/vim-spell.eclass
@@ -62,14 +62,10 @@
# spell files. It's best to let upstream know if you've generated spell files
# for another language rather than keeping them Gentoo-specific.
-inherit eutils
+inherit eutils vim-runtime
EXPORT_FUNCTIONS src_install pkg_postinst
-IUSE=""
-DEPEND="|| ( >=app-editors/vim-7_alpha
- >=app-editors/gvim-7_alpha )"
-RDEPEND="${DEPEND}"
SRC_URI="mirror://gentoo/${P}.tar.bz2"
SLOT="0"
@@ -91,7 +87,7 @@ SLOT="0"
# @INTERNAL
# @DESCRIPTION:
# This variable defines the path to Vim spell files.
-: ${VIM_SPELL_DIRECTORY:="${EPREFIX}/usr/share/vim/vimfiles/spell/"}
+: ${VIM_SPELL_DIRECTORY:="${EPREFIX}$(vimfiles_directory)/spell/"}
# @ECLASS-VARIABLE: DESCRIPTION
# @DESCRIPTION:
[-- Attachment #3: vim-runtime.eclass --]
[-- Type: text/plain, Size: 1230 bytes --]
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vim-runtime.eclass
# @MAINTAINER:
# vim@gentoo.org
# @BLURB: used for installing vim plugins
# @DESCRIPTION:
# This eclass simplifies installation of app-vim plugins into
# $(vimfiles_directory). This is a version-independent directory
# which is read automatically by vim. The only exception is
# documentation, for which we make a special case via vim-doc.eclass.
# @ECLASS-VARIABLE: VIM_PLUGIN_VIM_VERSION
# @DESCRIPTION:
# This variable defines the default vim version for a vim plugin.
# The default value is "7.3".
: ${VIM_PLUGIN_VIM_VERSION:=7.3}
IUSE="nvim"
DEPEND="|| (
>=app-editors/vim-${VIM_PLUGIN_VIM_VERSION}
>=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION}
app-editors/neovim
)"
RDEPEND="${DEPEND}"
vim_binary() {
# Find a suitable vim binary
local vim=$(type -P vim 2>/dev/null)
[[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
[[ -z "$vim" ]] && vim=$(type -P nvim 2>/dev/null)
if [[ -z "$vim" ]]; then
ewarn "No suitable vim binary found"
fi
echo "$vim"
}
vimfiles_directory() {
if use nvim ; then
echo "/usr/share/nvim/runtime"
else
echo "/usr/share/vim/vimfiles"
fi
}
next reply other threads:[~2017-09-08 22:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 22:27 Aric Belsito [this message]
2017-09-08 23:44 ` [gentoo-dev] [RFC] New eclass vim-runtime Vadim A. Misbakh-Soloviov
[not found] ` <20170909203256.GG10007@patriceclement.me>
2017-09-09 23:00 ` Aric Belsito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170908222724.GA20930@gmail.com \
--to=lluixhi@gmail.com \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox