From 2cb00a93974f7efc7891e8f77fff1a3d96c7f692 Mon Sep 17 00:00:00 2001 Message-Id: <2cb00a93974f7efc7891e8f77fff1a3d96c7f692.1632651051.git.public@yoctocell.xyz> From: Alexandr Vityazev Date: Mon, 20 Sep 2021 23:03:29 +0000 Subject: [PATCH] gnu: Add zsh-syntax-highlighting. * gnu/packages/shellutils.scm (zsh-syntax-highlighting): New variable. Co-authored-by: Xinglu Chen --- gnu/packages/shellutils.scm | 56 ++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm index 94b5536df7..8726020ab3 100644 --- a/gnu/packages/shellutils.scm +++ b/gnu/packages/shellutils.scm @@ -10,6 +10,8 @@ ;;; Copyright © 2020 aecepoglu ;;; Copyright © 2020 Dion Mendel ;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2021 Alexandr Vityazev +;;; Copyright © 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -46,7 +48,8 @@ (define-module (gnu packages shellutils) #:use-module (gnu packages readline) #:use-module (gnu packages ruby) #:use-module (gnu packages shells) - #:use-module (gnu packages tmux)) + #:use-module (gnu packages tmux) + #:use-module (ice-9 regex)) (define-public boxes (package @@ -138,6 +141,57 @@ (define-public zsh-autosuggestions as you type.") (license license:expat))) +(define-public zsh-syntax-highlighting + (package + (name "zsh-syntax-highlighting") + (version "0.7.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/zsh-users/zsh-syntax-highlighting") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "039g3n59drk818ylcyvkciv8k9mf739cv6v4vis1h9fv9whbcmwl")))) + (build-system gnu-build-system) + (native-inputs + `(("zsh" ,zsh))) + (arguments + ;; FIXME: Tests fail when running test regexp + ;; there is no pcre module in the Guix zsh package + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'unpack 'patch-paths + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (substitute* "Makefile" + (("/usr/local") out) + ((,(regexp-quote "share/$(NAME)")) "share/zsh/plugins/$(NAME)"))))) + (add-after 'patch-paths 'make-writable + (lambda _ + (for-each make-file-writable + '("docs/highlighters.md" + "README.md")))) + (add-before 'build 'add-all-md + (lambda _ + (invoke "make" "all"))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "make" "test") + (invoke "make" "perf"))))))) + (home-page "https://github.com/zsh-users/zsh-syntax-highlighting") + (synopsis "Fish shell-like syntax highlighting for Zsh") + (description + "This package provides syntax highlighting for Zsh. It enables +highlighting of commands whilst they are typed at a Zsh prompt into an +interactive terminal. This helps in reviewing commands before running them, +particularly in catching syntax errors.") + (license license:bsd-3))) + (define-public sh-z (package (name "sh-z") base-commit: c1bc2a43200d6c6016c2a4154799c73c86a54021 -- 2.33.0