Fasd: Doesn't work under midnight commander

Created on 22 Sep 2014  ·  6Comments  ·  Source: clvv/fasd

I tried jumping back into the shell from mc (using c-o) and then fasd:

$ z 32
fasd:4: unknown file attribute: _

Most helpful comment

I solve this with _fasd_preexec () redefinition. Regards @fcelda

in your .zshrc

if ps $PPID |grep -q mc; then
    _fasd_preexec () {
        fasd --proc "$(fasd --sanitize "$1")"
    }
endif

Also you may partially fix it if you redefine fasd_cd with full path to fasd executable. So you will have only fasd function broken. And all your aliases like z, zz will work.

P.S. Do we need this info in README.md?

All 6 comments

I encountered the same problem. From some reason, there is a fasd() function defined in the MC terminal. I don't know how it got there.

% which fasd
fasd () {
    pwd 7 kill -STOP precmd_functions+=(_mc_precmd)
}

Removing the function fixes the problem:

% unset -f fasd
% which fasd
/usr/bin/fasd
% z tmp <tab>
/tmp  /home/fcelda/tmp

It seems that the _fasd_preexec hook conflicts with _mc_precmd hook. I was able to find a workaround.

This is the current fasd hook:

% which _fasd_preexec 
_fasd_preexec () {
    {
        eval "fasd --proc $(fasd --sanitize $1)"
    } >> "/dev/null" 2>&1
}

And this is the MC hook:

% which _mc_precmd 
_mc_precmd () {
    pwd >&7
    kill -STOP $$
}

I made it work by eliminating the debugging in _fasd_preexec:

% which _fasd_preexec
_fasd_preexec () {
    fasd --proc "$(fasd --sanitize "$1")"
}

I'm not sure how to fix this problem properly. Replacing braces with parenthesis worked as well, but I'm not sure if running a sub-shell is desired.

Just encountered the same problem. Tried to redefine _fasd_preexec without success.

I solve this with _fasd_preexec () redefinition. Regards @fcelda

in your .zshrc

if ps $PPID |grep -q mc; then
    _fasd_preexec () {
        fasd --proc "$(fasd --sanitize "$1")"
    }
endif

Also you may partially fix it if you redefine fasd_cd with full path to fasd executable. So you will have only fasd function broken. And all your aliases like z, zz will work.

P.S. Do we need this info in README.md?

@ezh I think it will be nice to have this in ReadMe.

this error welcomes me on every platform possible so i started avoiding the completion. it should be added in Readme. Nice to have the fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sindresorhus picture sindresorhus  ·  11Comments

rendybjunior picture rendybjunior  ·  14Comments

pearofducks picture pearofducks  ·  7Comments

sbglasius picture sbglasius  ·  5Comments

josephholsten picture josephholsten  ·  15Comments