unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#60029] [PATCH core-updates 0/4] vim-build-system
@ 2022-12-13  0:38 Jonathan Scoresby
  2022-12-13  8:34 ` [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-13  0:38 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

Hey guix! I know there have been attempts to do this in the past, and I
know that emacs is the thing to use in the guix world, but I made a
build system for vim plugins. I had a few goals in this attempt:

1. Better understand Guile Scheme and Guix, as I am new to both
2. Make help tags available on vim plugins installed with guix
   (see issues 51540 30385)
3. Take advantage of vim's built-in package manager
4. Make installing plugins for vim and neovim as easy as possible

There are a lot of plugin managers for vim, but I figured that if guix
is such a great package manager, you shouldn't need third party
solutions.

I thought of a lot of ways to separate vim and neovim plugins. It's
not neccesarily a trivial problem because:
	1. neovim can use vim plugins, but not usually vice-versa. 
	2. I wanted to use vim to generate helptags for vim plugins and
	neovim to generate helptags for neovim plugins as the 
	implemenations are slightly different and I wanted avoid any 
	possible errors, but I also didn't want to have to include 
	neovim as an input when unneccesary.
	3. I wanted there to be as much code reuse as possible.

For these reasons, I decided that for plugins that are compatible with
both, a package would specify a neovim output. For both vim and neovim, 
all plugins are installed to the "pack" folder where neovim and vim both
look for packages automatically. By default, plugins are installed to 
the "start" folder, but that can be changed for a specific package using 
the "mode" keyword.  

I based this off of 'core-updates' just because I made a slight change
to the copy-build-system so that files could potentially be installed to
an output other than "out." I believe this causes a lot of packages to
rebuild even though it doesn't have any actuall effects. If this
doesn't belong in core-updates, let me know.

Jonathan Scoresby (4):
  guix: copy-build-system: allow install plan directives to specify
    output
  gnu: vim: add relevant locations to 'package-path' instead of
    'runtime-path'
  guix: add vim-build-system
  gnu: have vim packages use vim-build-system

 gnu/packages/aux-files/guix.vim  |  10 +-
 gnu/packages/vim.scm             | 234 +++++--------------------------
 guix/build-system/vim.scm        | 160 +++++++++++++++++++++
 guix/build/copy-build-system.scm |  12 +-
 guix/build/vim-build-system.scm  | 137 ++++++++++++++++++
 5 files changed, 345 insertions(+), 208 deletions(-)
 create mode 100644 guix/build-system/vim.scm
 create mode 100644 guix/build/vim-build-system.scm


base-commit: 6454208222d6e7760daa964b590f35ea75ffe0e5
-- 
2.38.1





^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output
  2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
@ 2022-12-13  8:34 ` Jonathan Scoresby
  2022-12-13 19:05   ` ( via Guix-patches via
  2022-12-13  8:34 ` [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-13  8:34 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 guix/build/copy-build-system.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/guix/build/copy-build-system.scm b/guix/build/copy-build-system.scm
index fb2d1db056..5d2a137268 100644
--- a/guix/build/copy-build-system.scm
+++ b/guix/build/copy-build-system.scm
@@ -133,8 +133,16 @@ (define* (install #:key install-plan outputs #:allow-other-keys)
                                       (string-append target "/")))
              file-list))))
 
-  (define* (install source target #:key include exclude include-regexp exclude-regexp)
-    (let ((final-target (string-append (assoc-ref outputs "out") "/" target))
+  (define* (install source
+                    target
+                    #:key include
+                    exclude
+                    include-regexp
+                    exclude-regexp
+                    output)
+    (let ((final-target (string-append (assoc-ref outputs
+                                                  (or output "out")) "/"
+                                       target))
           (filters? (or include exclude include-regexp exclude-regexp)))
       (when (and (not (file-is-directory? source))
                  filters?)
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path'
  2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
  2022-12-13  8:34 ` [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
@ 2022-12-13  8:34 ` Jonathan Scoresby
  2022-12-13 19:06   ` ( via Guix-patches via
  2022-12-13  8:34 ` [bug#60029] [PATCH 3/4] guix: add vim-build-system Jonathan Scoresby
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-13  8:34 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 gnu/packages/aux-files/guix.vim | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..7e7f8d653a 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,13 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
+" This apends all applicable vim paths to the end of packagepath
 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], ',')
+        let &pp = join([&pp,vimplugins], ',')
     endif
 endfor
-" Unconditionally add */after directories last, as intended by upstream
-" TODO: Remove duplicate */after directories
-for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
-    let vimplugins = directory . "/after"
-    let &rtp = join([&rtp,vimplugins], ',')
-endfor
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 3/4] guix: add vim-build-system
  2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
  2022-12-13  8:34 ` [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
  2022-12-13  8:34 ` [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
@ 2022-12-13  8:34 ` Jonathan Scoresby
  2022-12-13  8:34 ` [bug#60029] [PATCH 4/4] gnu: have vim packages use vim-build-system Jonathan Scoresby
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-13  8:34 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 guix/build-system/vim.scm       | 160 ++++++++++++++++++++++++++++++++
 guix/build/vim-build-system.scm | 137 +++++++++++++++++++++++++++
 2 files changed, 297 insertions(+)
 create mode 100644 guix/build-system/vim.scm
 create mode 100644 guix/build/vim-build-system.scm

diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm
new file mode 100644
index 0000000000..4b74c24e10
--- /dev/null
+++ b/guix/build-system/vim.scm
@@ -0,0 +1,160 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system vim)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix gexp)
+  #:use-module (guix monads)
+  #:use-module (guix packages)
+  #:use-module (guix search-paths)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:export (%vim-build-system-modules vim-build vim-build-system))
+
+;; Commentary:
+;;
+;; Standard package installer for vim and neovim plugins.
+;; This is implemented as an extension of `copy-build-system'
+;; and takes advantage of vim and neovim's built-in package manager.
+;; It extends the installation procedure from the copy-build-system
+;; to put files in the correct place and then generates help tags.
+;;
+;; Code:
+
+(define %vim-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build vim-build-system)
+    ,@%copy-build-system-modules))
+
+(define (default-vim)
+  "Return the default Vim package."
+  ;; Lazily resolve the binding to avoid a circular dependency.
+  (let ((vim (resolve-interface '(gnu packages vim))))
+    (module-ref vim
+                'vim)))
+
+(define (default-neovim)
+  "Return the default Neovim package."
+  (let ((vim (resolve-interface '(gnu packages vim))))
+    (module-ref vim
+                'neovim)))
+
+(define* (lower name
+                #:key source
+                inputs
+                native-inputs
+                outputs
+                system
+                target
+                (vim? #f)
+                (neovim? #f)
+                (vim (default-vim))
+                (neovim (default-neovim))
+                #:allow-other-keys #:rest arguments)
+  "Return a bag for NAME."
+  (let* ((private-keywords '(#:target #:vim #:neovim #:inputs #:native-inputs))
+         (vim? (or (= 0
+                      (string-contains name "vim")) vim?))
+         (neovim? (or (not (not (or (string-contains name "neovim")
+                                    (member "neovim" outputs)))) neovim?))
+         (vim-inputs (append (if vim?
+                                 `(("vim" ,vim))
+                                 '())
+                             (if neovim?
+                                 `(("neovim" ,neovim))
+                                 '())))
+         (vim-arguments (append arguments
+                                `(#:vim? ,vim?
+                                  #:neovim? ,neovim?))))
+    (bag (name name)
+         (system system)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '()) ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'.
+                        ,@(standard-packages)))
+         (build-inputs `(,@vim-inputs ,@native-inputs))
+         (outputs outputs)
+         (build vim-build)
+         (arguments (strip-keyword-arguments private-keywords vim-arguments)))))
+
+(define* (vim-build name
+                    inputs
+                    #:key guile
+                    source
+                    (vim? #f)
+                    (neovim? #f)
+                    (mode "start")
+                    (install-plan ''())
+                    (phases '(@ (guix build vim-build-system) %standard-phases))
+                    (outputs '("out"))
+                    (search-paths '())
+                    (system (%current-system))
+                    (imported-modules %vim-build-system-modules)
+                    (modules '((guix build vim-build-system)
+                               (guix build utils))))
+
+  (define build
+    (with-imported-modules imported-modules
+                           #~(begin
+                               (use-modules #$@modules)
+                               #$(with-build-variables inputs outputs
+                                                       #~(vim-build #:name #$name
+                                                          #:vim? #$vim?
+                                                          #:neovim? #$neovim?
+                                                          #:mode #$mode
+                                                          #:install-plan #$(if
+                                                                            (pair?
+                                                                             install-plan)
+                                                                            (sexp->gexp
+                                                                             install-plan)
+                                                                            install-plan)
+                                                          #:source #+source
+                                                          #:system #$system
+                                                          #:phases #$(if (pair?
+                                                                          phases)
+                                                                      (sexp->gexp
+                                                                       phases)
+                                                                      phases)
+                                                          #:outputs %outputs
+                                                          #:search-paths '#$(sexp->gexp
+                                                                             (map
+                                                                              search-path-specification->sexp
+                                                                              search-paths))
+                                                          #:inputs
+                                                          %build-inputs)))))
+
+  (mlet %store-monad
+        ((guile (package->derivation (or guile
+                                         (default-guile)) system
+                                     #:graft? #f)))
+        (gexp->derivation name
+                          build
+                          #:system system
+                          #:target #f
+                          #:guile-for-build guile)))
+
+(define vim-build-system
+  (build-system (name 'vim)
+                (description "The standard Vim build system")
+                (lower lower)))
+
+;;; vim.scm ends here
diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-system.scm
new file mode 100644
index 0000000000..38d82c416b
--- /dev/null
+++ b/guix/build/vim-build-system.scm
@@ -0,0 +1,137 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build vim-build-system)
+  #:use-module ((guix build copy-build-system)
+                #:prefix copy:)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 ftw)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases vim-build))
+
+;; Commentary:
+;;
+;; System for installing vim and neovim plugins. It downloads
+;; the source and copies the appropriate files to vim and nvim
+;; packpaths. It then generates helptags.
+;;
+;; Code:
+
+(define copy:install
+  (assoc-ref copy:%standard-phases
+             'install))
+
+(define vim-path
+  "/share/vim/vimfiles/pack/guix/")
+(define nvim-path
+  "/share/nvim/site/pack/guix/")
+
+(define* (install #:key name
+                  install-plan
+                  neovim?
+                  vim?
+                  mode
+                  outputs
+                  #:allow-other-keys)
+
+  (let* ((include-regexp '(".*\\/.*\\/.*"))
+         (exclude-regexp '("scripts/.*" "tests?/.*" ".*\\/\\..*"))
+         (vim-install (if vim?
+                          `(("." ,(string-append vim-path mode "/" name "/")
+                             #:include-regexp ,include-regexp
+                             #:exclude-regexp ,exclude-regexp))
+                          '()))
+         (neovim-outputs (if vim?
+                             `(("." ,(string-append nvim-path mode "/" name
+                                                    "/")
+                                #:include-regexp ,include-regexp
+                                #:exclude-regexp ,exclude-regexp
+                                #:output "neovim"))
+                             `(("." ,(string-append nvim-path mode "/" name
+                                                    "/")
+                                #:include-regexp ,include-regexp
+                                #:exclude-regexp ,exclude-regexp))))
+         (neovim-install (if neovim? neovim-outputs
+                             '())))
+    (copy:install #:outputs outputs
+                  #:install-plan (append vim-install neovim-install
+                                         install-plan))))
+
+(define* (generate-helptags #:key name
+                            neovim?
+                            vim?
+                            mode
+                            outputs
+                            #:allow-other-keys)
+
+  (define (vim-generate output)
+    (invoke "vim" "--clean" "-en" "--cmd"
+            (string-append "helptags "
+                           output
+                           vim-path
+                           mode
+                           "/"
+                           name
+                           "/doc | q")))
+
+  (define (neovim-generate output)
+    (invoke "nvim"
+            "--clean"
+            "--headless"
+            "-en"
+            "--cmd"
+            (string-append "helptags "
+                           output
+                           nvim-path
+                           mode
+                           "/"
+                           name
+                           "/doc | q")))
+
+  (when (scandir "./doc")
+    (let ((out (assoc-ref outputs "out"))
+          (neovim (assoc-ref outputs "neovim")))
+      (if vim?
+          (begin
+            (vim-generate out)
+            (if neovim?
+                (neovim-generate neovim)))
+          (neovim-generate out)))))
+
+(define %standard-phases
+  ;; Everything is as with the Copy Build System except for
+  ;; the addition of the generate-helptags phase and a few
+  ;; custom actions are added to the install phase
+  (modify-phases copy:%standard-phases
+    (replace 'install
+      install)
+    (add-after 'install 'generate-helptags
+      generate-helptags)))
+
+(define* (vim-build #:key inputs
+                    (phases %standard-phases)
+                    #:allow-other-keys #:rest args)
+  "Build the given package, applying all of PHASES in order."
+  (apply copy:copy-build
+         #:inputs inputs
+         #:phases phases
+         args))
+
+;;; vim-build-system.scm ends here
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 4/4] gnu: have vim packages use vim-build-system
  2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
                   ` (2 preceding siblings ...)
  2022-12-13  8:34 ` [bug#60029] [PATCH 3/4] guix: add vim-build-system Jonathan Scoresby
@ 2022-12-13  8:34 ` Jonathan Scoresby
  2022-12-14 21:01 ` [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
  2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
  5 siblings, 0 replies; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-13  8:34 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 gnu/packages/vim.scm | 234 +++++++------------------------------------
 1 file changed, 36 insertions(+), 198 deletions(-)

diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index a6250f71de..738883d20b 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages vim)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
+  #:use-module (guix build-system vim)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
@@ -288,12 +289,7 @@ (define-public vim-neocomplete
        (sha256
         (base32
          "1h6sci5mhdfg6sjsjpi8l5li02hg858zcayiwl60y9j2gqnd18lv"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (synopsis "Next generation completion framework for Vim")
     (description
      "@code{neocomplete}, an abbreviation of 'neo-completion with cache',
@@ -321,10 +317,7 @@ (define-public vim-neosnippet-snippets
          (sha256
           (base32
            "151wpvbj6jb9jdkbhj3b77f5sq7y328spvwfbqyj1y32rg4ifmc6"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("neosnippets" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
     (synopsis "Snippets for neosnippet")
     (description
      "@code{neosnippet-snippets} provides standard snippets for the Vim plugin
@@ -350,17 +343,7 @@ (define-public vim-neosnippet
        (sha256
         (base32
          "0k80syscmpnj38ks1fq02ds59g0r4jlg9ll7z4qc048mgi35alw5"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("indent" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("rplugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (synopsis "Snippet support for Vim")
     (description
      "@code{neosnippet}, is a plugin for Vim which adds snippet support to Vim.
@@ -389,12 +372,7 @@ (define-public vim-scheme
          (sha256
           (base32
            "04h946vr4f8wxap3wzqs69y2v8n50g2zbk22jsg2kxr4c01z5cbw"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("ftplugin" "share/vim/vimfiles/")
-           ("indent" "share/vim/vimfiles/")
-           ("syntax" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Scheme syntax for Vim")
       (description
        "@code{vim-scheme} provides Scheme support for Vim (R7RS and CHICKEN).")
@@ -417,10 +395,7 @@ (define-public vim-luna
          (sha256
           (base32
            "0ka3qbhsh8lix1vyj4678j7dnchkd8khhirrnn3aylxxf8fpqyg8"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("colors" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Dark color theme for Vim")
       (description
        "@code{vim-luna} is a dark color theme for Vim.")
@@ -444,11 +419,7 @@ (define-public vim-context-filetype
          (sha256
           (base32
            "0alvrfhmd91zkd9h83s8wvgyq4iakcf6rybsyjd369qbgpcqky89"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("autoload" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Context filetype library for Vim")
       (description
        "@code{vim-context-filetype} is context filetype library for Vim script.")
@@ -468,15 +439,7 @@ (define-public vim-fugitive
         (file-name (git-file-name name version))
         (sha256
          (base32 "138290g2aph1jjhaza6biky5qi4ka6435s01bwxivllgb53g3irc"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-fugitive")
     (synopsis "Vim plugin to work with Git")
     (description "Vim-fugitive is a wrapper for Vim that complements the
@@ -498,12 +461,7 @@ (define-public vim-airline
        (sha256
         (base32
          "1aksmr73648pvyc75pfdz28k2d4ky52rn7xiwcv7lz87q3vqld7k"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (synopsis "Statusline for Vim")
     (description
      "@code{vim-airline} is an extensible statusline for Vim.
@@ -529,12 +487,7 @@ (define-public vim-airline-themes
          (sha256
           (base32
            "1sb7nb7j7bz0pv1c9bgdy0smhr0jk2b1vbdv9yzghg5lrknpsbr6"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Collection of themes for Vim-airline")
       (description
        "@code{vim-airline-themes} is a collection of themes for @code{vim-airline}.")
@@ -554,13 +507,8 @@ (define-public vim-syntastic
        (file-name (git-file-name name version))
        (sha256
         (base32 "0j91f72jaz1s6aw1hpjiz30vk2ds2aqd9gisk91grsldy6nz6hhz"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax_checkers" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
+    (outputs (list "out" "neovim"))
     (synopsis "Syntax checking plugin for Vim")
     (description
      "Vim-syntastic is a syntax checking plugin for Vim.  It runs files through
@@ -587,9 +535,8 @@ (define-public vim-solarized
           (base32 "0001mz5v3a8zvi3gzmxhi3yrsb6hs7qf6i497arsngnvj2cwn61d"))))
       (build-system copy-build-system)
       (arguments
-       '(#:install-plan
-         '(("vim-colors-solarized/colors" "share/vim/vimfiles/")
-           ("vim-colors-solarized/doc" "share/vim/vimfiles/"))))
+        '(#:install-plan '(("vim-colors-solarized"
+			    "share/vim/vimfiles/pack/guix/start/"))))
       (home-page "https://github.com/altercation/vim-colors-solarized")
       (synopsis "Solarized color scheme for Vim")
       (description
@@ -621,12 +568,8 @@ (define-public editorconfig-vim
         (sha256
          (base32
           "0mp80bi2m56bb93szw87vy6q5s85yk9g91sl4pr51316rgdv5kkv"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
+    (arguments (list #:vim? #t))
     (home-page "https://editorconfig.org/")
     (synopsis "EditorConfig plugin for Vim")
     (description "EditorConfig makes it easy to maintain the correct coding
@@ -651,11 +594,7 @@ (define-public neovim-packer
                 (sha256
                  (base32
                   "1xn08z3a21mgfvp5i1nv57jnldwxwnl5nkryiff3zc99b1mizigp"))))
-      (build-system copy-build-system)
-      (arguments
-       (list #:install-plan
-             #~'(("lua" "share/nvim/site/pack/guix/start/packer.nvim/")
-                 ("doc" "share/nvim/site/pack/guix/start/packer.nvim/"))))
+      (build-system vim-build-system)
       (home-page "https://github.com/wbthomason/packer.nvim")
       (synopsis "Plugin manager for Neovim")
       (description
@@ -664,23 +603,6 @@ (define-public neovim-packer
 is based on Vim's builtin plugin support.")
       (license license:expat))))
 
-(define-public neovim-syntastic
-  (package
-    (inherit vim-syntastic)
-    (name "neovim-syntastic")
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/nvim/site/")
-         ("doc" "share/nvim/site/")
-         ("plugin" "share/nvim/site/")
-         ("syntax_checkers" "share/nvim/site/"))))
-    (synopsis "Syntax checking plugin for Neovim")
-    (description
-     "Vim-syntastic is a syntax checking plugin for Neovim.  It runs files through
-external syntax checkers and displays any resulting errors to the user.  This
-can be done on demand, or automatically as files are saved.  If syntax errors
-are detected, the user is notified.")))
-
 (define-public neovim
   (package
     (name "neovim")
@@ -854,7 +776,8 @@ (define-public vifm
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (vifm (string-append out "/share/vifm"))
-                     (vimfiles (string-append out "/share/vim/vimfiles")))
+                     (vimfiles (string-append out 
+				"/share/vim/vimfiles/pack/guix/start/vifm")))
                 (copy-recursively (string-append vifm "/colors")
                                   (string-append vimfiles "/colors"))
                 (copy-recursively (string-append vifm "/vim")
@@ -932,17 +855,7 @@ (define-public vim-guix-vim
               (sha256
                (base32
                 "080ni4z23qdr8rkrswjqfqfrrcnpn7qdgrg14glwji46wzvwxqyx"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("compiler" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("indent" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://gitlab.com/Efraim/guix.vim")
     (synopsis "Guix integration in Vim")
     (description "This package provides support for GNU Guix in Vim.")
@@ -961,11 +874,7 @@ (define-public vim-asyncrun
               (sha256
                (base32
                 "11zcw0sll6qg6ha0rr6n1cw5v73azvf7ycwn9lgiwa5cj7rrqjf4"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("plugin" "share/vim/vimfiles/")
-         ("doc/" "share/vim/vimfiles/doc" #:include ("asyncrun.txt")))))
+    (build-system vim-build-system)
     (home-page "https://github.com/skywind3000/asyncrun.vim")
     (synopsis "Run Async Shell Commands in Vim")
     (description "This plugin takes the advantage of new APIs in Vim 8 (and
@@ -987,12 +896,7 @@ (define-public vim-dispatch
         (sha256
          (base32
           "1m8b5mn2zqlphzs6xfwykwmghf6p0wabrhpjmh7vav35jgcxc4wl"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-dispatch")
     (synopsis "Asynchronous build and test dispatcher")
     (description "Leverage the power of Vim's compiler plugins without being
@@ -1017,11 +921,7 @@ (define-public vim-gemini-vim
           (file-name (git-file-name name version))
           (sha256
            (base32 "05ffhhfahjqwxyrqmsinsahrs15wknzl2qbj8mznyv319mn2civ2"))))
-      (build-system copy-build-system)
-      (arguments
-       `(#:install-plan
-         '(("ftdetect" "share/vim/vimfiles/")
-           ("syntax" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://git.sr.ht/~torresjrjr/gemini.vim")
       (synopsis "Vim syntax highlighting plugin for Gemini")
       (description "This Vim plugin provides a Vim syntax highlighting plugin
@@ -1045,11 +945,7 @@ (define-public vim-eunuch
           (sha256
            (base32
             "1xadb22kd40swmww0qxmmkcpcq6viy8l167pjck5q32hfngll5d3"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://github.com/tpope/vim-eunuch")
       (synopsis "Vim sugar for the UNIX shell commands")
       (description "Vim sugar for the UNIX shell commands that need it the most.
@@ -1073,13 +969,7 @@ (define-public vim-slime
           (file-name (git-file-name name version))
           (sha256
            (base32 "0k4b629jn6xlxyjxdl3cgm06v9dmx967rqnslv5m82c9kscwpyh4"))))
-      (build-system copy-build-system)
-      (arguments
-       `(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("ftplugin" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://technotales.wordpress.com/2007/10/03/like-slime-for-vim/")
       (synopsis "Vim plugin to give you some slime")
       (description "SLIME is an Emacs plugin to turn Emacs into a Lisp IDE.  You
@@ -1105,11 +995,7 @@ (define-public vim-paredit
           (file-name (git-file-name name version))
           (sha256
            (base32 "07d5s20r0ssd7rir45vy0fqlci44gha1a81rcilgar227f3nw328"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://github.com/kovisoft/paredit")
       (synopsis "Vim plugin for structured editing of Lisp S-expressions")
       (description
@@ -1131,11 +1017,7 @@ (define-public vim-surround
        (file-name (git-file-name name version))
        (sha256
         (base32 "1b0bd5m5lv1p4d299mrwjfs2gk0zqwyaqdaid9hs9yqlxnr8s5nf"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-surround")
     (synopsis "Vim plugin for easy quoting and parenthesizing")
     (description
@@ -1156,12 +1038,7 @@ (define-public vim-gnupg
                            "/vim-gnupg-v" version ".tar.gz"))
        (sha256
         (base32 "02w8lgyyh7wgxysvmmcf9ja5c06vrbyh3alzvv97x8cfhrp0skn7"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://www.vim.org/scripts/script.php?script_id=3645")
     (synopsis "Vim plugin for transparent editing of gpg encrypted files")
     (description
@@ -1187,12 +1064,7 @@ (define-public vim-ctrlp
        (file-name (git-file-name name version))
        (sha256
         (base32 "0n68hg59h4rjn0ziqbsh5pr03l3kr98zk54659ny6vq107af1w96"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://ctrlpvim.github.io/ctrlp.vim/")
     (synopsis "Fuzzy file, buffer, mru, tag, etc. finder for Vim")
     (description
@@ -1224,12 +1096,7 @@ (define-public vim-mucomplete
        (file-name (git-file-name name version))
        (sha256
         (base32 "054g80n09mmxxlh8xaic29bn8bgn3clvv732rymljdyvbj1mlhwd"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/lifepillar/vim-mucomplete")
     (synopsis "MUcomplete is a minimalist autocompletion plugin for Vim")
     (description
@@ -1253,12 +1120,7 @@ (define-public vim-gitgutter
          (file-name (git-file-name name version))
          (sha256
           (base32 "0zpa7cs59a8sq0k3frlf9flpf30jcn239yrpmv40r7nqvxzglbpl"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Vim plugin which shows a git diff in the sign column")
       (description
        "A Vim plugin which shows a git diff in the sign column.  It shows which
@@ -1282,12 +1144,7 @@ (define-public vim-characterize
        (file-name (git-file-name name version))
        (sha256
         (base32 "0ppsbsd696ih40d9f76mdl9sd9y7p2pvm65qmvq4b2zhkv4xbpxz"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-characterize")
     (synopsis "Vim plugin for showing Unicode character metadata")
     (description
@@ -1316,14 +1173,9 @@ (define-public vim-tagbar
        (file-name (git-file-name name version))
        (sha256
         (base32 "1fqfs8msmr6d4kpvxqp14sdjvp5fj52q5w5kz71myzcd4kqzmirp"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'link-universal-ctags
            (lambda* (#:key inputs #:allow-other-keys)
@@ -1357,15 +1209,7 @@ (define-public vim-nerdtree
        (file-name (git-file-name name version))
        (sha256
         (base32 "1si8qla86ng8cffbmfrk9gss0i3912yw0f1ph4bsiq0kk837lccp"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("lib" "share/vim/vimfiles/")
-         ("nerdtree_plugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/preservim/nerdtree")
     (synopsis "Tree explorer plugin for Vim")
     (description
@@ -1387,13 +1231,7 @@ (define-public vim-nerdcommenter
        (file-name (git-file-name name version))
        (sha256
         (base32 "1ka2rqn7rby55aps3iblh1dcqxm7m7qx72mpkz6y2aaj8mkj0zyd"))))
-    (build-system copy-build-system)
-    (arguments
-     (list
-      #:install-plan
-      #~`(("autoload" "share/vim/vimfiles/")
-          ("doc" "share/vim/vimfiles/")
-          ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/preservim/nerdcommenter")
     (synopsis "Vim plugin for easy commenting of code")
     (description
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output
  2022-12-13  8:34 ` [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
@ 2022-12-13 19:05   ` ( via Guix-patches via
  0 siblings, 0 replies; 19+ messages in thread
From: ( via Guix-patches via @ 2022-12-13 19:05 UTC (permalink / raw)
  To: Jonathan Scoresby, 60029

[-- Attachment #1: Type: text/plain, Size: 81 bytes --]

Heya,

Wow, this is really nice work! :D

The first patch LGTM.

    -- (

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path'
  2022-12-13  8:34 ` [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
@ 2022-12-13 19:06   ` ( via Guix-patches via
  2022-12-13 22:10     ` Jonathan Scoresby
  0 siblings, 1 reply; 19+ messages in thread
From: ( via Guix-patches via @ 2022-12-13 19:06 UTC (permalink / raw)
  To: Jonathan Scoresby, 60029

[-- Attachment #1: Type: text/plain, Size: 99 bytes --]

Could you please add a note to the second commit explaining why exactly
it's needed?

    -- (

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path'
  2022-12-13 19:06   ` ( via Guix-patches via
@ 2022-12-13 22:10     ` Jonathan Scoresby
  2022-12-14  6:56       ` ( via Guix-patches via
  0 siblings, 1 reply; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-13 22:10 UTC (permalink / raw)
  To: (, 60029


> On 12/13/2022 12:06 MST ( <paren@disroot.org> wrote:
> 
> > Wow, this is really nice work! :D

Thanks!

> Could you please add a note to the second commit explaining why exactly
> it's needed?

Sorry, do you mean to the commit message or to the file itself? 

Thank you for the review.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path'
  2022-12-13 22:10     ` Jonathan Scoresby
@ 2022-12-14  6:56       ` ( via Guix-patches via
  0 siblings, 0 replies; 19+ messages in thread
From: ( via Guix-patches via @ 2022-12-14  6:56 UTC (permalink / raw)
  To: Jonathan Scoresby, 60029

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

On Tue Dec 13, 2022 at 10:10 PM GMT, Jonathan Scoresby wrote:
> Sorry, do you mean to the commit message or to the file itself? 

To the commit message, please.

    -- (

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output
  2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
                   ` (3 preceding siblings ...)
  2022-12-13  8:34 ` [bug#60029] [PATCH 4/4] gnu: have vim packages use vim-build-system Jonathan Scoresby
@ 2022-12-14 21:01 ` Jonathan Scoresby
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
                     ` (2 more replies)
  2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
  5 siblings, 3 replies; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-14 21:01 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 guix/build/copy-build-system.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/guix/build/copy-build-system.scm b/guix/build/copy-build-system.scm
index fb2d1db056..5d2a137268 100644
--- a/guix/build/copy-build-system.scm
+++ b/guix/build/copy-build-system.scm
@@ -133,8 +133,16 @@ (define* (install #:key install-plan outputs #:allow-other-keys)
                                       (string-append target "/")))
              file-list))))
 
-  (define* (install source target #:key include exclude include-regexp exclude-regexp)
-    (let ((final-target (string-append (assoc-ref outputs "out") "/" target))
+  (define* (install source
+                    target
+                    #:key include
+                    exclude
+                    include-regexp
+                    exclude-regexp
+                    output)
+    (let ((final-target (string-append (assoc-ref outputs
+                                                  (or output "out")) "/"
+                                       target))
           (filters? (or include exclude include-regexp exclude-regexp)))
       (when (and (not (file-is-directory? source))
                  filters?)

base-commit: 6454208222d6e7760daa964b590f35ea75ffe0e5
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path'
  2022-12-14 21:01 ` [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
@ 2022-12-14 21:02   ` Jonathan Scoresby
  2022-12-14 21:14     ` ( via Guix-patches via
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 3/4] guix: add vim-build-system Jonathan Scoresby
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 4/4] gnu: have vim packages use vim-build-system Jonathan Scoresby
  2 siblings, 1 reply; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-14 21:02 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

    This is neccesary because vim's built-in plugin manager looks for directories
    under 'package-path' instead of 'runtime-path.' Once we have told vim the
    package-path, it adds all the packages to the runtime-path automatically for us.
---
 gnu/packages/aux-files/guix.vim | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..7e7f8d653a 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,13 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
+" This apends all applicable vim paths to the end of packagepath
 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], ',')
+        let &pp = join([&pp,vimplugins], ',')
     endif
 endfor
-" Unconditionally add */after directories last, as intended by upstream
-" TODO: Remove duplicate */after directories
-for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
-    let vimplugins = directory . "/after"
-    let &rtp = join([&rtp,vimplugins], ',')
-endfor
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v2 3/4] guix: add vim-build-system
  2022-12-14 21:01 ` [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
@ 2022-12-14 21:02   ` Jonathan Scoresby
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 4/4] gnu: have vim packages use vim-build-system Jonathan Scoresby
  2 siblings, 0 replies; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-14 21:02 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 guix/build-system/vim.scm       | 160 ++++++++++++++++++++++++++++++++
 guix/build/vim-build-system.scm | 137 +++++++++++++++++++++++++++
 2 files changed, 297 insertions(+)
 create mode 100644 guix/build-system/vim.scm
 create mode 100644 guix/build/vim-build-system.scm

diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm
new file mode 100644
index 0000000000..4b74c24e10
--- /dev/null
+++ b/guix/build-system/vim.scm
@@ -0,0 +1,160 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system vim)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix gexp)
+  #:use-module (guix monads)
+  #:use-module (guix packages)
+  #:use-module (guix search-paths)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:export (%vim-build-system-modules vim-build vim-build-system))
+
+;; Commentary:
+;;
+;; Standard package installer for vim and neovim plugins.
+;; This is implemented as an extension of `copy-build-system'
+;; and takes advantage of vim and neovim's built-in package manager.
+;; It extends the installation procedure from the copy-build-system
+;; to put files in the correct place and then generates help tags.
+;;
+;; Code:
+
+(define %vim-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build vim-build-system)
+    ,@%copy-build-system-modules))
+
+(define (default-vim)
+  "Return the default Vim package."
+  ;; Lazily resolve the binding to avoid a circular dependency.
+  (let ((vim (resolve-interface '(gnu packages vim))))
+    (module-ref vim
+                'vim)))
+
+(define (default-neovim)
+  "Return the default Neovim package."
+  (let ((vim (resolve-interface '(gnu packages vim))))
+    (module-ref vim
+                'neovim)))
+
+(define* (lower name
+                #:key source
+                inputs
+                native-inputs
+                outputs
+                system
+                target
+                (vim? #f)
+                (neovim? #f)
+                (vim (default-vim))
+                (neovim (default-neovim))
+                #:allow-other-keys #:rest arguments)
+  "Return a bag for NAME."
+  (let* ((private-keywords '(#:target #:vim #:neovim #:inputs #:native-inputs))
+         (vim? (or (= 0
+                      (string-contains name "vim")) vim?))
+         (neovim? (or (not (not (or (string-contains name "neovim")
+                                    (member "neovim" outputs)))) neovim?))
+         (vim-inputs (append (if vim?
+                                 `(("vim" ,vim))
+                                 '())
+                             (if neovim?
+                                 `(("neovim" ,neovim))
+                                 '())))
+         (vim-arguments (append arguments
+                                `(#:vim? ,vim?
+                                  #:neovim? ,neovim?))))
+    (bag (name name)
+         (system system)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '()) ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'.
+                        ,@(standard-packages)))
+         (build-inputs `(,@vim-inputs ,@native-inputs))
+         (outputs outputs)
+         (build vim-build)
+         (arguments (strip-keyword-arguments private-keywords vim-arguments)))))
+
+(define* (vim-build name
+                    inputs
+                    #:key guile
+                    source
+                    (vim? #f)
+                    (neovim? #f)
+                    (mode "start")
+                    (install-plan ''())
+                    (phases '(@ (guix build vim-build-system) %standard-phases))
+                    (outputs '("out"))
+                    (search-paths '())
+                    (system (%current-system))
+                    (imported-modules %vim-build-system-modules)
+                    (modules '((guix build vim-build-system)
+                               (guix build utils))))
+
+  (define build
+    (with-imported-modules imported-modules
+                           #~(begin
+                               (use-modules #$@modules)
+                               #$(with-build-variables inputs outputs
+                                                       #~(vim-build #:name #$name
+                                                          #:vim? #$vim?
+                                                          #:neovim? #$neovim?
+                                                          #:mode #$mode
+                                                          #:install-plan #$(if
+                                                                            (pair?
+                                                                             install-plan)
+                                                                            (sexp->gexp
+                                                                             install-plan)
+                                                                            install-plan)
+                                                          #:source #+source
+                                                          #:system #$system
+                                                          #:phases #$(if (pair?
+                                                                          phases)
+                                                                      (sexp->gexp
+                                                                       phases)
+                                                                      phases)
+                                                          #:outputs %outputs
+                                                          #:search-paths '#$(sexp->gexp
+                                                                             (map
+                                                                              search-path-specification->sexp
+                                                                              search-paths))
+                                                          #:inputs
+                                                          %build-inputs)))))
+
+  (mlet %store-monad
+        ((guile (package->derivation (or guile
+                                         (default-guile)) system
+                                     #:graft? #f)))
+        (gexp->derivation name
+                          build
+                          #:system system
+                          #:target #f
+                          #:guile-for-build guile)))
+
+(define vim-build-system
+  (build-system (name 'vim)
+                (description "The standard Vim build system")
+                (lower lower)))
+
+;;; vim.scm ends here
diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-system.scm
new file mode 100644
index 0000000000..38d82c416b
--- /dev/null
+++ b/guix/build/vim-build-system.scm
@@ -0,0 +1,137 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build vim-build-system)
+  #:use-module ((guix build copy-build-system)
+                #:prefix copy:)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 ftw)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases vim-build))
+
+;; Commentary:
+;;
+;; System for installing vim and neovim plugins. It downloads
+;; the source and copies the appropriate files to vim and nvim
+;; packpaths. It then generates helptags.
+;;
+;; Code:
+
+(define copy:install
+  (assoc-ref copy:%standard-phases
+             'install))
+
+(define vim-path
+  "/share/vim/vimfiles/pack/guix/")
+(define nvim-path
+  "/share/nvim/site/pack/guix/")
+
+(define* (install #:key name
+                  install-plan
+                  neovim?
+                  vim?
+                  mode
+                  outputs
+                  #:allow-other-keys)
+
+  (let* ((include-regexp '(".*\\/.*\\/.*"))
+         (exclude-regexp '("scripts/.*" "tests?/.*" ".*\\/\\..*"))
+         (vim-install (if vim?
+                          `(("." ,(string-append vim-path mode "/" name "/")
+                             #:include-regexp ,include-regexp
+                             #:exclude-regexp ,exclude-regexp))
+                          '()))
+         (neovim-outputs (if vim?
+                             `(("." ,(string-append nvim-path mode "/" name
+                                                    "/")
+                                #:include-regexp ,include-regexp
+                                #:exclude-regexp ,exclude-regexp
+                                #:output "neovim"))
+                             `(("." ,(string-append nvim-path mode "/" name
+                                                    "/")
+                                #:include-regexp ,include-regexp
+                                #:exclude-regexp ,exclude-regexp))))
+         (neovim-install (if neovim? neovim-outputs
+                             '())))
+    (copy:install #:outputs outputs
+                  #:install-plan (append vim-install neovim-install
+                                         install-plan))))
+
+(define* (generate-helptags #:key name
+                            neovim?
+                            vim?
+                            mode
+                            outputs
+                            #:allow-other-keys)
+
+  (define (vim-generate output)
+    (invoke "vim" "--clean" "-en" "--cmd"
+            (string-append "helptags "
+                           output
+                           vim-path
+                           mode
+                           "/"
+                           name
+                           "/doc | q")))
+
+  (define (neovim-generate output)
+    (invoke "nvim"
+            "--clean"
+            "--headless"
+            "-en"
+            "--cmd"
+            (string-append "helptags "
+                           output
+                           nvim-path
+                           mode
+                           "/"
+                           name
+                           "/doc | q")))
+
+  (when (scandir "./doc")
+    (let ((out (assoc-ref outputs "out"))
+          (neovim (assoc-ref outputs "neovim")))
+      (if vim?
+          (begin
+            (vim-generate out)
+            (if neovim?
+                (neovim-generate neovim)))
+          (neovim-generate out)))))
+
+(define %standard-phases
+  ;; Everything is as with the Copy Build System except for
+  ;; the addition of the generate-helptags phase and a few
+  ;; custom actions are added to the install phase
+  (modify-phases copy:%standard-phases
+    (replace 'install
+      install)
+    (add-after 'install 'generate-helptags
+      generate-helptags)))
+
+(define* (vim-build #:key inputs
+                    (phases %standard-phases)
+                    #:allow-other-keys #:rest args)
+  "Build the given package, applying all of PHASES in order."
+  (apply copy:copy-build
+         #:inputs inputs
+         #:phases phases
+         args))
+
+;;; vim-build-system.scm ends here
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v2 4/4] gnu: have vim packages use vim-build-system
  2022-12-14 21:01 ` [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 3/4] guix: add vim-build-system Jonathan Scoresby
@ 2022-12-14 21:02   ` Jonathan Scoresby
  2 siblings, 0 replies; 19+ messages in thread
From: Jonathan Scoresby @ 2022-12-14 21:02 UTC (permalink / raw)
  To: 60029; +Cc: Jonathan Scoresby

---
 gnu/packages/vim.scm | 234 +++++++------------------------------------
 1 file changed, 36 insertions(+), 198 deletions(-)

diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index a6250f71de..738883d20b 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages vim)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
+  #:use-module (guix build-system vim)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
@@ -288,12 +289,7 @@ (define-public vim-neocomplete
        (sha256
         (base32
          "1h6sci5mhdfg6sjsjpi8l5li02hg858zcayiwl60y9j2gqnd18lv"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (synopsis "Next generation completion framework for Vim")
     (description
      "@code{neocomplete}, an abbreviation of 'neo-completion with cache',
@@ -321,10 +317,7 @@ (define-public vim-neosnippet-snippets
          (sha256
           (base32
            "151wpvbj6jb9jdkbhj3b77f5sq7y328spvwfbqyj1y32rg4ifmc6"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("neosnippets" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
     (synopsis "Snippets for neosnippet")
     (description
      "@code{neosnippet-snippets} provides standard snippets for the Vim plugin
@@ -350,17 +343,7 @@ (define-public vim-neosnippet
        (sha256
         (base32
          "0k80syscmpnj38ks1fq02ds59g0r4jlg9ll7z4qc048mgi35alw5"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("indent" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("rplugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (synopsis "Snippet support for Vim")
     (description
      "@code{neosnippet}, is a plugin for Vim which adds snippet support to Vim.
@@ -389,12 +372,7 @@ (define-public vim-scheme
          (sha256
           (base32
            "04h946vr4f8wxap3wzqs69y2v8n50g2zbk22jsg2kxr4c01z5cbw"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("ftplugin" "share/vim/vimfiles/")
-           ("indent" "share/vim/vimfiles/")
-           ("syntax" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Scheme syntax for Vim")
       (description
        "@code{vim-scheme} provides Scheme support for Vim (R7RS and CHICKEN).")
@@ -417,10 +395,7 @@ (define-public vim-luna
          (sha256
           (base32
            "0ka3qbhsh8lix1vyj4678j7dnchkd8khhirrnn3aylxxf8fpqyg8"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("colors" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Dark color theme for Vim")
       (description
        "@code{vim-luna} is a dark color theme for Vim.")
@@ -444,11 +419,7 @@ (define-public vim-context-filetype
          (sha256
           (base32
            "0alvrfhmd91zkd9h83s8wvgyq4iakcf6rybsyjd369qbgpcqky89"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("autoload" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Context filetype library for Vim")
       (description
        "@code{vim-context-filetype} is context filetype library for Vim script.")
@@ -468,15 +439,7 @@ (define-public vim-fugitive
         (file-name (git-file-name name version))
         (sha256
          (base32 "138290g2aph1jjhaza6biky5qi4ka6435s01bwxivllgb53g3irc"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-fugitive")
     (synopsis "Vim plugin to work with Git")
     (description "Vim-fugitive is a wrapper for Vim that complements the
@@ -498,12 +461,7 @@ (define-public vim-airline
        (sha256
         (base32
          "1aksmr73648pvyc75pfdz28k2d4ky52rn7xiwcv7lz87q3vqld7k"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (synopsis "Statusline for Vim")
     (description
      "@code{vim-airline} is an extensible statusline for Vim.
@@ -529,12 +487,7 @@ (define-public vim-airline-themes
          (sha256
           (base32
            "1sb7nb7j7bz0pv1c9bgdy0smhr0jk2b1vbdv9yzghg5lrknpsbr6"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Collection of themes for Vim-airline")
       (description
        "@code{vim-airline-themes} is a collection of themes for @code{vim-airline}.")
@@ -554,13 +507,8 @@ (define-public vim-syntastic
        (file-name (git-file-name name version))
        (sha256
         (base32 "0j91f72jaz1s6aw1hpjiz30vk2ds2aqd9gisk91grsldy6nz6hhz"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax_checkers" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
+    (outputs (list "out" "neovim"))
     (synopsis "Syntax checking plugin for Vim")
     (description
      "Vim-syntastic is a syntax checking plugin for Vim.  It runs files through
@@ -587,9 +535,8 @@ (define-public vim-solarized
           (base32 "0001mz5v3a8zvi3gzmxhi3yrsb6hs7qf6i497arsngnvj2cwn61d"))))
       (build-system copy-build-system)
       (arguments
-       '(#:install-plan
-         '(("vim-colors-solarized/colors" "share/vim/vimfiles/")
-           ("vim-colors-solarized/doc" "share/vim/vimfiles/"))))
+        '(#:install-plan '(("vim-colors-solarized"
+			    "share/vim/vimfiles/pack/guix/start/"))))
       (home-page "https://github.com/altercation/vim-colors-solarized")
       (synopsis "Solarized color scheme for Vim")
       (description
@@ -621,12 +568,8 @@ (define-public editorconfig-vim
         (sha256
          (base32
           "0mp80bi2m56bb93szw87vy6q5s85yk9g91sl4pr51316rgdv5kkv"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
+    (arguments (list #:vim? #t))
     (home-page "https://editorconfig.org/")
     (synopsis "EditorConfig plugin for Vim")
     (description "EditorConfig makes it easy to maintain the correct coding
@@ -651,11 +594,7 @@ (define-public neovim-packer
                 (sha256
                  (base32
                   "1xn08z3a21mgfvp5i1nv57jnldwxwnl5nkryiff3zc99b1mizigp"))))
-      (build-system copy-build-system)
-      (arguments
-       (list #:install-plan
-             #~'(("lua" "share/nvim/site/pack/guix/start/packer.nvim/")
-                 ("doc" "share/nvim/site/pack/guix/start/packer.nvim/"))))
+      (build-system vim-build-system)
       (home-page "https://github.com/wbthomason/packer.nvim")
       (synopsis "Plugin manager for Neovim")
       (description
@@ -664,23 +603,6 @@ (define-public neovim-packer
 is based on Vim's builtin plugin support.")
       (license license:expat))))
 
-(define-public neovim-syntastic
-  (package
-    (inherit vim-syntastic)
-    (name "neovim-syntastic")
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/nvim/site/")
-         ("doc" "share/nvim/site/")
-         ("plugin" "share/nvim/site/")
-         ("syntax_checkers" "share/nvim/site/"))))
-    (synopsis "Syntax checking plugin for Neovim")
-    (description
-     "Vim-syntastic is a syntax checking plugin for Neovim.  It runs files through
-external syntax checkers and displays any resulting errors to the user.  This
-can be done on demand, or automatically as files are saved.  If syntax errors
-are detected, the user is notified.")))
-
 (define-public neovim
   (package
     (name "neovim")
@@ -854,7 +776,8 @@ (define-public vifm
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (vifm (string-append out "/share/vifm"))
-                     (vimfiles (string-append out "/share/vim/vimfiles")))
+                     (vimfiles (string-append out 
+				"/share/vim/vimfiles/pack/guix/start/vifm")))
                 (copy-recursively (string-append vifm "/colors")
                                   (string-append vimfiles "/colors"))
                 (copy-recursively (string-append vifm "/vim")
@@ -932,17 +855,7 @@ (define-public vim-guix-vim
               (sha256
                (base32
                 "080ni4z23qdr8rkrswjqfqfrrcnpn7qdgrg14glwji46wzvwxqyx"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("compiler" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("indent" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://gitlab.com/Efraim/guix.vim")
     (synopsis "Guix integration in Vim")
     (description "This package provides support for GNU Guix in Vim.")
@@ -961,11 +874,7 @@ (define-public vim-asyncrun
               (sha256
                (base32
                 "11zcw0sll6qg6ha0rr6n1cw5v73azvf7ycwn9lgiwa5cj7rrqjf4"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("plugin" "share/vim/vimfiles/")
-         ("doc/" "share/vim/vimfiles/doc" #:include ("asyncrun.txt")))))
+    (build-system vim-build-system)
     (home-page "https://github.com/skywind3000/asyncrun.vim")
     (synopsis "Run Async Shell Commands in Vim")
     (description "This plugin takes the advantage of new APIs in Vim 8 (and
@@ -987,12 +896,7 @@ (define-public vim-dispatch
         (sha256
          (base32
           "1m8b5mn2zqlphzs6xfwykwmghf6p0wabrhpjmh7vav35jgcxc4wl"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-dispatch")
     (synopsis "Asynchronous build and test dispatcher")
     (description "Leverage the power of Vim's compiler plugins without being
@@ -1017,11 +921,7 @@ (define-public vim-gemini-vim
           (file-name (git-file-name name version))
           (sha256
            (base32 "05ffhhfahjqwxyrqmsinsahrs15wknzl2qbj8mznyv319mn2civ2"))))
-      (build-system copy-build-system)
-      (arguments
-       `(#:install-plan
-         '(("ftdetect" "share/vim/vimfiles/")
-           ("syntax" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://git.sr.ht/~torresjrjr/gemini.vim")
       (synopsis "Vim syntax highlighting plugin for Gemini")
       (description "This Vim plugin provides a Vim syntax highlighting plugin
@@ -1045,11 +945,7 @@ (define-public vim-eunuch
           (sha256
            (base32
             "1xadb22kd40swmww0qxmmkcpcq6viy8l167pjck5q32hfngll5d3"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://github.com/tpope/vim-eunuch")
       (synopsis "Vim sugar for the UNIX shell commands")
       (description "Vim sugar for the UNIX shell commands that need it the most.
@@ -1073,13 +969,7 @@ (define-public vim-slime
           (file-name (git-file-name name version))
           (sha256
            (base32 "0k4b629jn6xlxyjxdl3cgm06v9dmx967rqnslv5m82c9kscwpyh4"))))
-      (build-system copy-build-system)
-      (arguments
-       `(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("ftplugin" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://technotales.wordpress.com/2007/10/03/like-slime-for-vim/")
       (synopsis "Vim plugin to give you some slime")
       (description "SLIME is an Emacs plugin to turn Emacs into a Lisp IDE.  You
@@ -1105,11 +995,7 @@ (define-public vim-paredit
           (file-name (git-file-name name version))
           (sha256
            (base32 "07d5s20r0ssd7rir45vy0fqlci44gha1a81rcilgar227f3nw328"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (home-page "https://github.com/kovisoft/paredit")
       (synopsis "Vim plugin for structured editing of Lisp S-expressions")
       (description
@@ -1131,11 +1017,7 @@ (define-public vim-surround
        (file-name (git-file-name name version))
        (sha256
         (base32 "1b0bd5m5lv1p4d299mrwjfs2gk0zqwyaqdaid9hs9yqlxnr8s5nf"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-surround")
     (synopsis "Vim plugin for easy quoting and parenthesizing")
     (description
@@ -1156,12 +1038,7 @@ (define-public vim-gnupg
                            "/vim-gnupg-v" version ".tar.gz"))
        (sha256
         (base32 "02w8lgyyh7wgxysvmmcf9ja5c06vrbyh3alzvv97x8cfhrp0skn7"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://www.vim.org/scripts/script.php?script_id=3645")
     (synopsis "Vim plugin for transparent editing of gpg encrypted files")
     (description
@@ -1187,12 +1064,7 @@ (define-public vim-ctrlp
        (file-name (git-file-name name version))
        (sha256
         (base32 "0n68hg59h4rjn0ziqbsh5pr03l3kr98zk54659ny6vq107af1w96"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://ctrlpvim.github.io/ctrlp.vim/")
     (synopsis "Fuzzy file, buffer, mru, tag, etc. finder for Vim")
     (description
@@ -1224,12 +1096,7 @@ (define-public vim-mucomplete
        (file-name (git-file-name name version))
        (sha256
         (base32 "054g80n09mmxxlh8xaic29bn8bgn3clvv732rymljdyvbj1mlhwd"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/lifepillar/vim-mucomplete")
     (synopsis "MUcomplete is a minimalist autocompletion plugin for Vim")
     (description
@@ -1253,12 +1120,7 @@ (define-public vim-gitgutter
          (file-name (git-file-name name version))
          (sha256
           (base32 "0zpa7cs59a8sq0k3frlf9flpf30jcn239yrpmv40r7nqvxzglbpl"))))
-      (build-system copy-build-system)
-      (arguments
-       '(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+      (build-system vim-build-system)
       (synopsis "Vim plugin which shows a git diff in the sign column")
       (description
        "A Vim plugin which shows a git diff in the sign column.  It shows which
@@ -1282,12 +1144,7 @@ (define-public vim-characterize
        (file-name (git-file-name name version))
        (sha256
         (base32 "0ppsbsd696ih40d9f76mdl9sd9y7p2pvm65qmvq4b2zhkv4xbpxz"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/tpope/vim-characterize")
     (synopsis "Vim plugin for showing Unicode character metadata")
     (description
@@ -1316,14 +1173,9 @@ (define-public vim-tagbar
        (file-name (git-file-name name version))
        (sha256
         (base32 "1fqfs8msmr6d4kpvxqp14sdjvp5fj52q5w5kz71myzcd4kqzmirp"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'link-universal-ctags
            (lambda* (#:key inputs #:allow-other-keys)
@@ -1357,15 +1209,7 @@ (define-public vim-nerdtree
        (file-name (git-file-name name version))
        (sha256
         (base32 "1si8qla86ng8cffbmfrk9gss0i3912yw0f1ph4bsiq0kk837lccp"))))
-    (build-system copy-build-system)
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("lib" "share/vim/vimfiles/")
-         ("nerdtree_plugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/preservim/nerdtree")
     (synopsis "Tree explorer plugin for Vim")
     (description
@@ -1387,13 +1231,7 @@ (define-public vim-nerdcommenter
        (file-name (git-file-name name version))
        (sha256
         (base32 "1ka2rqn7rby55aps3iblh1dcqxm7m7qx72mpkz6y2aaj8mkj0zyd"))))
-    (build-system copy-build-system)
-    (arguments
-     (list
-      #:install-plan
-      #~`(("autoload" "share/vim/vimfiles/")
-          ("doc" "share/vim/vimfiles/")
-          ("plugin" "share/vim/vimfiles/"))))
+    (build-system vim-build-system)
     (home-page "https://github.com/preservim/nerdcommenter")
     (synopsis "Vim plugin for easy commenting of code")
     (description
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path'
  2022-12-14 21:02   ` [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
@ 2022-12-14 21:14     ` ( via Guix-patches via
  0 siblings, 0 replies; 19+ messages in thread
From: ( via Guix-patches via @ 2022-12-14 21:14 UTC (permalink / raw)
  To: Jonathan Scoresby, 60029

[-- Attachment #1: Type: text/plain, Size: 61 bytes --]

LGTM now, I guess.  I haven't tested it though.

    -- (

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v3 0/3] Add vim-build-system.
  2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
                   ` (4 preceding siblings ...)
  2022-12-14 21:01 ` [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
@ 2023-10-16  9:15 ` Efraim Flashner
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 1/3] gnu: vim: Add vim packages to 'package-path' instead of 'runtime-path' Efraim Flashner
                     ` (3 more replies)
  5 siblings, 4 replies; 19+ messages in thread
From: Efraim Flashner @ 2023-10-16  9:15 UTC (permalink / raw)
  To: 60029
  Cc: paren, me, Efraim Flashner, Efraim Flashner,
	Guillaume Le Vaillant, Katherine Cox-Buday, Munyoki Kilyungi,
	jgart

I dropped the first commit, adding the option of other outputs to the
copy-build-system, in the interest of getting this merged sooner.

On the first patch I fix some typos and added to the comment at the top
of the file.

On the second patch I added the entries to Makefile.am and added the
missing documentation. I added the plugin-name field (I want to run
:packadd fugitive, not :packadd vim-fugitive-3.7), moved the neovim
output into the main output, added to the exclude-regexp, and some
general code cleanup.

On the third patch I adjusted the plugin paths of some more files in
packages which came with vim plugins. I reworked vim-vlime to have the
installed packpath resemble the upstream repository, which is supposed
to work as-is.

I noticed that I need to fix vim-asyncrun, it still has the install-plan
from before. I'm unsure about setting packages like vim-rainbow to use
'opt' for mode since that seems to be upstream's default, but would be
surprising. I tried my best to come up with expected plugin-names for
all the packages.

Jonathan Scoresby (3):
  gnu: vim: Add vim packages to 'package-path' instead of
    'runtime-path'.
  build-system: Add vim-build-system.
  gnu: Have vim packages use vim-build-system.

 Makefile.am                     |   4 +-
 doc/guix.texi                   |  33 ++++
 gnu/packages/aux-files/guix.vim |  11 +-
 gnu/packages/code.scm           |   5 +-
 gnu/packages/lisp.scm           |   5 +-
 gnu/packages/mail.scm           |   3 +-
 gnu/packages/rust-apps.scm      |   3 +-
 gnu/packages/vim.scm            | 306 ++++++++++++--------------------
 gnu/packages/wm.scm             |   3 +-
 guix/build-system/vim.scm       | 157 ++++++++++++++++
 guix/build/vim-build-system.scm | 117 ++++++++++++
 11 files changed, 437 insertions(+), 210 deletions(-)
 create mode 100644 guix/build-system/vim.scm
 create mode 100644 guix/build/vim-build-system.scm


base-commit: a0d2ecde943bd1854ddbb7c0cad35a1fc64dc5ab
-- 
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





^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v3 1/3] gnu: vim: Add vim packages to 'package-path' instead of 'runtime-path'.
  2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
@ 2023-10-16  9:15   ` Efraim Flashner
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 2/3] build-system: Add vim-build-system Efraim Flashner
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 19+ messages in thread
From: Efraim Flashner @ 2023-10-16  9:15 UTC (permalink / raw)
  To: 60029; +Cc: paren, me, Efraim Flashner

From: Jonathan Scoresby <me@jonscoresby.com>

    This is neccesary because vim's built-in plugin manager looks for directories
    under 'package-path' instead of 'runtime-path.' Once we have told vim the
    package-path, it adds all the packages to the runtime-path automatically for us.

* gnu/packages/aux-files/guix.vim: Add paths to packagepath instead of
runtimepath.  Remove code to adjust runtimepath after adding paths.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
---
 gnu/packages/aux-files/guix.vim | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..24a6b941a8 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,13 +1,8 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
+" This appends all applicable vim paths to the end of packagepath.  Once we
+" have told vim the packagepath vim will add it to the runtimepath for us.
 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], ',')
+        let &pp = join([&pp,vimplugins], ',')
     endif
 endfor
-" Unconditionally add */after directories last, as intended by upstream
-" TODO: Remove duplicate */after directories
-for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
-    let vimplugins = directory . "/after"
-    let &rtp = join([&rtp,vimplugins], ',')
-endfor
-- 
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





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v3 2/3] build-system: Add vim-build-system.
  2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 1/3] gnu: vim: Add vim packages to 'package-path' instead of 'runtime-path' Efraim Flashner
@ 2023-10-16  9:15   ` Efraim Flashner
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 3/3] gnu: Have vim packages use vim-build-system Efraim Flashner
  2023-11-08 10:16   ` bug#60029: [PATCH v3 0/3] Add vim-build-system Efraim Flashner
  3 siblings, 0 replies; 19+ messages in thread
From: Efraim Flashner @ 2023-10-16  9:15 UTC (permalink / raw)
  To: 60029; +Cc: paren, me, Efraim Flashner

From: Jonathan Scoresby <me@jonscoresby.com>

* guix/build-system/vim.scm,
* guix/build/vim-build-system.scm: New modules.
* Makefile.am (MODULES): Register new files.
* doc/guix.texi: Document it.

Co-authored-by: Efraim Flashner <efraim@flashner.co.il>
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
---
 Makefile.am                     |   4 +-
 doc/guix.texi                   |  33 +++++++
 guix/build-system/vim.scm       | 157 ++++++++++++++++++++++++++++++++
 guix/build/vim-build-system.scm | 117 ++++++++++++++++++++++++
 4 files changed, 310 insertions(+), 1 deletion(-)
 create mode 100644 guix/build-system/vim.scm
 create mode 100644 guix/build/vim-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index 310a231259..9fd77c6f43 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,7 @@
 # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 # Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
 # Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
-# Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
+# Copyright © 2019, 2023 Efraim Flashner <efraim@flashner.co.il>
 # Copyright © 2020, 2021, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 # Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
 # Copyright © 2021 Andrew Tropin <andrew@trop.in>
@@ -184,6 +184,7 @@ MODULES =					\
   guix/build-system/texlive.scm			\
   guix/build-system/tree-sitter.scm		\
   guix/build-system/trivial.scm			\
+  guix/build-system/vim.scm			\
   guix/ftp-client.scm				\
   guix/http-client.scm				\
   guix/gnupg.scm				\
@@ -241,6 +242,7 @@ MODULES =					\
   guix/build/scons-build-system.scm		\
   guix/build/texlive-build-system.scm		\
   guix/build/tree-sitter-build-system.scm	\
+  guix/build/vim-build-system.scm		\
   guix/build/waf-build-system.scm		\
   guix/build/haskell-build-system.scm		\
   guix/build/julia-build-system.scm		\
diff --git a/doc/guix.texi b/doc/guix.texi
index 3517c95251..89db688132 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9482,6 +9482,39 @@ Build Systems
 @end itemize
 @end defvar
 
+@defvar vim-build-system
+This variable is exported by @code{(guix build-system vim)}.  It is an
+extension of the @pref{Copy Build System, @code{copy-build-system}}, installing
+vim and neovim plugins into locations where these two text editors know to find
+their plugins, using their packpaths.
+
+Packages which are prefixed with @code{vim-} will be installed in vim's
+packpath, while those prefixed with @code{neovim-} will be installed in
+neovim's packpath.  If there is a @code{doc} directory with the plugin then
+helptags will be generated automatically.
+
+There are a couple of keywords added with the @code{vim-build-system}:
+@itemize
+@item With @code{plugin-name} it is possible to set the name of the plugin.  By
+default this is set to the name and version of the package, it is often more
+helpful to set this to name which the upstream author calls their plugin.
+@item With @code{install-plan} it is possible to augment the built-in
+install-plan of the @code{vim-build-system}.  This is particularly helpful if
+you have files which should be installed in other locations.  For more
+information about using the @code{install-plan}, take a look at the @pref{Copy
+Build System, @code{copy-build-system}}.
+@item With @code{#:vim} it is possible to add this package to vim's packpath,
+in addition to if it is added automatically because of the @code{vim-} prefix.
+@item With @code{#:neovim} it is possible to add this package to neovim's
+packpath, in addition to if it is added automatically because of the
+@code{neovim-} prefix.
+@item With @code{#:mode} it is possible to adjust the path which the plugin is
+installed into.  By default the plugin is installed into @code{start} and other
+options are available, including @code{opt}.  Adding a plugin into @code{opt}
+will mean you will need to run, for example, @command{:packadd foo} to load the
+@code{foo} plugin from inside of vim.
+@end itemize
+@end defvar
 
 @cindex Clojure (programming language)
 @cindex simple Clojure build system
diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm
new file mode 100644
index 0000000000..81f08ff436
--- /dev/null
+++ b/guix/build-system/vim.scm
@@ -0,0 +1,157 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system vim)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix gexp)
+  #:use-module (guix monads)
+  #:use-module (guix packages)
+  #:use-module (guix search-paths)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:export (%vim-build-system-modules vim-build vim-build-system))
+
+;; Commentary:
+;;
+;; Standard package installer for vim and neovim plugins.
+;; This is implemented as an extension of `copy-build-system'
+;; and takes advantage of vim and neovim's built-in package manager.
+;; It extends the installation procedure from the copy-build-system
+;; to put files in the correct place and then generates help tags.
+;;
+;; Code:
+
+(define %vim-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build vim-build-system)
+    ,@%copy-build-system-modules))
+
+(define (default-vim)
+  "Return the default Vim package."
+  ;; Lazily resolve the binding to avoid a circular dependency.
+  (let ((vim (resolve-interface '(gnu packages vim))))
+    (module-ref vim 'vim)))
+
+(define (default-neovim)
+  "Return the default Neovim package."
+  (let ((vim (resolve-interface '(gnu packages vim))))
+    (module-ref vim 'neovim)))
+
+(define* (lower name
+                #:key source
+                inputs
+                native-inputs
+                outputs
+                system
+                target
+                (vim? #f)
+                (neovim? #f)
+                (plugin-name name)
+                (vim (default-vim))
+                (neovim (default-neovim))
+                #:allow-other-keys #:rest arguments)
+  "Return a bag for NAME."
+  (let* ((private-keywords '(#:target #:vim #:neovim #:inputs #:native-inputs))
+         (vim? (or (string-prefix? "vim" name)
+                   vim?))
+         (neovim? (or (string-prefix? "neovim" name)
+                      neovim?))
+         (vim-inputs (append (if vim?
+                                 `(("vim" ,vim))
+                                 '())
+                             (if neovim?
+                                 `(("neovim" ,neovim))
+                                 '())))
+         (vim-arguments (append arguments
+                                `(#:vim? ,vim?
+                                  #:neovim? ,neovim?))))
+    (bag (name name)
+         (system system)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '()) ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'.
+                        ,@(standard-packages)))
+         (build-inputs `(,@vim-inputs ,@native-inputs))
+         (outputs outputs)
+         (build vim-build)
+         (arguments (strip-keyword-arguments private-keywords vim-arguments)))))
+
+(define* (vim-build name inputs
+                    #:key guile
+                    source
+                    (vim? #f)
+                    (neovim? #f)
+                    (mode "start")
+                    (plugin-name name)
+                    (install-plan ''())
+                    (phases '(@ (guix build vim-build-system) %standard-phases))
+                    (outputs '("out"))
+                    (search-paths '())
+                    (system (%current-system))
+                    (substitutable? #t)
+                    (imported-modules %vim-build-system-modules)
+                    (modules '((guix build vim-build-system)
+                               (guix build utils))))
+
+  (define build
+    (with-imported-modules imported-modules
+      #~(begin
+          (use-modules #$@modules)
+          #$(with-build-variables inputs outputs
+              #~(vim-build #:name #$name
+                           #:vim? #$vim?
+                           #:neovim? #$neovim?
+                           #:mode #$mode
+                           #:plugin-name #$plugin-name
+                           #:install-plan #$(if (pair? install-plan)
+                                                (sexp->gexp install-plan)
+                                                install-plan)
+                           #:source #+source
+                           #:system #$system
+                           #:phases #$(if (pair? phases)
+                                          (sexp->gexp phases)
+                                          phases)
+                           #:outputs %outputs
+                           #:search-paths '#$(sexp->gexp
+                                               (map search-path-specification->sexp
+                                                    search-paths))
+                           #:inputs
+                           %build-inputs)))))
+
+  (mlet %store-monad
+        ((guile (package->derivation (or guile (default-guile))
+                                     system #:graft? #f)))
+        (gexp->derivation name
+                          build
+                          #:system system
+                          #:target #f
+                          #:graft? #f
+                          #:substitutable? substitutable?
+                          #:guile-for-build guile)))
+
+(define vim-build-system
+  (build-system (name 'vim)
+                (description "The standard Vim build system")
+                (lower lower)))
+
+;;; vim.scm ends here
diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-system.scm
new file mode 100644
index 0000000000..28c0f8f83f
--- /dev/null
+++ b/guix/build/vim-build-system.scm
@@ -0,0 +1,117 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build vim-build-system)
+  #:use-module ((guix build copy-build-system)
+                #:prefix copy:)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 ftw)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases vim-build))
+
+;; Commentary:
+;;
+;; System for installing vim and neovim plugins. It downloads
+;; the source and copies the appropriate files to vim and nvim
+;; packpaths. It then generates helptags.
+;;
+;; Code:
+
+(define copy:install
+  (assoc-ref copy:%standard-phases 'install))
+
+(define vim-path
+  "/share/vim/vimfiles/pack/guix/")
+(define nvim-path
+  "/share/nvim/site/pack/guix/")
+
+(define* (install #:key plugin-name
+                  install-plan
+                  neovim?
+                  vim?
+                  mode
+                  outputs
+                  #:allow-other-keys)
+
+  (let* ((include-regexp '(".*\\/.*\\/.*"))
+         (exclude-regexp '("^scripts/.*"
+                           "tests?/.*" "^t/.*"
+                           "assets/.*"
+                           ".*\\/\\..*"))
+         (vim-install (if vim?
+                          `(("." ,(string-append vim-path mode "/" plugin-name "/")
+                             #:include-regexp ,include-regexp
+                             #:exclude-regexp ,exclude-regexp))
+                          '()))
+         (neovim-install (if neovim?
+                             `(("." ,(string-append nvim-path mode "/" plugin-name "/")
+                                #:include-regexp ,include-regexp
+                                #:exclude-regexp ,exclude-regexp))
+                             '())))
+    (copy:install #:outputs outputs
+                  #:install-plan (append vim-install
+                                         neovim-install
+                                         install-plan))))
+
+(define* (generate-helptags #:key plugin-name
+                            neovim?
+                            vim?
+                            mode
+                            outputs
+                            #:allow-other-keys)
+
+  (define (vim-generate output)
+    (invoke "vim" "--clean" "-en" "--cmd"
+            (string-append "helptags "
+                           output vim-path mode "/" plugin-name "/doc")
+            "--cmd" "q"))
+
+  (define (neovim-generate output)
+    (invoke "nvim" "--clean" "--headless" "-en" "--cmd"
+            (string-append "helptags "
+                           output nvim-path mode "/" plugin-name "/doc")
+            "--cmd" "q"))
+
+  (when (scandir "./doc")
+    (let ((out (assoc-ref outputs "out")))
+      (when vim?
+            (vim-generate out))
+      (when neovim?
+            (neovim-generate out)))))
+
+(define %standard-phases
+  ;; Everything is as with the Copy Build System except for
+  ;; the addition of the generate-helptags phase and a few
+  ;; custom actions are added to the install phase
+  (modify-phases copy:%standard-phases
+    (replace 'install install)
+    (add-after 'install 'generate-helptags generate-helptags)))
+
+(define* (vim-build #:key inputs
+                    (phases %standard-phases)
+                    #:allow-other-keys #:rest args)
+  "Build the given package, applying all of PHASES in order."
+  (apply copy:copy-build
+         #:inputs inputs
+         #:phases phases
+         args))
+
+;;; vim-build-system.scm ends here
-- 
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





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#60029] [PATCH v3 3/3] gnu: Have vim packages use vim-build-system.
  2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 1/3] gnu: vim: Add vim packages to 'package-path' instead of 'runtime-path' Efraim Flashner
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 2/3] build-system: Add vim-build-system Efraim Flashner
@ 2023-10-16  9:15   ` Efraim Flashner
  2023-11-08 10:16   ` bug#60029: [PATCH v3 0/3] Add vim-build-system Efraim Flashner
  3 siblings, 0 replies; 19+ messages in thread
From: Efraim Flashner @ 2023-10-16  9:15 UTC (permalink / raw)
  To: 60029
  Cc: paren, me, Efraim Flashner, Efraim Flashner,
	Guillaume Le Vaillant, Katherine Cox-Buday, Munyoki Kilyungi,
	jgart

From: Jonathan Scoresby <me@jonscoresby.com>

* gnu/packages/vim.scm (vim-neocomplete, vim-neocomplete-snippets,
vim-neosnippet, vim-scheme, vim-luna, vim-fugitive, vim-airline,
vim-airline-themes, vim-syntastic, neovim-syntastic, vim-solarized,
vim-rainbow, editorconfig-vim, neovim-packer, vim-guix-vim,
vim-asyncrun, vim-dispatch, vim-gemini-vim, vim-eunuch, vim-slime,
vim-vlime, vim-paredit, vim-surround, vim-gnupg, vim-ctrlp,
vim-mucomplete, vim-gitgutter, vim-characterize, vim-tagbar,
vim-nerdtree, vim-nerdcommander):
[build-system]: Switch to vim-build-system.
[arguments]: Adjust accordingly.
* gnu/packages/code.scm (global)[arguments]: Move vim files to their new
location.
* gnu/packages/lisp.scm (txr),
* gnu/packages/mail.scm (msmtp),
* gnu/packages/rust-apps.scm (skim),
* gnu/packages/vim.scm (vifm),
* gnu/packages/wm.scm (fluxbox): Same.

Co-authored-by: Efraim Flashner <efraim@flashner.co.il>
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
---
 gnu/packages/code.scm      |   5 +-
 gnu/packages/lisp.scm      |   5 +-
 gnu/packages/mail.scm      |   3 +-
 gnu/packages/rust-apps.scm |   3 +-
 gnu/packages/vim.scm       | 306 ++++++++++++++-----------------------
 gnu/packages/wm.scm        |   3 +-
 6 files changed, 124 insertions(+), 201 deletions(-)

diff --git a/gnu/packages/code.scm b/gnu/packages/code.scm
index 21a9f10a11..f53f7dc9e3 100644
--- a/gnu/packages/code.scm
+++ b/gnu/packages/code.scm
@@ -237,8 +237,9 @@ (define-public global                             ; a global variable
                  (lambda _
                    ;; Install the plugin files in the right place.
                    (let* ((data (string-append #$output "/share/gtags"))
-                          (vim  (string-append #$output
-                                               "/share/vim/vimfiles/plugin"))
+                          (vim  (string-append
+                                  #$output
+                                  "/share/vim/vimfiles/pack/guix/start/global/plugin"))
                           (lisp (string-append #$output "/share/emacs/site-lisp/"
                                                #$(package-name this-package) "-"
                                                #$(package-version this-package))))
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index c54a9b4b3a..e421ccc092 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1061,8 +1061,9 @@ (define-public txr
                                '("txr-manpage.html" "txr-manpage.pdf")))))
                (add-after 'install 'install-vim-files
                  (lambda _
-                   (let ((syntax (string-append #$output
-                                                "/share/vim/vimfiles/syntax")))
+                   (let ((syntax (string-append
+                                   #$output
+                                   "/share/vim/vimfiles/pack/guix/start/txr/syntax")))
                      (install-file "tl.vim" syntax)
                      (install-file "txr.vim" syntax)))))))
     (native-inputs
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index be458a2d92..e736c07e63 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1865,7 +1865,8 @@ (define-public msmtp
                       (doc (string-append out "/share/doc/msmtp"))
                       (msmtpq "scripts/msmtpq")
                       (msmtpqueue "scripts/msmtpqueue")
-                      (vimfiles (string-append out "/share/vim/vimfiles/syntax")))
+                      (vimfiles (string-append
+                                  out "/share/vim/vimfiles/pack/start/msmtp/syntax")))
                  (install-file (string-append msmtpq "/msmtpq") bin)
                  (install-file (string-append msmtpq "/msmtp-queue") bin)
                  (install-file (string-append msmtpqueue "/msmtp-enqueue.sh") bin)
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 2f41ca4849..68b2122406 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -2151,7 +2151,8 @@ (define-public skim
                      (bin (string-append out "/bin"))
                      (share (string-append out "/share"))
                      (man (string-append out "/share/man"))
-                     (vimfiles (string-append share "/vim/vimfiles/plugin"))
+                     (vimfiles (string-append
+                                 share "/vim/vimfiles/pack/guix/start/skim/plugin"))
                      (bash-completion
                       (string-append share "/bash-completions/completions"))
                      (zsh-site (string-append share "/zsh/site-functions"))
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index d2ea9b7ae1..c8eb2522c6 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -31,17 +31,17 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages vim)
-  #:use-module ((guix licenses) #:prefix license:)  
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system pyproject)
+  #:use-module (guix build-system vim)
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin) ; For GNU hostname
@@ -299,12 +299,9 @@ (define-public vim-neocomplete
        (sha256
         (base32
          "1h6sci5mhdfg6sjsjpi8l5li02hg858zcayiwl60y9j2gqnd18lv"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "neocomplete"))
     (synopsis "Next generation completion framework for Vim")
     (description
      "@code{neocomplete}, an abbreviation of 'neo-completion with cache',
@@ -332,10 +329,9 @@ (define-public vim-neosnippet-snippets
          (sha256
           (base32
            "151wpvbj6jb9jdkbhj3b77f5sq7y328spvwfbqyj1y32rg4ifmc6"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("neosnippets" "share/vim/vimfiles/"))))
+       (list #:plugin-name "neosnippet-snippets"))
     (synopsis "Snippets for neosnippet")
     (description
      "@code{neosnippet-snippets} provides standard snippets for the Vim plugin
@@ -361,17 +357,9 @@ (define-public vim-neosnippet
        (sha256
         (base32
          "0k80syscmpnj38ks1fq02ds59g0r4jlg9ll7z4qc048mgi35alw5"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("indent" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("rplugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+     (list #:plugin-name "neosnippet"))
     (synopsis "Snippet support for Vim")
     (description
      "@code{neosnippet}, is a plugin for Vim which adds snippet support to Vim.
@@ -400,12 +388,9 @@ (define-public vim-scheme
          (sha256
           (base32
            "04h946vr4f8wxap3wzqs69y2v8n50g2zbk22jsg2kxr4c01z5cbw"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("ftplugin" "share/vim/vimfiles/")
-           ("indent" "share/vim/vimfiles/")
-           ("syntax" "share/vim/vimfiles/"))))
+       (list #:plugin-name "vim-scheme"))
       (synopsis "Scheme syntax for Vim")
       (description
        "@code{vim-scheme} provides Scheme support for Vim (R7RS and CHICKEN).")
@@ -428,10 +413,9 @@ (define-public vim-luna
          (sha256
           (base32
            "0ka3qbhsh8lix1vyj4678j7dnchkd8khhirrnn3aylxxf8fpqyg8"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("colors" "share/vim/vimfiles/"))))
+       (list #:plugin-name "luna"))
       (synopsis "Dark color theme for Vim")
       (description
        "@code{vim-luna} is a dark color theme for Vim.")
@@ -455,11 +439,9 @@ (define-public vim-context-filetype
          (sha256
           (base32
            "0alvrfhmd91zkd9h83s8wvgyq4iakcf6rybsyjd369qbgpcqky89"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("autoload" "share/vim/vimfiles/"))))
+       (list #:plugin-name "context_filetype"))
       (synopsis "Context filetype library for Vim")
       (description
        "@code{vim-context-filetype} is context filetype library for Vim script.")
@@ -479,15 +461,9 @@ (define-public vim-fugitive
         (file-name (git-file-name name version))
         (sha256
          (base32 "138290g2aph1jjhaza6biky5qi4ka6435s01bwxivllgb53g3irc"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+     (list #:plugin-name "fugitive"))
     (home-page "https://github.com/tpope/vim-fugitive")
     (synopsis "Vim plugin to work with Git")
     (description "Vim-fugitive is a wrapper for Vim that complements the
@@ -509,12 +485,9 @@ (define-public vim-airline
        (sha256
         (base32
          "1aksmr73648pvyc75pfdz28k2d4ky52rn7xiwcv7lz87q3vqld7k"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "airline"))
     (synopsis "Statusline for Vim")
     (description
      "@code{vim-airline} is an extensible statusline for Vim.
@@ -540,12 +513,9 @@ (define-public vim-airline-themes
          (sha256
           (base32
            "1sb7nb7j7bz0pv1c9bgdy0smhr0jk2b1vbdv9yzghg5lrknpsbr6"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+       (list #:plugin-name "airline-themes"))
       (synopsis "Collection of themes for Vim-airline")
       (description
        "@code{vim-airline-themes} is a collection of themes for @code{vim-airline}.")
@@ -565,13 +535,9 @@ (define-public vim-syntastic
        (file-name (git-file-name name version))
        (sha256
         (base32 "0j91f72jaz1s6aw1hpjiz30vk2ds2aqd9gisk91grsldy6nz6hhz"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax_checkers" "share/vim/vimfiles/"))))
+     (list #:plugin-name "syntastic"))
     (synopsis "Syntax checking plugin for Vim")
     (description
      "Vim-syntastic is a syntax checking plugin for Vim.  It runs files through
@@ -581,6 +547,17 @@ (define-public vim-syntastic
     (home-page "https://github.com/vim-syntastic/syntastic")
     (license license:wtfpl2)))
 
+(define-public neovim-syntastic
+  (package
+    (inherit vim-syntastic)
+    (name "neovim-syntastic")
+    (synopsis "Syntax checking plugin for Neovim")
+    (description
+     "Vim-syntastic is a syntax checking plugin for Neovim.  It runs files through
+external syntax checkers and displays any resulting errors to the user.  This
+can be done on demand, or automatically as files are saved.  If syntax errors
+are detected, the user is notified.")))
+
 (define-public vim-solarized
   (let ((commit "62f656a02f93c5190a8753159e34b385588d5ff3")
         (revision "1"))
@@ -596,11 +573,15 @@ (define-public vim-solarized
          (file-name (git-file-name name version))
          (sha256
           (base32 "0001mz5v3a8zvi3gzmxhi3yrsb6hs7qf6i497arsngnvj2cwn61d"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("vim-colors-solarized/colors" "share/vim/vimfiles/")
-           ("vim-colors-solarized/doc" "share/vim/vimfiles/"))))
+       (list
+         #:plugin-name "solarized"
+         #:phases
+         #~(modify-phases %standard-phases
+             (add-after 'unpack 'chdir
+               (lambda _
+                 (chdir "vim-colors-solarized"))))))
       (home-page "https://github.com/altercation/vim-colors-solarized")
       (synopsis "Solarized color scheme for Vim")
       (description
@@ -631,9 +612,15 @@ (define-public vim-rainbow
        (file-name (git-file-name name version))
        (sha256
         (base32 "1jya8wwlkmgs89hndrq6gsaskhk9g0fh62wdib8v9vz2x5g3738z"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan '(("opt" "share/vim/vimfiles/pack/rainbow/"))))
+     (list
+       #:plugin-name "rainbow"
+       #:phases
+       #~(modify-phases %standard-phases
+           (add-after 'unpack 'chdir
+             (lambda _
+               (chdir "opt/rainbow"))))))
     (home-page "https://github.com/mason1920/rainbow")
     (synopsis "Rainbow Parentheses Improved")
     (description
@@ -656,12 +643,11 @@ (define-public editorconfig-vim
         (sha256
          (base32
           "0mp80bi2m56bb93szw87vy6q5s85yk9g91sl4pr51316rgdv5kkv"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list
+       #:plugin-name "editorconfig"
+       #:vim? #t))
     (home-page "https://editorconfig.org/")
     (synopsis "EditorConfig plugin for Vim")
     (description "EditorConfig makes it easy to maintain the correct coding
@@ -686,11 +672,9 @@ (define-public neovim-packer
                 (sha256
                  (base32
                   "1xn08z3a21mgfvp5i1nv57jnldwxwnl5nkryiff3zc99b1mizigp"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       (list #:install-plan
-             #~'(("lua" "share/nvim/site/pack/guix/start/packer.nvim/")
-                 ("doc" "share/nvim/site/pack/guix/start/packer.nvim/"))))
+       (list #:plugin-name "packer.nvim"))
       (home-page "https://github.com/wbthomason/packer.nvim")
       (synopsis "Plugin manager for Neovim")
       (description
@@ -699,23 +683,6 @@ (define-public neovim-packer
 is based on Vim's builtin plugin support.")
       (license license:expat))))
 
-(define-public neovim-syntastic
-  (package
-    (inherit vim-syntastic)
-    (name "neovim-syntastic")
-    (arguments
-     '(#:install-plan
-       '(("autoload" "share/nvim/site/")
-         ("doc" "share/nvim/site/")
-         ("plugin" "share/nvim/site/")
-         ("syntax_checkers" "share/nvim/site/"))))
-    (synopsis "Syntax checking plugin for Neovim")
-    (description
-     "Vim-syntastic is a syntax checking plugin for Neovim.  It runs files through
-external syntax checkers and displays any resulting errors to the user.  This
-can be done on demand, or automatically as files are saved.  If syntax errors
-are detected, the user is notified.")))
-
 (define-public neovim
   (package
     (name "neovim")
@@ -889,12 +856,12 @@ (define-public vifm
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (vifm (string-append out "/share/vifm"))
-                     (vimfiles (string-append out "/share/vim/vimfiles")))
+                     (vimfiles (string-append
+                                 out "/share/vim/vimfiles/pack/guix/start/vifm")))
                 (copy-recursively (string-append vifm "/colors")
                                   (string-append vimfiles "/colors"))
                 (copy-recursively (string-append vifm "/vim")
                                   vimfiles)
-                (delete-file-recursively (string-append vifm "/colors"))
                 (delete-file-recursively (string-append vifm "/vim"))))))))
     (native-inputs
      (list groff)) ; for the documentation
@@ -986,17 +953,9 @@ (define-public vim-guix-vim
               (sha256
                (base32
                 "013yn2n2nsspk12bldkc9xn4z4kjx9rvracbllc8i1nngldckxd0"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("compiler" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("indent" "share/vim/vimfiles/")
-         ("ftdetect" "share/vim/vimfiles/")
-         ("ftplugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+     (list #:plugin-name "guix"))
     (home-page "https://git.sr.ht/~efraim/guix.vim")
     (synopsis "Guix integration in Vim")
     (description "This package provides support for GNU Guix in Vim.")
@@ -1015,11 +974,13 @@ (define-public vim-asyncrun
               (sha256
                (base32
                 "11zcw0sll6qg6ha0rr6n1cw5v73azvf7ycwn9lgiwa5cj7rrqjf4"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("plugin" "share/vim/vimfiles/")
-         ("doc/" "share/vim/vimfiles/doc" #:include ("asyncrun.txt")))))
+     (list
+       #:plugin-name "asyncrun"
+       #:install-plan
+       #~'(("plugin" "share/vim/vimfiles/")
+           ("doc/" "share/vim/vimfiles/doc" #:include ("asyncrun.txt")))))
     (home-page "https://github.com/skywind3000/asyncrun.vim")
     (synopsis "Run Async Shell Commands in Vim")
     (description "This plugin takes the advantage of new APIs in Vim 8 (and
@@ -1041,12 +1002,9 @@ (define-public vim-dispatch
         (sha256
          (base32
           "1m8b5mn2zqlphzs6xfwykwmghf6p0wabrhpjmh7vav35jgcxc4wl"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "dispatch"))
     (home-page "https://github.com/tpope/vim-dispatch")
     (synopsis "Asynchronous build and test dispatcher")
     (description "Leverage the power of Vim's compiler plugins without being
@@ -1071,11 +1029,9 @@ (define-public vim-gemini-vim
           (file-name (git-file-name name version))
           (sha256
            (base32 "05ffhhfahjqwxyrqmsinsahrs15wknzl2qbj8mznyv319mn2civ2"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       `(#:install-plan
-         '(("ftdetect" "share/vim/vimfiles/")
-           ("syntax" "share/vim/vimfiles/"))))
+       (list #:plugin-name "gemini"))
       (home-page "https://git.sr.ht/~torresjrjr/gemini.vim")
       (synopsis "Vim syntax highlighting plugin for Gemini")
       (description "This Vim plugin provides a Vim syntax highlighting plugin
@@ -1099,11 +1055,9 @@ (define-public vim-eunuch
           (sha256
            (base32
             "1xadb22kd40swmww0qxmmkcpcq6viy8l167pjck5q32hfngll5d3"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+       (list #:plugin-name "eunuch"))
       (home-page "https://github.com/tpope/vim-eunuch")
       (synopsis "Vim sugar for the UNIX shell commands")
       (description "Vim sugar for the UNIX shell commands that need it the most.
@@ -1127,13 +1081,9 @@ (define-public vim-slime
           (file-name (git-file-name name version))
           (sha256
            (base32 "0k4b629jn6xlxyjxdl3cgm06v9dmx967rqnslv5m82c9kscwpyh4"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       `(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("ftplugin" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+       (list #:plugin-name "vim-slime"))
       (home-page "https://technotales.wordpress.com/2007/10/03/like-slime-for-vim/")
       (synopsis "Vim plugin to give you some slime")
       (description "SLIME is an Emacs plugin to turn Emacs into a Lisp IDE.  You
@@ -1159,28 +1109,29 @@ (define-public vim-vlime
        (sha256
         (base32 "1dfc1wyjsgkckrklkzvk4whaz3ahaka59rvm7rc724mabmk83pmp"))
        (file-name (git-file-name name version))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("vim/autoload" "share/vim/vimfiles/")
-         ("vim/doc" "share/vim/vimfiles/")
-         ("vim/ftplugin" "share/vim/vimfiles/")
-         ("vim/syntax" "share/vim/vimfiles/")
-         ("vim/test" "share/vim/vimfiles/")
-         ;; This is so the Vimscript part of Vlime can find the lisp files.
-         ("lisp" "share/vim/")
-         ;; This is so lisp can load Vlime without the Vim part.
-         ("lisp" "share/common-lisp/source/vlime"))
+     '(#:plugin-name "vlime"
        #:phases
        (modify-phases %standard-phases
-         ;; Create a symbolic link to the .asd file so that
-         ;; (asdf:load-system "vlime") finds the system.
-         (add-after 'install 'link-asd
+         (add-after 'symlink-files 'install-lisp-files
            (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (mkdir-p (string-append out "/share/common-lisp/systems/"))
-               (symlink (string-append out "/share/common-lisp/source/vlime/vlime.asd")
-                        (string-append out "/share/common-lisp/systems/vlime.asd"))))))))
+             (let* ((out (assoc-ref outputs "out"))
+                    (common-lisp (string-append out "/share/common-lisp")))
+               ;; Create a symbolic link to the .asd file so that
+               ;; (asdf:load-system "vlime") finds the system.
+               (copy-recursively "lisp" (string-append common-lisp "/source/vlime"))
+               (mkdir-p (string-append common-lisp "/systems/"))
+               (symlink (string-append common-lisp "/source/vlime/vlime.asd")
+                        (string-append common-lisp "/systems/vlime.asd")))))
+         (add-after 'install 'symlink-files
+           (lambda* (#:key outputs plugin-name #:allow-other-keys)
+             (with-directory-excursion
+               (string-append (assoc-ref outputs "out")
+                              "/share/vim/vimfiles/pack/guix/start/" plugin-name)
+               (for-each (lambda (dir)
+                           (symlink (string-append "./vim/" dir) dir))
+                         (list "after" "autoload" "doc" "ftplugin" "syntax"))))))))
     (propagated-inputs
      (list cl-alexandria
            cl-slime-swank
@@ -1211,11 +1162,9 @@ (define-public vim-paredit
           (file-name (git-file-name name version))
           (sha256
            (base32 "07d5s20r0ssd7rir45vy0fqlci44gha1a81rcilgar227f3nw328"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+       (list #:plugin-name "paredit"))
       (home-page "https://github.com/kovisoft/paredit")
       (synopsis "Vim plugin for structured editing of Lisp S-expressions")
       (description
@@ -1237,11 +1186,9 @@ (define-public vim-surround
        (file-name (git-file-name name version))
        (sha256
         (base32 "1b0bd5m5lv1p4d299mrwjfs2gk0zqwyaqdaid9hs9yqlxnr8s5nf"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "surround"))
     (home-page "https://github.com/tpope/vim-surround")
     (synopsis "Vim plugin for easy quoting and parenthesizing")
     (description
@@ -1262,12 +1209,9 @@ (define-public vim-gnupg
                            "/vim-gnupg-v" version ".tar.gz"))
        (sha256
         (base32 "02w8lgyyh7wgxysvmmcf9ja5c06vrbyh3alzvv97x8cfhrp0skn7"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "vim-gnupg"))
     (home-page "https://www.vim.org/scripts/script.php?script_id=3645")
     (synopsis "Vim plugin for transparent editing of gpg encrypted files")
     (description
@@ -1293,12 +1237,9 @@ (define-public vim-ctrlp
        (file-name (git-file-name name version))
        (sha256
         (base32 "0n68hg59h4rjn0ziqbsh5pr03l3kr98zk54659ny6vq107af1w96"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "ctrlp.vim"))
     (home-page "https://ctrlpvim.github.io/ctrlp.vim/")
     (synopsis "Fuzzy file, buffer, mru, tag, etc. finder for Vim")
     (description
@@ -1330,12 +1271,9 @@ (define-public vim-mucomplete
        (file-name (git-file-name name version))
        (sha256
         (base32 "054g80n09mmxxlh8xaic29bn8bgn3clvv732rymljdyvbj1mlhwd"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "MUcomplete"))
     (home-page "https://github.com/lifepillar/vim-mucomplete")
     (synopsis "MUcomplete is a minimalist autocompletion plugin for Vim")
     (description
@@ -1359,12 +1297,9 @@ (define-public vim-gitgutter
          (file-name (git-file-name name version))
          (sha256
           (base32 "0zpa7cs59a8sq0k3frlf9flpf30jcn239yrpmv40r7nqvxzglbpl"))))
-      (build-system copy-build-system)
+      (build-system vim-build-system)
       (arguments
-       '(#:install-plan
-         '(("autoload" "share/vim/vimfiles/")
-           ("doc" "share/vim/vimfiles/")
-           ("plugin" "share/vim/vimfiles/"))))
+       (list #:plugin-name "gitgutter"))
       (synopsis "Vim plugin which shows a git diff in the sign column")
       (description
        "A Vim plugin which shows a git diff in the sign column.  It shows which
@@ -1388,12 +1323,9 @@ (define-public vim-characterize
        (file-name (git-file-name name version))
        (sha256
         (base32 "0ppsbsd696ih40d9f76mdl9sd9y7p2pvm65qmvq4b2zhkv4xbpxz"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "characterize"))
     (home-page "https://github.com/tpope/vim-characterize")
     (synopsis "Vim plugin for showing Unicode character metadata")
     (description
@@ -1422,13 +1354,9 @@ (define-public vim-tagbar
        (file-name (git-file-name name version))
        (sha256
         (base32 "1fqfs8msmr6d4kpvxqp14sdjvp5fj52q5w5kz71myzcd4kqzmirp"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))
+     '(#:plugin-name "tagbar"
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'link-universal-ctags
@@ -1463,15 +1391,9 @@ (define-public vim-nerdtree
        (file-name (git-file-name name version))
        (sha256
         (base32 "1si8qla86ng8cffbmfrk9gss0i3912yw0f1ph4bsiq0kk837lccp"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     '(#:install-plan
-       '(("autoload" "share/vim/vimfiles/")
-         ("doc" "share/vim/vimfiles/")
-         ("lib" "share/vim/vimfiles/")
-         ("nerdtree_plugin" "share/vim/vimfiles/")
-         ("plugin" "share/vim/vimfiles/")
-         ("syntax" "share/vim/vimfiles/"))))
+     (list #:plugin-name "nerdtree"))
     (home-page "https://github.com/preservim/nerdtree")
     (synopsis "Tree explorer plugin for Vim")
     (description
@@ -1493,13 +1415,9 @@ (define-public vim-nerdcommenter
        (file-name (git-file-name name version))
        (sha256
         (base32 "1ka2rqn7rby55aps3iblh1dcqxm7m7qx72mpkz6y2aaj8mkj0zyd"))))
-    (build-system copy-build-system)
+    (build-system vim-build-system)
     (arguments
-     (list
-      #:install-plan
-      #~`(("autoload" "share/vim/vimfiles/")
-          ("doc" "share/vim/vimfiles/")
-          ("plugin" "share/vim/vimfiles/"))))
+     (list #:plugin-name "nerdcommenter"))
     (home-page "https://github.com/preservim/nerdcommenter")
     (synopsis "Vim plugin for easy commenting of code")
     (description
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 8576d0297d..f3ad1a5635 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -1083,7 +1083,8 @@ (define-public fluxbox
          (add-after 'install 'install-vim-files
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (syntax (string-append out "/share/vim/vimfiles/syntax")))
+                    (syntax (string-append
+                              out "/share/vim/vimfiles/pack/guix/start/fluxbox/syntax")))
                (copy-recursively "3rd/vim/vim/syntax" syntax)
                #t)))
          (add-after 'install 'install-xsession
-- 
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





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* bug#60029: [PATCH v3 0/3] Add vim-build-system.
  2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
                     ` (2 preceding siblings ...)
  2023-10-16  9:15   ` [bug#60029] [PATCH v3 3/3] gnu: Have vim packages use vim-build-system Efraim Flashner
@ 2023-11-08 10:16   ` Efraim Flashner
  3 siblings, 0 replies; 19+ messages in thread
From: Efraim Flashner @ 2023-11-08 10:16 UTC (permalink / raw)
  To: 60029-done; +Cc: paren, me

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

I did another round of review on the patches (which did find some
things) and I've now pushed these patches!

Now I have to figure out how to use packadd so I can drop
editorconfig-vim since it comes with vim.

-- 
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-11-08 10:16 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-13  0:38 [bug#60029] [PATCH core-updates 0/4] vim-build-system Jonathan Scoresby
2022-12-13  8:34 ` [bug#60029] [PATCH 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
2022-12-13 19:05   ` ( via Guix-patches via
2022-12-13  8:34 ` [bug#60029] [PATCH 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
2022-12-13 19:06   ` ( via Guix-patches via
2022-12-13 22:10     ` Jonathan Scoresby
2022-12-14  6:56       ` ( via Guix-patches via
2022-12-13  8:34 ` [bug#60029] [PATCH 3/4] guix: add vim-build-system Jonathan Scoresby
2022-12-13  8:34 ` [bug#60029] [PATCH 4/4] gnu: have vim packages use vim-build-system Jonathan Scoresby
2022-12-14 21:01 ` [bug#60029] [PATCH v2 1/4] guix: copy-build-system: allow install plan directives to specify output Jonathan Scoresby
2022-12-14 21:02   ` [bug#60029] [PATCH v2 2/4] gnu: vim: add relevant locations to 'package-path' instead of 'runtime-path' Jonathan Scoresby
2022-12-14 21:14     ` ( via Guix-patches via
2022-12-14 21:02   ` [bug#60029] [PATCH v2 3/4] guix: add vim-build-system Jonathan Scoresby
2022-12-14 21:02   ` [bug#60029] [PATCH v2 4/4] gnu: have vim packages use vim-build-system Jonathan Scoresby
2023-10-16  9:15 ` [bug#60029] [PATCH v3 0/3] Add vim-build-system Efraim Flashner
2023-10-16  9:15   ` [bug#60029] [PATCH v3 1/3] gnu: vim: Add vim packages to 'package-path' instead of 'runtime-path' Efraim Flashner
2023-10-16  9:15   ` [bug#60029] [PATCH v3 2/3] build-system: Add vim-build-system Efraim Flashner
2023-10-16  9:15   ` [bug#60029] [PATCH v3 3/3] gnu: Have vim packages use vim-build-system Efraim Flashner
2023-11-08 10:16   ` bug#60029: [PATCH v3 0/3] Add vim-build-system Efraim Flashner

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