Package Details: zsh-zim-git r588.de7d2b1-1

Git Clone URL: https://aur.archlinux.org/zsh-zim-git.git (read-only, click to copy)
Package Base: zsh-zim-git
Description: ZIM - Zsh IMproved
Upstream URL: https://github.com/zimfw/zimfw
Keywords: improved plugin theme vim zim zsh
Licenses: MIT
Submitter: ishitatsuyuki
Maintainer: carbolymer (Rhinoceros)
Last Packager: carbolymer
Votes: 19
Popularity: 0.000000
First Submitted: 2015-12-28 02:13
Last Updated: 2021-09-30 06:55

Pinned Comments

carbolymer commented on 2021-01-11 21:41

Ugh, it was a PITA to create this package. Please note that errors are silenced, so if you have any issues with zim, remove &>/dev/null from your /etc/zshrc - https://aur.archlinux.org/cgit/aur.git/tree/zshrc?h=zsh-zim-git&id=5a378e94d516c57d39629de545b78b0f020d86a4

I had to do it this way: $ZIM_HOME is only writable by root and zim constantly tries to update & recompile itself (=write to $ZIM_HOME), which results in permission errors when starting zsh as a normal user.

If you want to add/remove a module:

  1. Add a respective zmodule in /etc/zsh/zimrc
  2. Run as root: zimfw install && zsh

Latest Comments

1 2 3 4 5 6 ... Next › Last »

Rhinoceros commented on 2021-11-06 23:06

@carbolymer you likely saw it already, but just in case, upstream made some changes that might need this PKGBUILD to be modified.

Rhinoceros commented on 2021-09-30 07:04

Very strange. Originally it built fine on one of my systems, and another had the problem. However, when I tried to rebuild on the original system, it failed the second time. I also realised my minimal example was in zsh, but even testing with a clean bash shell using env -i bash --norc --noprofile, I still get the 1 exit code.

Thanks for the fix and the add.

carbolymer commented on 2021-09-30 06:57

@Rhinoceros, that's weird. I don't have this error, nor your minimal example with chmod and foo give me an error. I'm getting return code 0 even in bash. I've included your alternative chmod for the sake of compatibility.

Rhinoceros commented on 2021-09-29 11:16

Thanks for the fix.

I've run into another problem, which prevents the package from building:

patching file zimfw.zsh
Hunk #2 succeeded at 62 (offset 1 line).
Hunk #3 succeeded at 95 (offset 1 line).
==> ERROR: A failure occurred in package().
    Aborting...

It seems that the final chmod command has a non-zero exit code because of the symlinks at pkg/zsh-zim-git/usr/lib/zim/modules/zsh-syntax-highlighting/highlighters/*/README.md. Apparently chmod -R with symlinks fails!

$ mkdir dir
$ touch dir/foo
$ ln -s foo dir/bar
$ chmod -R u+rX,g+rX,o+rX dir
mode of 'dir' retained as 0755 (rwxr-xr-x)
neither symbolic link 'dir/bar' nor referent has been changed
mode of 'dir/foo' retained as 0644 (rw-r--r--)
$ echo $?
1

Weirdly I don't think this occurred all the time when building the package. Anyway, I managed to fix it by replacing the final chmod line with a command to ignore symlinks:

find "${ZIM_HOME}" ! -type l -execdir chmod u+rX,g+rX,o+rX {} \;

Rhinoceros commented on 2021-09-21 06:33

Upstream changed surrounding lines again. Here is an updated zimfw.zsh.patch.

--- zimfw.zsh   2021-09-21 16:26:34.034179638 +1000
+++ zimfw.zsh   2021-09-21 16:30:58.546504098 +1000
@@ -53,10 +53,6 @@

 _zimfw_build_init() {
   local -r ztarget=${ZIM_HOME}/init.zsh
-  # Force update of init.zsh if it's older than .zimrc
-  if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
-    command mv -f ${ztarget}{,.old} || return 1
-  fi
   _zimfw_mv =(
     print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
     print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
@@ -65,16 +61,13 @@
     if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}}
     print -R ${(F)_zcmds#${~zpre}}
   ) ${ztarget}
+  chmod -R u+rX,g+rX,o+rX "${ZIM_HOME}" &>/dev/null
 }

 _zimfw_build_login_init() {
   # Array with unique dirs. ${ZIM_HOME} or any subdirectory should only occur once.
   local -Ur zscriptdirs=(${ZIM_HOME} ${${_zdirs##${ZIM_HOME}/*}:A})
   local -r zscriptglob=("${^zscriptdirs[@]}/(^*test*/)#*.zsh(|-theme)(N-.)") ztarget=${ZIM_HOME}/login_init.zsh
-  # Force update of login_init.zsh if it's older than .zimrc
-  if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
-    command mv -f ${ztarget}{,.old} || return 1
-  fi
   _zimfw_mv =(
     print -Rn "() {
   setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB
@@ -101,6 +94,7 @@
 } \"\${@}\"
 "
   ) ${ztarget}
+  chmod -R u+rX,g+rX,o+rX "${ZIM_HOME}" &>/dev/null
 }

 _zimfw_build() {

carbolymer commented on 2021-08-10 06:45

@Rhinoceros, thanks for the fix! I've updated the package (I've also removed patch file copying as it's really not needed).

Rhinoceros commented on 2021-07-28 06:49

Oops, my mistake; I got confused. Upstream just modified surrounding lines. Here is an updated zimfw.zsh.patch that works.

--- zimfw.zsh   2021-07-28 16:45:25.000000000 +1000
+++ zimfw.zsh   2021-07-28 16:45:25.000000000 +1000
@@ -52,26 +52,19 @@

 _zimfw_build_init() {
   local -r ztarget=${ZIM_HOME}/init.zsh
-  # Force update of init.zsh if it's older than .zimrc
-  if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
-    command mv -f ${ztarget}{,.old} || return 1
-  fi
   _zimfw_mv =(
     print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
     if (( ${#_zfpaths} )) print -R 'fpath=('${_zfpaths:A}' ${fpath})'
     if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions}
     print -R ${(F)_zcmds}
   ) ${ztarget}
+  chmod -R u+rX,g+rX,o+rX "${ZIM_HOME}" &>/dev/null
 }

 _zimfw_build_login_init() {
   # Array with unique dirs. ${ZIM_HOME} or any subdirectory should only occur once.
   local -Ur zscriptdirs=(${ZIM_HOME} ${${_zdirs##${ZIM_HOME}/*}:A})
   local -r zscriptglob=("${^zscriptdirs[@]}/(^*test*/)#*.zsh(|-theme)(N-.)") ztarget=${ZIM_HOME}/login_init.zsh
-  # Force update of login_init.zsh if it's older than .zimrc
-  if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
-    command mv -f ${ztarget}{,.old} || return 1
-  fi
   _zimfw_mv =(
     print -Rn "() {
   setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB
@@ -98,6 +91,7 @@
 } \"\${@}\"
 "
   ) ${ztarget}
+  chmod -R u+rX,g+rX,o+rX "${ZIM_HOME}" &>/dev/null
 }

 _zimfw_build() {

Rhinoceros commented on 2021-07-19 10:00

package() is failing for me.

patching file zimfw.zsh
Hunk #2 FAILED at 66.
Hunk #3 succeeded at 95 (offset -1 lines).
1 out of 3 hunks FAILED -- saving rejects to file zimfw.zsh.rej

Looks like this part of zimfw.zsh.patch is no longer needed, as upstream has already incorporated it:

-  # Force update of init.zsh if it's older than .zimrc
-  if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
-    command mv -f ${ztarget}{,.old} || return 1
-  fi

(Also, out of interest, why do you copy the patch before applying it, then delete it? You could always just apply it where it is.)

carbolymer commented on 2021-01-26 17:24

@Rhinoceros, thanks for debugging and reporting it here! You're right, it is imported twice. I've removed unnecessary line from zshrc:

source ${ZIM_HOME}/init.zsh &>/dev/null

In my opinion this /usr/lib/zim/templates/zshrc works fine, I took it from zimfw repo (which recommends it for enabling zim).

Rhinoceros commented on 2021-01-25 06:14

Ah, so modules are being sourced twice because /etc/zsh/zshrc contains two lines

source ${ZIM_HOME}/templates/zshrc &>/dev/null
source ${ZIM_HOME}/init.zsh &>/dev/null

but /usr/lib/zim/templates/zshrc also contains source ${ZIM_HOME}/init.zsh. I'm not sure if this is an error from upstream? I also had a look through /usr/lib/zim/templates/zshrc, and it had a bunch of options in there that I overwrite in ~/.zshrc anyway. It also contained the very nasty HIST_IGNORE_ALL_DUPS, which wrecked my history file! I just removed the first line in /etc/zsh/zshrc and replaced it with

source ${ZIM_HOME}/zimfw.zsh init -q &>/dev/null

This seems to work fine.