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: > > > > > 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 writes: > > >> > > > >> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote: > > >> > >> > > >> > >> Efraim Flashner 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@E5400 ~$ echo $GUIX_PROFILE > > >> > > > > >> > > (ins)efraim@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/. > > > > -- > Efraim Flashner אפרים פלשנר > GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 > Confidentiality cannot be guaranteed on emails sent or received unencrypted -- Efraim Flashner אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted