gnu: mailutils: Add SEARCH CHARSET support.
[jackhill/guix/guix.git] / gnu / packages / vim.scm
index 3dbd6d9..56deb12 100644 (file)
@@ -1,9 +1,10 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net>
+;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,7 @@
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin) ; For GNU hostname
   #:use-module (gnu packages attr)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gawk)
@@ -53,6 +55,7 @@
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages shells)
   #:use-module (gnu packages tcl)
+  #:use-module (gnu packages text-editors)
   #:use-module (gnu packages terminals)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg))
 (define-public vim
   (package
     (name "vim")
-    (version "8.0.0494")
+    (version "8.1.0644")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "https://github.com/vim/vim/archive/v"
-                                 version ".tar.gz"))
-             (file-name (string-append name "-" version ".tar.gz"))
+             (method git-fetch)
+             (uri (git-reference
+                    (url "https://github.com/vim/vim")
+                    (commit (string-append "v" version))))
+             (file-name (git-file-name name version))
              (sha256
               (base32
-               "08kzimdyla35ndrbn68jf8pmzm7nd2qrydnvk57j089m6ajic62r"))))
+               "1xksb2v8rw1zgrd5fwqvrh44lf277k85sad2y4ia1z17y7i8j2fl"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
        #:parallel-tests? #f
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'make-bit-reproducable
-           (lambda _
-             (substitute* "src/version.c"
-               ((" VIM_VERSION_LONG_DATE") " VIM_VERSION_LONG")
-               ((" __DATE__") "")
-               ((" __TIME__") ""))
-             #t))
          (add-after 'configure 'patch-config-files
            (lambda _
              (substitute* "runtime/tools/mve.awk"
                (("/usr/bin/nawk") (which "gawk")))
              (substitute* '("src/testdir/Makefile"
-                            "src/testdir/test_normal.vim")
+                            "src/testdir/test_normal.vim"
+                            "src/testdir/test_terminal.vim")
                (("/bin/sh") (which "sh")))
+             #t))
+         (add-before 'check 'patch-failing-tests
+           (lambda _
+             ;; XXX A single test fails with “Can't create file /dev/stdout” (at
+             ;; Test_writefile_sync_dev_stdout line 5) while /dev/stdout exists.
+             (substitute* "src/testdir/test_writefile.vim"
+               (("/dev/stdout") "a-regular-file"))
+
+             ;; XXX: This test fails when run in the build container:
+             ;; <https://github.com/vim/vim/issues/3348>.
+             (substitute* "src/testdir/test_search.vim"
+               ((".*'Test_incsearch_substitute_03'.*" all)
+                (string-append "\"" all "\n")))
              #t)))))
     (inputs
      `(("gawk" ,gawk)
-       ("inetutils" ,inetutils)
        ("ncurses" ,ncurses)
        ("perl" ,perl)
        ("tcsh" ,tcsh))) ; For runtime/tools/vim32
-    (home-page "http://www.vim.org/")
+    (native-inputs
+     `(("libtool" ,libtool)))
+    (home-page "https://www.vim.org/")
     (synopsis "Text editor based on vi")
     (description
      "Vim is a highly configurable text editor built to enable efficient text
@@ -109,8 +121,35 @@ Vim is perfect for all kinds of text editing, from composing email to editing
 configuration files.")
     (license license:vim)))
 
+(define-public xxd
+  (package (inherit vim)
+    (name "xxd")
+    (arguments
+     `(#:make-flags '("CC=gcc")
+       #:tests? #f ; there are none
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'chdir
+           (lambda _
+             (chdir "src/xxd")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
+               (install-file "xxd" bin)
+               #t))))))
+    (inputs `())
+    (native-inputs `())
+    (synopsis "Hexdump utility from vim")
+    (description "This package provides the Hexdump utility xxd that comes
+with the editor vim.")))
+
 (define-public vim-full
   (package
+    ;; This package should share its source with Vim, but it doesn't
+    ;; build reliably, and we want to keep Vim up to date due to the
+    ;; frequency of important bug fixes.
     (inherit vim)
     (name "vim-full")
     (arguments
@@ -132,12 +171,18 @@ configuration files.")
        ,@(substitute-keyword-arguments (package-arguments vim)
            ((#:phases phases)
             `(modify-phases ,phases
-               (add-after 'build 'drop-failing-tests
+               (add-before 'check 'skip-test87
+                 ;; This test fails for unknown reasons after switching
+                 ;; to a git checkout.
                  (lambda _
-                   ;; These tests fail mysteriously with GUI enabled.
-                   ;; https://github.com/vim/vim/issues/1460
-                   (substitute* "src/testdir/test_cmdline.vim"
-                     (("call assert_equal\\(.+getcmd.+\\(\\)\\)") ""))
+                   (delete-file "src/testdir/test87.ok")
+                   (delete-file "src/testdir/test87.in")
+                   (substitute* '("src/Makefile"
+                                  "src/testdir/Make_vms.mms")
+                     (("test87") ""))
+                   (substitute* "src/testdir/Make_all.mak"
+                     (("test86.out \\\\") "test86")
+                     (("test87.out") ""))
                    #t))
                (add-before 'check 'start-xserver
                  (lambda* (#:key inputs #:allow-other-keys)
@@ -149,7 +194,8 @@ configuration files.")
                                                     display " &")))))))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
-       ("xorg-server" ,xorg-server)))
+       ("xorg-server" ,xorg-server)
+       ,@(package-native-inputs vim)))
     (inputs
      `(("acl" ,acl)
        ("atk" ,atk)
@@ -430,19 +476,61 @@ trouble using them, because you do not have to remember each snippet name.")
       (home-page "https://github.com/Shougo/context_filetype.vim")
       (license license:expat)))) ; ??? check again
 
+(define-public vim-fugitive
+  (package
+    (name "vim-fugitive")
+    (version "2.5")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/tpope/vim-fugitive.git")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "17yz7gxn7a49jzndr4z5vnk1y4a6c22qss3mwxzmq4m46fni0k8q"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (vimfiles (string-append out "/share/vim/vimfiles"))
+                    (autoload (string-append vimfiles "/autoload"))
+                    (doc (string-append vimfiles "/doc"))
+                    (ftdetect (string-append vimfiles "/ftdetect"))
+                    (plugin (string-append vimfiles "/plugin")))
+               (copy-recursively "autoload" autoload)
+               (copy-recursively "doc" doc)
+               (copy-recursively "ftdetect" ftdetect)
+               (copy-recursively "plugin" plugin)
+               #t))))))
+    (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
+command window, where you can stage and review your changes before the next
+commit or run any Git arbitrary command.")
+    (license license:vim))) ; distributed under the same license as vim
+
 (define-public vim-airline
   (package
     (name "vim-airline")
-    (version "0.8")
+    (version "0.10")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/vim-airline/vim-airline/"
-                           "archive/v" version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://github.com/vim-airline/vim-airline")
+              (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "053sfq3jmgdc5y7zbg6jrk7r2hp0raj3y3mxa2h1c1bnkb6wvcaz"))))
+         "0k3c6p3xy6514n1n347ci4q9xjm9wwqirpdysam6f7r39crgmfhd"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f
@@ -512,10 +600,136 @@ and powerline symbols, etc.")
       (home-page "https://github.com/vim-airline/vim-airline-themes")
       (license license:expat))))
 
+(define-public vim-syntastic
+  (package
+    (name "vim-syntastic")
+    (version "3.9.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vim-syntastic/syntastic")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "121a1mxgfng2y5zmivyyk02mca8pyw72crivf4f1q9nhn0barf57"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (vimfiles (string-append out "/share/vim/vimfiles"))
+                    (doc (string-append vimfiles "/doc"))
+                    (plugin (string-append vimfiles "/plugin"))
+                    (autoload (string-append vimfiles "/autoload"))
+                    (syntax-checkers (string-append vimfiles "/syntax_checkers")))
+               (copy-recursively "doc" doc)
+               (copy-recursively "autoload" autoload)
+               (copy-recursively "plugin" plugin)
+               (copy-recursively "syntax_checkers" syntax-checkers)
+               #t))))))
+    (synopsis "Syntax checking plugin for Vim")
+    (description
+     "Vim-syntastic is a syntax checking plugin for Vim.  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.")
+    (home-page "https://github.com/vim-syntastic/syntastic")
+    (license license:wtfpl2)))
+
+(define-public editorconfig-vim
+  (package
+    (name "editorconfig-vim")
+    (version "0.3.3")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/editorconfig/editorconfig-vim.git")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "0vssfl1wjq0mv0p30c3dszwrh4yy90vwxmmdgqaxf5rykik7bdfd"))
+        (modules '((guix build utils)))
+        (snippet
+         '(begin
+            (delete-file-recursively "plugin/editorconfig-core-py") #t))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests? #f ; tests require ruby and plugin-test repository
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (add-after 'unpack 'patch-editorconfig-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((editorconfig (assoc-ref inputs "editorconfig-core")))
+               (substitute* "plugin/editorconfig.vim"
+                 (("/opt") editorconfig))
+               #t)))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (vimfiles (string-append out "/share/vim/vimfiles"))
+                    (doc (string-append vimfiles "/doc"))
+                    (plugin (string-append vimfiles "/plugin"))
+                    (autoload (string-append vimfiles "/autoload")))
+               (copy-recursively "doc" doc)
+               (copy-recursively "autoload" autoload)
+               (copy-recursively "plugin" plugin)
+               #t))))))
+    (inputs
+     `(("editorconfig-core" ,editorconfig-core-c)))
+    (home-page "https://editorconfig.org/")
+    (synopsis "EditorConfig plugin for Vim")
+    (description "EditorConfig makes it easy to maintain the correct coding
+style when switching between different text editors and between different
+projects.  The EditorConfig project maintains a file format and plugins for
+various text editors which allow this file format to be read and used by those
+editors.")
+    (license license:bsd-2)))
+
+(define-public neovim-syntastic
+  (package
+    (inherit vim-syntastic)
+    (name "neovim-syntastic")
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (vimfiles (string-append out "/share/nvim/site"))
+                    (doc (string-append vimfiles "/doc"))
+                    (plugin (string-append vimfiles "/plugin"))
+                    (autoload (string-append vimfiles "/autoload"))
+                    (syntax-checkers (string-append vimfiles "/syntax_checkers")))
+               (copy-recursively "doc" doc)
+               (copy-recursively "autoload" autoload)
+               (copy-recursively "plugin" plugin)
+               (copy-recursively "syntax_checkers" syntax-checkers)
+               #t))))))
+    (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")
-    (version "0.1.7")
+    (version "0.3.4")
     (source
      (origin
        (method url-fetch)
@@ -524,14 +738,22 @@ and powerline symbols, etc.")
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "0zjbpc4rhv5bcr353xqnbrc36zjvn7qvh8xf6s7n1bdi3788by6q"))))
+         "03mwfhr9rq86p8lypbdfyl7c7xyn6nzv2ipd8jc33bxzvs5i0hd6"))))
     (build-system cmake-build-system)
     (arguments
      `(#:modules ((srfi srfi-26)
                   (guix build cmake-build-system)
                   (guix build utils))
+       #:configure-flags '("-DPREFER_LUA:BOOL=YES")
        #:phases
        (modify-phases %standard-phases
+         ;; TODO: remove 'patch-tic on update
+         ;; see: https://github.com/neovim/neovim/issues/9687
+         (add-after 'unpack 'patch-tic
+           (lambda _
+             (substitute* "src/nvim/tui/tui.c"
+               (("value != NULL") "value != NULL && value != (char *)-1"))
+             #t))
          (add-after 'unpack 'set-lua-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (let* ((lua-version "5.2")
@@ -569,7 +791,7 @@ and powerline symbols, etc.")
      `(("pkg-config" ,pkg-config)
        ("gettext" ,gettext-minimal)
        ("gperf" ,gperf)))
-    (home-page "http://neovim.io")
+    (home-page "https://neovim.io")
     (synopsis "Fork of vim focused on extensibility and agility")
     (description "Neovim is a project that seeks to aggressively
 refactor Vim in order to:
@@ -587,31 +809,53 @@ refactor Vim in order to:
 (define-public vifm
   (package
     (name "vifm")
-    (version "0.8.2")
+    (version "0.10")
     (source
       (origin
         (method url-fetch)
-        (uri (string-append "mirror://sourceforge/vifm/vifm/vifm-"
-                            version ".tar.bz2"))
+        (uri (list
+               (string-append "https://github.com/vifm/vifm/releases/download/v"
+                              version "/vifm-" version ".tar.bz2")
+               (string-append "https://sourceforge.net/projects/vifm/files/vifm/"
+                              "vifm-" version ".tar.bz2")))
         (sha256
          (base32
-          "07r15kq7kjl3a41sd11ncpsii866xxps4f90zh3lv8jqcrv6silb"))))
+          "1f380xcyjnm4xmcdazs6dj064bwddhywvn3mgm36k7r7b2gnjnp0"))))
     (build-system gnu-build-system)
     (arguments
-    '(#:phases
+    '(#:configure-flags '("--disable-build-timestamp")
+      #:phases
       (modify-phases %standard-phases
         (add-after 'patch-source-shebangs 'patch-test-shebangs
           (lambda _
-            (substitute* (find-files "tests" "\\.c$")
-              (("/bin/sh") (which "sh")))
-            #t)))))
+            (substitute* (cons* "src/background.c"
+                                "src/cfg/config.c"
+                                (find-files "tests" "\\.c$"))
+              (("/bin/sh") (which "sh"))
+              (("/bin/bash") (which "bash")))
+            ;; This test segfaults
+            (substitute* "tests/Makefile"
+              (("misc") ""))
+            #t))
+         (add-after 'install 'install-vim-plugin-files
+           (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")))
+               (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")))
+             #t)))))
     (native-inputs
-     `(("groff" ,groff) ; for the documentation
-       ("perl" ,perl)))
+     `(("groff" ,groff))) ; for the documentation
     (inputs
      `(("libx11" ,libx11)
-       ("ncurses" ,ncurses)))
-    (home-page "http://vifm.info/")
+       ("ncurses" ,ncurses)
+       ("perl" ,perl)))
+    (home-page "https://vifm.info/")
     (synopsis "Flexible vi-like file manager using ncurses")
     (description "Vifm is a file manager providing a @command{vi}-like usage
 experience.  It has similar keybindings and modes (e.g. normal, command line,