diff mbox series

[bug#54221,1/2] gnu: vim: Use native-search-paths to search for plugins.

Message ID 06694925c423c7e08e49e8384c0009c9f1cd2aa9.1677096448.git.seerlite@disroot.org
State New
Headers show
Series [bug#54221,1/2] gnu: vim: Use native-search-paths to search for plugins. | expand

Commit Message

SeerLite Feb. 22, 2023, 8:07 p.m. UTC
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
[phases]: Search for tzdata files in the correct input fields.
---
 gnu/packages/aux-files/guix.vim | 11 ++++-------
 gnu/packages/vim.scm            | 10 ++++++++--
 2 files changed, 12 insertions(+), 9 deletions(-)

Comments

Liliana Marie Prikler Aug. 5, 2023, 12:28 p.m. UTC | #1
Am Mittwoch, dem 22.02.2023 um 17:07 -0300 schrieb SeerLite:
> Previously a hardcoded list of directories was used, which albeit
> quite accurate during normal use, didn't fully respect the active
> Guix environment and didn't make use of Guix's search-paths feature.
> 
> * gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the
> runtimepath.
> * gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
> specification for 'GUIX_VIMRUNTIME'.
> [phases]: Search for tzdata files in the correct input fields.
Should be [#:phases]<set-environment-variables>.  For clarity's sake, I
think this phase should be renamed to <prepare-test-environment>, so
that it doesn't look as though these variables affect the build output.


Otherwise LGTM, but I'm not a vim person.
diff mbox series

Patch

diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +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", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 6baf10915a..d4e4f88756 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -13,6 +13,7 @@ 
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022, 2023 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2023 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -112,10 +113,10 @@  (define-public vim
              (substitute* "src/if_cscope.c"
                (("/bin/sh") (search-input-file inputs "/bin/sh")))))
          (add-before 'check 'set-environment-variables
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
              ;; One of the tests tests timezone-dependent functions.
              (setenv "TZDIR"
-                     (search-input-directory inputs "share/zoneinfo"))
+                     (search-input-directory (or native-inputs inputs) "share/zoneinfo"))
 
              ;; Make sure the TERM environment variable is set for the tests
              (setenv "TERM" "xterm")))
@@ -154,6 +155,11 @@  (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs