summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--gnu/packages/aux-files/guix.vim7
-rw-r--r--gnu/packages/vim.scm10
3 files changed, 17 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 1b1360fe4c..e0ee65fcce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -356,6 +356,7 @@ dist_noinst_DATA =				\
 AUX_FILES =						\
   gnu/packages/aux-files/chromium/master-preferences.json		\
   gnu/packages/aux-files/emacs/guix-emacs.el		\
+  gnu/packages/aux-files/guix.vim			\
   gnu/packages/aux-files/linux-libre/5.10-arm.conf	\
   gnu/packages/aux-files/linux-libre/5.10-arm64.conf	\
   gnu/packages/aux-files/linux-libre/5.10-i686.conf	\
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
new file mode 100644
index 0000000000..7dc359e52b
--- /dev/null
+++ b/gnu/packages/aux-files/guix.vim
@@ -0,0 +1,7 @@
+" This appends all of the vim plugins to the end of Vim's runtimepath.
+for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
+    let vimplugins = directory . "/share/vim/vimfiles"
+    if isdirectory(vimplugins)
+        let &rtp = join([&rtp,vimplugins], ',')
+    endif
+endfor
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 81d5ab00c9..32a668a1c0 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -145,7 +145,14 @@
                  ;; Blindly fix some other differences based on error output.
                  (("^\\|!") "|<")
                  (("@37") "")))
-             #t)))))
+             #t))
+         (add-after 'install 'install-guix.vim
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((vimdir (string-append (assoc-ref outputs "out") "/share/vim")))
+               (mkdir-p vimdir)
+               (copy-file (assoc-ref inputs "guix.vim")
+                          (string-append vimdir "/vimrc"))
+               #t))))))
     (inputs
      `(("gawk" ,gawk)
        ("ncurses" ,ncurses)
@@ -153,6 +160,7 @@
        ("tcsh" ,tcsh)))                 ; For runtime/tools/vim32
     (native-inputs
      `(("libtool" ,libtool)
+       ("guix.vim" ,(search-auxiliary-file "guix.vim"))
 
        ;; For tests.
        ("tzdata" ,tzdata-for-tests)))