Package Details: zsh-zim-git r682.84c59ed-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: 18
Popularity: 0.000000
First Submitted: 2015-12-28 02:13 (UTC)
Last Updated: 2024-10-10 07:25 (UTC)

Dependencies (4)

Required by (1)

Sources (5)

Pinned Comments

carbolymer commented on 2021-01-11 21:41 (UTC) (edited on 2021-01-22 07:46 (UTC) by carbolymer)

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

« First ‹ Previous 1 2 3 4 5 6 7 8 .. 10 Next › Last »

Rhinoceros commented on 2021-09-21 06:33 (UTC)

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 (UTC)

@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 (UTC)

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 (UTC)

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 (UTC)

@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 (UTC)

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.

Rhinoceros commented on 2021-01-24 07:03 (UTC)

No worries @carbolymer. Thanks for the hint. That works great! One other thing is still bugging me… any idea how to stop (e.g.) /usr/lib/zim/modules/environment/init.zsh being sourced twice with each new terminal?

carbolymer commented on 2021-01-22 07:50 (UTC)

@Rhinoceros Sorry, I've made a mistake in the patch, I forgot to make chmod run recursively. Now the rights should be correct. Regarding adding/removing modules, you can add/remove them to /etc/zsh/zimrc. I've added steps to my pinned comment.

Rhinoceros commented on 2021-01-22 07:09 (UTC) (edited on 2021-01-24 07:09 (UTC) by Rhinoceros)

Ugh… I've spent another few hours trying to figure out how to specify what modules are loaded. At the moment, some are loaded twice. e.g. edit /usr/lib/zim/modules/environment/init.zsh and put echo foo at the top, and a new terminal will show foo twice. I also want to disable some, e.g. git. I couldn't see zmodule git in any of the installed files, but there are a few references to git in /usr/lib/zim/init.zsh. Just to test, I removed these references, then did the mandatory touch ~/.zimrc as before. I also noticed that /usr/lib/zim/init.zsh is owned by root:root with 600 permissions, so to avoid errors I had to make it 644 instead (is that a bug?). This seemed to work, in that the git module was no longer active.

1) What is the best way to load/unload modules?

2) Is the fact that /usr/lib/zim/init.zsh is not user-readable correct?

Rhinoceros commented on 2021-01-15 07:42 (UTC)

Thanks again @carbolymer for your continued assistance. I can appreciate that this is a very fiddly package, so thanks for staying with it.

Your suggestion for zshmarks works perfectly. This command modifies /usr/lib/zim/init.zsh. I feel like it may be better to modify a user-owned file, but I think by default there is only one init.zsh. I can see /usr/lib/zim/init.zsh is sourced by /etc/zsh/zshrc. I wonder if a better solution is for users to copy init.zsh to somewhere in their home directory, with /etc/zsh/zshrc sourcing this file instead? I guess since /etc/zsh/zshrc is in the PKGBUILD's backup array, users can always do this themselves. Or is it better for the PKGBUILD to do this? I haven't delved too deeply in it, but a possible positive of making init.zsh (and other things?) is that there will be no errors? But a possible negative is that zimfw might try to automatically update (although this could be disabled by default).