From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WGgBFuZecF/QMgAA0tVLHw (envelope-from ) for ; Sun, 27 Sep 2020 09:44:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id OFjtEeZecF8iTwAAbx9fmQ (envelope-from ) for ; Sun, 27 Sep 2020 09:44:06 +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 BC0959402B1 for ; Sun, 27 Sep 2020 09:44:05 +0000 (UTC) Received: from localhost ([::1]:46936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMTDw-0006Ph-GB for larch@yhetil.org; Sun, 27 Sep 2020 05:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMTCy-0005PC-MF for guix-patches@gnu.org; Sun, 27 Sep 2020 05:43:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMTCy-0006IW-Ca for guix-patches@gnu.org; Sun, 27 Sep 2020 05:43:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kMTCy-0006A7-As for guix-patches@gnu.org; Sun, 27 Sep 2020 05:43:04 -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 09:43:04 +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.160119972823550 (code B ref 43539); Sun, 27 Sep 2020 09:43:04 +0000 Received: (at 43539) by debbugs.gnu.org; 27 Sep 2020 09:42:08 +0000 Received: from localhost ([127.0.0.1]:48318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMTC4-00067l-8z for submit@debbugs.gnu.org; Sun, 27 Sep 2020 05:42:08 -0400 Received: from flashner.co.il ([178.62.234.194]:37642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMTC1-00067E-61 for 43539@debbugs.gnu.org; Sun, 27 Sep 2020 05:42:07 -0400 Received: from localhost (unknown [31.210.181.177]) by flashner.co.il (Postfix) with ESMTPSA id 3231C4004A; Sun, 27 Sep 2020 09:41:59 +0000 (UTC) Date: Sun, 27 Sep 2020 12:41:25 +0300 From: Efraim Flashner Message-ID: <20200927094125.GD1386@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> <20200927084951.GC1386@E5400> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EP0wieDxd4TSJjHq" Content-Disposition: inline In-Reply-To: <20200927084951.GC1386@E5400> 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: llfTI9IvSOGd --EP0wieDxd4TSJjHq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 27, 2020 at 11:49:51AM +0300, Efraim Flashner wrote: > 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/a= ux-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 ru= ntimepath. > > >> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.= guix-profile", $GUIX_ENVIRONMENT] > > >> > >>=20 > > >> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix= -profile? > > >> > >> This would allow users to keep a separate profile for Vim thing= s. > > >> > > > > >> > > That was the one part I didn't really like about my patch. Unfor= tunately > > >> > > 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 abs= olute > > >> > 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 >=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 =2E.. Actually replace all of these 'etc' with 'usr'. > > [...] > >=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 runtimepat= h. > > > +for directory in ["/run/current-system/profile", $HOME . "/.guix-pro= file", $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? >=20 > 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 >=20 >=20 > --=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 unencrypt= ed --=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 --EP0wieDxd4TSJjHq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9wXkIACgkQQarn3Mo9 g1HhcxAAvOy01Eb+9OEO6HaP2pkhXvpjXxPA6/bH/jfpS3mjdRfEGlqwlQnyPzIt v/T2UGM7bS9G1xjY8t3IDOiSP+6zjNaERDI+D+lyjuV+SPWuJtEFr+Ji9nTMLNYh YRJTPXqNtKHYldVkp0tOVt/SMrmlRiDyN6ua1jNhcdQ6IaH4rfettHE479LTNM/J 0ZzwFH1Y3nws0U36Q5InHSBvksjJQo8kNWpWFjPcrHjzeCJdcFtLiK3YV8cLtS0q 6XeQdXn7qozkQDaWRrQn5mB1kCaekY6nQ6pDNvQ5WdUn+is6xrKvBWJ46hE68K6H 3xZ26UjW/irIa7cBHh35C89HM87vDDRb22RRl9H5xNBYd8fGtjcSaIE4qq4FZqFK UKeJ9JxccTLEpw5iRsa8x24saKc7fs2CqNBSnFOlLMkyhS4vuwh6LU7iyRF1KMAW 3fHlIPIpVIT+0KoZTS1x12zV06k0yx2gVcsFubFbo8AhnWEDWXIIVSCr0k7UPDK3 e0n7BOt/vpaNuiShHWIB9aAib96MpWIm4ri051aP10mLmbf8TFmHfSAtb8FxJ2Un RGTKKVPj+OrEMUEQrsdpKPrZXVIgwTd3+9Cy4x2etd4RE1IguItsWVVtJc2uIkS9 m3iO8ih2uzeTES6OWalt5vFTZnHByXS38cQnQgI2ZSz9zF7zkdY= =5C8F -----END PGP SIGNATURE----- --EP0wieDxd4TSJjHq--