From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id AK3OBpBScF+XPgAA0tVLHw (envelope-from ) for ; Sun, 27 Sep 2020 08:51:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id yGS8ApBScF9sJgAA1q6Kng (envelope-from ) for ; Sun, 27 Sep 2020 08:51:28 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7533B9402A7 for ; Sun, 27 Sep 2020 08:51:27 +0000 (UTC) Received: from localhost ([::1]:48374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMSOz-0000Mk-TG for larch@yhetil.org; Sun, 27 Sep 2020 04:51:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMSOc-0000Md-HD for guix-patches@gnu.org; Sun, 27 Sep 2020 04:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMSOc-0008VX-8I for guix-patches@gnu.org; Sun, 27 Sep 2020 04:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kMSOc-0004qb-7N for guix-patches@gnu.org; Sun, 27 Sep 2020 04:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Sep 2020 08:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43539 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Marius Bakke Cc: Ricardo Wurmus , 43539@debbugs.gnu.org Received: via spool by 43539-submit@debbugs.gnu.org id=B43539.160119663218594 (code B ref 43539); Sun, 27 Sep 2020 08:51:02 +0000 Received: (at 43539) by debbugs.gnu.org; 27 Sep 2020 08:50:32 +0000 Received: from localhost ([127.0.0.1]:48284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMSO7-0004pq-Sy for submit@debbugs.gnu.org; Sun, 27 Sep 2020 04:50:32 -0400 Received: from flashner.co.il ([178.62.234.194]:37508) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMSO6-0004pc-23 for 43539@debbugs.gnu.org; Sun, 27 Sep 2020 04:50:30 -0400 Received: from localhost (unknown [31.210.181.177]) by flashner.co.il (Postfix) with ESMTPSA id 35E304004A; Sun, 27 Sep 2020 08:50:24 +0000 (UTC) Date: Sun, 27 Sep 2020 11:49:51 +0300 From: Efraim Flashner Message-ID: <20200927084951.GC1386@E5400> References: <20200920191523.6871-1-efraim@flashner.co.il> <87bli0tffs.fsf@elephly.net> <20200920193215.GA6984@E5400> <875z88teh7.fsf@elephly.net> <20200920205758.GD6984@E5400> <20200922093734.GF1007@E5400> <87o8lt4uj1.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FsscpQKzF/jJk6ya" Content-Disposition: inline In-Reply-To: <87o8lt4uj1.fsf@gnu.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.69 X-TUID: Vk4G3sMF9yZq --FsscpQKzF/jJk6ya Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 25, 2020 at 07:48:34PM +0200, Marius Bakke wrote: > Efraim Flashner writes: >=20 > > On Sun, Sep 20, 2020 at 11:57:58PM +0300, Efraim Flashner wrote: > >> On Sun, Sep 20, 2020 at 09:50:12PM +0200, Ricardo Wurmus wrote: > >> >=20 > >> > Efraim Flashner writes: > >> >=20 > >> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote: > >> > >>=20 > >> > >> Efraim Flashner writes: > >> > >>=20 > >> > >> > diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux= -files/guix.vim > >> > >> > new file mode 100644 > >> > >> > index 0000000000..ca97f451d8 > >> > >> > --- /dev/null > >> > >> > +++ b/gnu/packages/aux-files/guix.vim > >> > >> > @@ -0,0 +1,7 @@ > >> > >> > +" This appends all of the vim plugins to the end of Vim's runt= imepath. > >> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.gu= ix-profile", $GUIX_ENVIRONMENT] > >> > >>=20 > >> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-p= rofile? > >> > >> This would allow users to keep a separate profile for Vim things. > >> > > > >> > > That was the one part I didn't really like about my patch. Unfortu= nately > >> > > I don't seem to have $GUIX_PROFILE set on my machine. > >> > > > >> > > (ins)efraim@E5400 ~$ echo $GUIX_PROFILE > >> > > > >> > > (ins)efraim@E5400 ~$ > >> >=20 > >> > Me neither! But when loading profiles we suggest this approach: > >> >=20 > >> > export GUIX_PROFILE=3D/the/location/of/the/.guix-profile > >> > source $GUIX_PROFILE/etc/profile > >> >=20 > >> > The variable is set in that case, because that affects whether absol= ute > >> > store file names are used or the symlink > >> > =E2=80=9C/the/location/of/the/.guix-profile=E2=80=9D. > >>=20 > >> It seems to be the case for the default profile. And in Guix System. I > >> could also just add $GUIX_PROFILE as another location in the list of > >> directories to search. > > > > The more I think about it the more I see $HOME/.guix-profile as a > > "special profile" which is nearly always included in $PATH and other > > variables, similar to /run/current-system/profile. With that in mind I > > like the attached patch which keeps that path but adds a search for > > $GUIX_PROFILE. > > > > I could use environment variables to override vim's builtin search for > > $VIM and $VIMRUNTIME, but then we would have to decide to support vim > > installed by the user or system-wide. >=20 > So vim only expects a single vimfiles directory in those variables? >=20 Not exactly. vim sets both $VIM and $VIMRUNTIME. $VIM points to $out/share/vim and $VIMRUNTIME points to $out/share/vim/vim82. In a typical FHS distro this would be /etc/share/vim and /etc/share/vim/vim82. Then any distro specific vimrc would be installed to /etc/share/vim/vimrc, which would also help load any distro installed plugins in /etc/share/vim/vimfiles. Any user installed plugins would be (typically) in ~/.vim/plugins/ with some extra directories for management or for the 'after' keyword to load last or 'opt' to only load on command. Or in a 'pack' path to be activated with :packadd {plugin}. > [...] >=20 > > +++ b/gnu/packages/aux-files/guix.vim > > @@ -0,0 +1,7 @@ > > +" This appends all of the vim plugins to the end of Vim's runtimepath. > > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profi= le", $GUIX_PROFILE, $GUIX_ENVIRONMENT] > > + let vimplugins =3D directory . "/share/vim/vimfiles" > > + if isdirectory(vimplugins) > > + let &rtp =3D join([&rtp,vimplugins], ',') > > + endif > > +endfor >=20 > I wonder if we could generalize this to a proper search path with > something like (pseudo code): >=20 > for directory in getenv("VIM_PLUGIN_PATH").split(":") > let vimplugins =3D directory . "share/vim/vimfiles" > ... >=20 > And then in the vim package: >=20 > (native-search-paths > (list > (search-path-specification > (variable "VIM_PLUGIN_PATH") > (files '("share/vim/vimfiles"))))) >=20 > ...which makes Guix populate VIM_PLUGIN_PATH automatically as plugins > are added to a profile/environment (as long as it contains the 'vim' > package). >=20 > WDYT? I'll try putting something together like that. Rebuilding vim takes about 3 minutes when I disable tests so it shouldn't be hard. I can also experiment a bit with packpath and/or per-plugin paths in share/vim/vimfiles/. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --FsscpQKzF/jJk6ya Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9wUiwACgkQQarn3Mo9 g1Hqaw/9HkE/lQCrzHMzMgr/bZUH9Ei/w9yGNpmEWjKpMfxy/h8jflmQenJ73ba9 bj+w50BE+5SVTomsCBLz5I/Z5Mr4hZcBD+7yOq7eu87+2iV9GLhkWOGB6kvnGXv9 lD4LjHEmaT4gEhX+plR+bHJVJzGVPh46O3SJM1o5F6WbMxJm80pST6GmgXW8d+Dw OmWI1yzVfK7WMJYENDegMv0jgvhjmKHZJFQOUWNVXOZcAgRLiVk7RS4b6pm4dPVr mJEyWOKnNbqrjTG7NxXYWvkAnRVU1TVD6dKSBLYJABlGmaMXMR/8jfu72FbwBx43 xztDt1/uOsyhmjqRoZ49aGa70fC9RuIWzIxooSlJhZNBhgajErAh4G+l92vVwF5P jBalFw0rh2nAepnc0w7Pt5sDfYcUcBqtzcQBKo5Ighz4E8zU1BoFQSV40dIaOsdd DSB4al7jx4bC+MeicvvVSEhV3IzhaHYmYTK1dDyla2SToERv2QwHH7IEQTWvMlss ebE8BAwo5Bi6ibJLoKe1WAXLrlJ3TlJMGuB5pXPnh6RLC9ipD+3ZPMJCtWEA8xNx xf5wt5nXX82P+Kmrkk7JdNxWn5SfxMBurJNOxUtDEWUpl238cnBES3WpaXdPzjbg +rJpBCelURqceIG7VJFelAmkO26A3khXlihWGbmJT28iUDjxB6A= =dZNo -----END PGP SIGNATURE----- --FsscpQKzF/jJk6ya--