GNU bug report logs - #43539
[PATCH] gnu: vim: Automatically find vim plugins.

Previous Next

Package: guix-patches;

Reported by: Efraim Flashner <efraim <at> flashner.co.il>

Date: Sun, 20 Sep 2020 19:17:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43539 in the body.
You can then email your comments to 43539 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Efraim Flashner <efraim <at> flashner.co.il>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 20 Sep 2020 19:17:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: guix-patches <at> gnu.org
Cc: Efraim Flashner <efraim <at> flashner.co.il>
Subject: [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 20 Sep 2020 22:15:23 +0300
* gnu/packages/vim.scm (vim)[arguments]: Add new 'install-guix.vim phase
to install vendor specific vimrc.
* gnu/packages/aux-files/guix.vim: New file.
* Makefile.am (AUX_FILES): Register it.
---
 Makefile.am                     |  1 +
 gnu/packages/aux-files/guix.vim |  7 +++++++
 gnu/packages/vim.scm            | 10 +++++++++-
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/aux-files/guix.vim

diff --git a/Makefile.am b/Makefile.am
index 8e91e1e558..d0867ecd22 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -332,6 +332,7 @@ dist_noinst_DATA =				\
 AUX_FILES =						\
   gnu/packages/aux-files/chromium/master-preferences.json		\
   gnu/packages/aux-files/emacs/guix-emacs.el		\
+  gnu/packages/aux-files/guix.vim			\
   gnu/packages/aux-files/linux-libre/5.8-arm.conf       \
   gnu/packages/aux-files/linux-libre/5.8-arm64.conf     \
   gnu/packages/aux-files/linux-libre/5.8-i686.conf      \
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 runtimepath.
+for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
+    let testpath = directory . "/share/vim/vimfiles"
+    if isdirectory(testpath)
+        let &rtp = join([&rtp,testpath], ',')
+    endif
+endfor
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index c6b1092e71..dba5b5a38e 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -136,7 +136,14 @@
              (substitute* "src/testdir/test_popupwin.vim"
                ((".*Test_popup_drag_termwin.*" line)
                 (string-append line "return\n")))
-             #t)))))
+             #t))
+         (add-after 'install 'install-guix.vim
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((vimdir (string-append (assoc-ref outputs "out") "/share/vim")))
+               (mkdir-p vimdir)
+               (copy-file (assoc-ref inputs "guix.vim")
+                          (string-append vimdir "/vimrc"))
+               #t))))))
     (inputs
      `(("gawk" ,gawk)
        ("ncurses" ,ncurses)
@@ -144,6 +151,7 @@
        ("tcsh" ,tcsh)))                 ; For runtime/tools/vim32
     (native-inputs
      `(("libtool" ,libtool)
+       ("guix.vim" ,(search-auxiliary-file "guix.vim"))
 
        ;; For tests.
        ("tzdata" ,tzdata-for-tests)))
-- 
2.28.0





Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:29:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: guix-patches <at> gnu.org, 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 20 Sep 2020 21:29:27 +0200
Efraim Flashner <efraim <at> flashner.co.il> writes:

> 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 runtimepath.
> +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]

How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
This would allow users to keep a separate profile for Vim things.

-- 
Ricardo




Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:29:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:33:02 GMT) Full text and rfc822 format available.

Message #14 received at 43539 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: guix-patches <at> gnu.org, 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 20 Sep 2020 22:32:15 +0300
[Message part 1 (text/plain, inline)]
On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> 
> Efraim Flashner <efraim <at> flashner.co.il> writes:
> 
> > 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 runtimepath.
> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
> 
> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
> 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. Unfortunately
I don't seem to have $GUIX_PROFILE set on my machine.

(ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE

(ins)efraim <at> E5400 ~$

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:34:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:49:02 GMT) Full text and rfc822 format available.

Message #20 received at 43539 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: guix-patches <at> gnu.org, 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 20 Sep 2020 21:50:12 +0200
Efraim Flashner <efraim <at> flashner.co.il> writes:

> On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
>> 
>> Efraim Flashner <efraim <at> flashner.co.il> writes:
>> 
>> > 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 runtimepath.
>> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
>> 
>> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
>> 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. Unfortunately
> I don't seem to have $GUIX_PROFILE set on my machine.
>
> (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
>
> (ins)efraim <at> E5400 ~$

Me neither!  But when loading profiles we suggest this approach:

   export GUIX_PROFILE=/the/location/of/the/.guix-profile
   source $GUIX_PROFILE/etc/profile

The variable is set in that case, because that affects whether absolute
store file names are used or the symlink
“/the/location/of/the/.guix-profile”.

-- 
Ricardo




Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 19:50:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 20:59:01 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: guix-patches <at> gnu.org, 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 20 Sep 2020 23:57:58 +0300
[Message part 1 (text/plain, inline)]
On Sun, Sep 20, 2020 at 09:50:12PM +0200, Ricardo Wurmus wrote:
> 
> Efraim Flashner <efraim <at> flashner.co.il> writes:
> 
> > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> >> 
> >> Efraim Flashner <efraim <at> flashner.co.il> writes:
> >> 
> >> > 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 runtimepath.
> >> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
> >> 
> >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
> >> 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. Unfortunately
> > I don't seem to have $GUIX_PROFILE set on my machine.
> >
> > (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
> >
> > (ins)efraim <at> E5400 ~$
> 
> Me neither!  But when loading profiles we suggest this approach:
> 
>    export GUIX_PROFILE=/the/location/of/the/.guix-profile
>    source $GUIX_PROFILE/etc/profile
> 
> The variable is set in that case, because that affects whether absolute
> store file names are used or the symlink
> “/the/location/of/the/.guix-profile”.

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.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 20 Sep 2020 20:59:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Tue, 22 Sep 2020 09:39:01 GMT) Full text and rfc822 format available.

Message #32 received at 43539 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Tue, 22 Sep 2020 12:37:34 +0300
[Message part 1 (text/plain, inline)]
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:
> > 
> > Efraim Flashner <efraim <at> flashner.co.il> writes:
> > 
> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> > >> 
> > >> Efraim Flashner <efraim <at> flashner.co.il> writes:
> > >> 
> > >> > 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 runtimepath.
> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
> > >> 
> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
> > >> 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. Unfortunately
> > > I don't seem to have $GUIX_PROFILE set on my machine.
> > >
> > > (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
> > >
> > > (ins)efraim <at> E5400 ~$
> > 
> > Me neither!  But when loading profiles we suggest this approach:
> > 
> >    export GUIX_PROFILE=/the/location/of/the/.guix-profile
> >    source $GUIX_PROFILE/etc/profile
> > 
> > The variable is set in that case, because that affects whether absolute
> > store file names are used or the symlink
> > “/the/location/of/the/.guix-profile”.
> 
> 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.


-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[0001-gnu-vim-Automatically-find-vim-plugins.patch (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Fri, 25 Sep 2020 17:49:01 GMT) Full text and rfc822 format available.

Message #35 received at 43539 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <marius <at> gnu.org>
To: Efraim Flashner <efraim <at> flashner.co.il>,
 Ricardo Wurmus <rekado <at> elephly.net>
Cc: 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Fri, 25 Sep 2020 19:48:34 +0200
[Message part 1 (text/plain, inline)]
Efraim Flashner <efraim <at> flashner.co.il> writes:

> 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:
>> > 
>> > Efraim Flashner <efraim <at> flashner.co.il> writes:
>> > 
>> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
>> > >> 
>> > >> Efraim Flashner <efraim <at> flashner.co.il> writes:
>> > >> 
>> > >> > 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 runtimepath.
>> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
>> > >> 
>> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
>> > >> 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. Unfortunately
>> > > I don't seem to have $GUIX_PROFILE set on my machine.
>> > >
>> > > (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
>> > >
>> > > (ins)efraim <at> E5400 ~$
>> > 
>> > Me neither!  But when loading profiles we suggest this approach:
>> > 
>> >    export GUIX_PROFILE=/the/location/of/the/.guix-profile
>> >    source $GUIX_PROFILE/etc/profile
>> > 
>> > The variable is set in that case, because that affects whether absolute
>> > store file names are used or the symlink
>> > “/the/location/of/the/.guix-profile”.
>> 
>> 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.

So vim only expects a single vimfiles directory in those variables?

[...]

> +++ 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-profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
> +    let vimplugins = directory . "/share/vim/vimfiles"
> +    if isdirectory(vimplugins)
> +        let &rtp = join([&rtp,vimplugins], ',')
> +    endif
> +endfor

I wonder if we could generalize this to a proper search path with
something like (pseudo code):

  for directory in getenv("VIM_PLUGIN_PATH").split(":")
    let vimplugins = directory . "share/vim/vimfiles"
    ...

And then in the vim package:

(native-search-paths
 (list
  (search-path-specification
   (variable "VIM_PLUGIN_PATH")
   (files '("share/vim/vimfiles")))))

...which makes Guix populate VIM_PLUGIN_PATH automatically as plugins
are added to a profile/environment (as long as it contains the 'vim'
package).

WDYT?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 27 Sep 2020 08:51:02 GMT) Full text and rfc822 format available.

Message #38 received at 43539 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Marius Bakke <marius <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 27 Sep 2020 11:49:51 +0300
[Message part 1 (text/plain, inline)]
On Fri, Sep 25, 2020 at 07:48:34PM +0200, Marius Bakke wrote:
> Efraim Flashner <efraim <at> flashner.co.il> writes:
> 
> > 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:
> >> > 
> >> > Efraim Flashner <efraim <at> flashner.co.il> writes:
> >> > 
> >> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> >> > >> 
> >> > >> Efraim Flashner <efraim <at> flashner.co.il> writes:
> >> > >> 
> >> > >> > 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 runtimepath.
> >> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
> >> > >> 
> >> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
> >> > >> 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. Unfortunately
> >> > > I don't seem to have $GUIX_PROFILE set on my machine.
> >> > >
> >> > > (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
> >> > >
> >> > > (ins)efraim <at> E5400 ~$
> >> > 
> >> > Me neither!  But when loading profiles we suggest this approach:
> >> > 
> >> >    export GUIX_PROFILE=/the/location/of/the/.guix-profile
> >> >    source $GUIX_PROFILE/etc/profile
> >> > 
> >> > The variable is set in that case, because that affects whether absolute
> >> > store file names are used or the symlink
> >> > “/the/location/of/the/.guix-profile”.
> >> 
> >> 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.
> 
> So vim only expects a single vimfiles directory in those variables?
> 

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}.

> [...]
> 
> > +++ 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-profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
> > +    let vimplugins = directory . "/share/vim/vimfiles"
> > +    if isdirectory(vimplugins)
> > +        let &rtp = join([&rtp,vimplugins], ',')
> > +    endif
> > +endfor
> 
> I wonder if we could generalize this to a proper search path with
> something like (pseudo code):
> 
>   for directory in getenv("VIM_PLUGIN_PATH").split(":")
>     let vimplugins = directory . "share/vim/vimfiles"
>     ...
> 
> And then in the vim package:
> 
> (native-search-paths
>  (list
>   (search-path-specification
>    (variable "VIM_PLUGIN_PATH")
>    (files '("share/vim/vimfiles")))))
> 
> ...which makes Guix populate VIM_PLUGIN_PATH automatically as plugins
> are added to a profile/environment (as long as it contains the 'vim'
> package).
> 
> 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/<package-name>.



-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#43539; Package guix-patches. (Sun, 27 Sep 2020 09:43:04 GMT) Full text and rfc822 format available.

Message #41 received at 43539 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Marius Bakke <marius <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 43539 <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 27 Sep 2020 12:41:25 +0300
[Message part 1 (text/plain, inline)]
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 <efraim <at> flashner.co.il> writes:
> > 
> > > 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:
> > >> > 
> > >> > Efraim Flashner <efraim <at> flashner.co.il> writes:
> > >> > 
> > >> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> > >> > >> 
> > >> > >> Efraim Flashner <efraim <at> flashner.co.il> writes:
> > >> > >> 
> > >> > >> > 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 runtimepath.
> > >> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
> > >> > >> 
> > >> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
> > >> > >> 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. Unfortunately
> > >> > > I don't seem to have $GUIX_PROFILE set on my machine.
> > >> > >
> > >> > > (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
> > >> > >
> > >> > > (ins)efraim <at> E5400 ~$
> > >> > 
> > >> > Me neither!  But when loading profiles we suggest this approach:
> > >> > 
> > >> >    export GUIX_PROFILE=/the/location/of/the/.guix-profile
> > >> >    source $GUIX_PROFILE/etc/profile
> > >> > 
> > >> > The variable is set in that case, because that affects whether absolute
> > >> > store file names are used or the symlink
> > >> > “/the/location/of/the/.guix-profile”.
> > >> 
> > >> 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.
> > 
> > So vim only expects a single vimfiles directory in those variables?
> > 
> 
> 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}.
> 

... Actually replace all of these 'etc' with 'usr'.

> > [...]
> > 
> > > +++ 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-profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
> > > +    let vimplugins = directory . "/share/vim/vimfiles"
> > > +    if isdirectory(vimplugins)
> > > +        let &rtp = join([&rtp,vimplugins], ',')
> > > +    endif
> > > +endfor
> > 
> > I wonder if we could generalize this to a proper search path with
> > something like (pseudo code):
> > 
> >   for directory in getenv("VIM_PLUGIN_PATH").split(":")
> >     let vimplugins = directory . "share/vim/vimfiles"
> >     ...
> > 
> > And then in the vim package:
> > 
> > (native-search-paths
> >  (list
> >   (search-path-specification
> >    (variable "VIM_PLUGIN_PATH")
> >    (files '("share/vim/vimfiles")))))
> > 
> > ...which makes Guix populate VIM_PLUGIN_PATH automatically as plugins
> > are added to a profile/environment (as long as it contains the 'vim'
> > package).
> > 
> > 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/<package-name>.
> 
> 
> 
> -- 
> Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
> GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
> Confidentiality cannot be guaranteed on emails sent or received unencrypted



-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Sun, 20 Dec 2020 11:11:01 GMT) Full text and rfc822 format available.

Notification sent to Efraim Flashner <efraim <at> flashner.co.il>:
bug acknowledged by developer. (Sun, 20 Dec 2020 11:11:01 GMT) Full text and rfc822 format available.

Message #46 received at 43539-done <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Marius Bakke <marius <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 43539-done <at> debbugs.gnu.org
Subject: Re: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Sun, 20 Dec 2020 13:10:03 +0200
[Message part 1 (text/plain, inline)]
On Fri, Sep 25, 2020 at 07:48:34PM +0200, Marius Bakke wrote:
> Efraim Flashner <efraim <at> flashner.co.il> writes:
> 
> > 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:
> >> > 
> >> > Efraim Flashner <efraim <at> flashner.co.il> writes:
> >> > 
> >> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> >> > >> 
> >> > >> Efraim Flashner <efraim <at> flashner.co.il> writes:
> >> > >> 
> >> > >> > 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 runtimepath.
> >> > >> > +for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_ENVIRONMENT]
> >> > >> 
> >> > >> How about using $GUIX_PROFILE as well or instead of $HOME/.guix-profile?
> >> > >> 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. Unfortunately
> >> > > I don't seem to have $GUIX_PROFILE set on my machine.
> >> > >
> >> > > (ins)efraim <at> E5400 ~$ echo $GUIX_PROFILE
> >> > >
> >> > > (ins)efraim <at> E5400 ~$
> >> > 
> >> > Me neither!  But when loading profiles we suggest this approach:
> >> > 
> >> >    export GUIX_PROFILE=/the/location/of/the/.guix-profile
> >> >    source $GUIX_PROFILE/etc/profile
> >> > 
> >> > The variable is set in that case, because that affects whether absolute
> >> > store file names are used or the symlink
> >> > “/the/location/of/the/.guix-profile”.
> >> 
> >> 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.
> 
> So vim only expects a single vimfiles directory in those variables?
> 
> [...]
> 
> > +++ 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-profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
> > +    let vimplugins = directory . "/share/vim/vimfiles"
> > +    if isdirectory(vimplugins)
> > +        let &rtp = join([&rtp,vimplugins], ',')
> > +    endif
> > +endfor
> 
> I wonder if we could generalize this to a proper search path with
> something like (pseudo code):
> 
>   for directory in getenv("VIM_PLUGIN_PATH").split(":")
>     let vimplugins = directory . "share/vim/vimfiles"
>     ...

Note for the future, 'let vimplugins = directory' is what works here.

> 
> And then in the vim package:
> 
> (native-search-paths
>  (list
>   (search-path-specification
>    (variable "VIM_PLUGIN_PATH")
>    (files '("share/vim/vimfiles")))))
> 
> ...which makes Guix populate VIM_PLUGIN_PATH automatically as plugins
> are added to a profile/environment (as long as it contains the 'vim'
> package).
> 
> WDYT?

I wasn't able to get anything like that to work. For some reason the
only combination I got using VIM_PLUGIN_PATH to work was a
guix-environment with vim and a plugin in it.

I pushed the version with the hardcoded list of directories since I was
able to actually get that one to work.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Jan 2021 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 71 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.