unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: 43539@debbugs.gnu.org
Subject: [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins.
Date: Tue, 22 Sep 2020 12:37:34 +0300	[thread overview]
Message-ID: <20200922093734.GF1007@E5400> (raw)
In-Reply-To: <20200920205758.GD6984@E5400>


[-- Attachment #1.1: Type: text/plain, Size: 2421 bytes --]

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@flashner.co.il> writes:
> > 
> > > On Sun, Sep 20, 2020 at 09:29:27PM +0200, Ricardo Wurmus wrote:
> > >> 
> > >> Efraim Flashner <efraim@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@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.


-- 
Efraim Flashner   <efraim@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

[-- Attachment #1.2: 0001-gnu-vim-Automatically-find-vim-plugins.patch --]
[-- Type: text/plain, Size: 2835 bytes --]

From 89a465c32a1d75a473cb643c49bbf65c093b1d4e Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Fri, 18 Sep 2020 18:25:06 +0300
Subject: [PATCH] gnu: vim: Automatically find vim plugins.

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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-09-22  9:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 19:15 [bug#43539] [PATCH] gnu: vim: Automatically find vim plugins Efraim Flashner
2020-09-20 19:29 ` Ricardo Wurmus
2020-09-20 19:32   ` Efraim Flashner
2020-09-20 19:50     ` Ricardo Wurmus
2020-09-20 20:57       ` Efraim Flashner
2020-09-22  9:37         ` Efraim Flashner [this message]
2020-09-25 17:48           ` Marius Bakke
2020-09-27  8:49             ` Efraim Flashner
2020-09-27  9:41               ` Efraim Flashner
2020-12-20 11:10             ` bug#43539: " Efraim Flashner

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922093734.GF1007@E5400 \
    --to=efraim@flashner.co.il \
    --cc=43539@debbugs.gnu.org \
    --cc=rekado@elephly.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).