lf: lfcd not working

Hi,

I tried the lfcd.sh in the tutorial but it’s not working for me. When I navigate to another folder and press “q”, lfcd came back to my original folder. I’m using lfcd on Mac OS X Catalina with iTerm 2, zsh 5.8

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (3 by maintainers)

Most upvoted comments

@gokcehan yeah that worked! I finally found the culprit. For people with this issue here’s what I did:

  1. I changed the script to use command cat instead of cat. I’m not sure why this worked, but probably some oh-my-zsh plugins were changing the cat alias:

lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(command cat "$tmp")"
        rm -f "$tmp"
        if [ -d "$dir" ]; then
            if [ "$dir" != "$(pwd)" ]; then
                cd "$dir"
            fi
        fi
    fi
}
  1. I remove the following line from my lfrc. I’m not sure why I initially copied this line to lfrc. Maybe while figuring out why the issue happened, I copied pasted it from somewhere:
push mw
map q push 'w:quit<enter>
map Q push :quit<enter>

Thanks @gokcehan and @hackedWifi for helping me out. Sorry for wasting the time. If possible can you use maybe “command cat” instead of “cat” in the lfcd.sh script? Or maybe adding a note warning oh-my-zsh users? Thanks!