Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add-zsh-hook: function definition file not found #748

Closed
wazum opened this Issue · 31 comments
@wazum

hiya!
after the last update I get

/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found

kind regards
Wolfgang

@oshovah

Same here

@leoncamel

It seems add-zsh-hook was added since version 4.3.4. So, I am planning to upgrade zsh here.

@tjkirch

Same problem here with zsh 4.2.6. Unfortunately I can't upgrade the version on some hosts I use.

@robraux

I have the same issue, and didn't have any problem with reverting the file back to it's original version (at least none that I am aware of after using it for a few hours).

https://github.com/robbyrussell/oh-my-zsh/blob/e3cede37a0ac1ef427fb07b6f79839b8c6a64780/lib/termsupport.zsh

@iveney

Same here with zsh 4.3.10. This should be fixed as the zsh is still old version in many of the servers.

@febs

Agree.

@zalew

same here. le fu.

@sorin-ionescu fork also doesn't solve it on 4.3.2

@sorin-ionescu

@zalew How can my fork solve it when the minimum supported version of OMZ is 4.3.10?

@zalew

because you mentioned this issue in your comment as fixed. "The following issues have been fixed in my fork. [...] #748" so I assumed you did the backward compatibility or sth. sorry.

@sorin-ionescu

My comment was in reference to failing to load the hook, not on the hook missing at all.

@ptheofan

Same issue here on Centos

@deepflame

yeah, same here with 4.2.6 on CentOS. Would be great if this would be fixed...

@socketwiz

Same here on SmartOS: http://smartos.org/

SunOS b3ac5f25-22a4-41d3-87c8-d0a60456be5f.local 5.11 joyent_20130405T010449Z i86pc i386 i86pc Solaris

/root/.oh-my-zsh/lib/termsupport.zsh:34: add-zsh-hook: function definition file not found
/root/.oh-my-zsh/lib/termsupport.zsh:35: add-zsh-hook: function definition file not found
@adamatan

Same on rhel6:

/home/adamatan/.oh-my-zsh/lib/termsupport.zsh:34: add-zsh-hook: function definition file not found
/home/adamatan/.oh-my-zsh/lib/termsupport.zsh:35: add-zsh-hook: function definition file not found
@Conxz

Same on CentOS 5.7
add-zsh-hook: function definition file not found

@Janfy

Same on RHEL 5.5 / ZSH 4.2.6

@ravenoak

Getting the same error using zsh 4.3.12

@omidnoorani

Getting the same error on a brand new install on CentOS 5.9:

.oh-my-zsh/lib/termsupport.zsh:36: add-zsh-hook: function definition file not found
.oh-my-zsh/lib/termsupport.zsh:37: add-zsh-hook: function definition file not found

@rickybscs

On RHEL 5, just installed. When opening a terminal I get

~/.oh-my-zsh/lib/termsupport.zsh:36: add-zsh-hook: function definition file not found
~/.oh-my-zsh/lib/termsupport.zsh:37: add-zsh-hook: function definition file not found

ZSH version
zsh 4.3.12 (x86_64-unknown-linux-gnu)

@mcornella

According to zsh's git repository, add-zsh-hook was added in version 4.3.4, all subsequent versions should work fine. If that's not your case drop me a hint.

For the rest, I think you should be able to add a hook without that function. Replace these lines in lib/termsupport.zsh

autoload -U add-zsh-hook
add-zsh-hook precmd  omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec

with these lines:

precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

If that works and doesn't break anything I'll submit a PR.

@robbyrussell robbyrussell added the Bug label
@mztriz

Same issue with RHEL 5.6
myserver~ # zsh --version
zsh --version
zsh 4.2.6 (x86_64-redhat-linux-gnu)

@mcornella adding those lines has appeared to fix it.

@rfoust

@mcornella - that seemed to fix the error for me, thanks.

@mcornella

Cool! Still, there are other plugins that rely on add-zsh-hook too, I'll make sure all of them are compatible in this case.

@ChinaXing

precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

works

@marc3ll1nux
@zimbatm zimbatm referenced this issue in zimbatm/direnv
Closed

Use add-zsh-hook #138

@jingweno

I just hit this issue with RHEL 5:

~  zsh --version
zsh 4.2.6 (x86_64-redhat-linux-gnu)

I follow the fixes by @mcornella and it werks. But this cause local changes and blocks upgrade_oh_my_zsh. Should it be patched into master? I could help.

@jingweno jingweno referenced this issue from a commit in jingweno/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
dc9e176
@merwan merwan referenced this issue from a commit in merwan/oh-my-zsh
@merwan merwan Fix the "command not found: add-zsh-hook" error
Apply the same fix as for #748
adb9c3f
@harlanji harlanji referenced this issue from a commit in harlanji/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
d84a647
@zztczcx

Replace these lines in lib/termsupport.zsh

autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
with these lines:

precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

it make some theme donot work , for example : pygmalion. I think not replace just add it below, is ok

@diraulo

Also had the same issue as @zztczcx with the pygmalion theme. Added those lines back and it fixed it.

@jingweno

@zztczcx @diraulo Are there any other solutions other than using add-zsh-hook?

@hoggarth hoggarth referenced this issue from a commit in hoggarth/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
8379783
@swanandp swanandp referenced this issue from a commit in swanandp/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
e84c6eb
@ArjenSchwarz ArjenSchwarz referenced this issue from a commit in ArjenSchwarz/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
c636fd2
@mbologna mbologna referenced this issue from a commit
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See #748. This patch pulls in the changes suggested in #748 (comment) by @mcornella and I have tested it on RHEL 5.
9c93dff
@Stibbons Stibbons referenced this issue from a commit in Stibbons/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
c6f46c2
@lewg lewg referenced this issue from a commit in lewg/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
183d323
@jefflance jefflance referenced this issue from a commit in jefflance/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
b7bf7e2
@ajordens ajordens referenced this issue from a commit in ajordens/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
6233987
@liang8305 liang8305 referenced this issue from a commit in liang8305/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
585d2eb
@noj noj referenced this issue from a commit in noj/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
d185e38
@kogakure kogakure referenced this issue from a commit in kogakure/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
4230742
@benjaoming benjaoming referenced this issue from a commit in benjaoming/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
82def2e
@trynity trynity referenced this issue from a commit in trynity/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
b8b8de4
@devnall devnall referenced this issue from a commit in devnall/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
4f86b7e
@guneysus guneysus referenced this issue from a commit in guneysus/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
b612a72
@kenton kenton referenced this issue from a commit in kenton/oh-my-zsh
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
f0fd4a6
@kiwiupover kiwiupover referenced this issue from a commit in kiwiupover/dot-files
@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell/oh-my-zsh#748. This patch pulls in the changes suggested in robbyrussell/oh-my-zsh#748 (comment) by @mcornella and I have tested it on RHEL 5.
b3eef4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.