Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh: command not found: xit #1

Closed
yang-ling opened this issue Dec 25, 2014 · 4 comments
Closed

zsh: command not found: xit #1

yang-ling opened this issue Dec 25, 2014 · 4 comments

Comments

@yang-ling
Copy link
Contributor

I got this error when I use this plugin.
xit

I have tried to fix it. In safekill.sh

elif [[ "$pane_proc" == "bash" ]] || [[ "$pane_proc" == "zsh" ]]; then
cmd='C-c "exit" Enter'

I changed it to

elif [[ "$pane_proc" == "bash" ]] || [[ "$pane_proc" == "zsh" ]]; then
cmd='C-c C-u "exit" Enter'

And everything goes well.

I also tried to change it to

elif [[ "$pane_proc" == "bash" ]] || [[ "$pane_proc" == "zsh" ]]; then
cmd='C-c " exit" Enter'

An extra space is added before exit. In this case, no error happens but I need execute C twice to completely kill the session.
Currently I don't know the reason.

In one word, cmd='C-c C-u "exit" Enter' solves my problem. But I don't know whether it is an elegant solution.

My environment information:

  • Archlinux
  • Zsh 5.0.7
  • byobu 5.74
  • tmux 1.9a
  • tmuxinator 0.6.8
@jhenriquez
Copy link

@yang-ling I don't know what the C-u does but I don't think that is necessary. If you're already on bash (in my case) you only need to type exit.

If your terminal needs any special inputs for exiting, I would probably add a separate if for it.

@jlipps I was experiencing this same problem out of the box (having to run the command multiple times), is there a particular reason to try C-c before typing exit on the shell?

This is how my modified version looks right now and it's working beatifully! Also, thanks @jlipps this is great!

function safe_end_procs {
    old_ifs="$IFS"
    IFS=$'\n'
    panes=$(tmux list-panes -s -F "#{pane_id} #{pane_current_command}")
    for pane_set in $panes; do
        pane_id=$(echo "$pane_set" | awk -F " " '{print $1}')
        pane_proc=$(echo "$pane_set" | awk -F " " '{print tolower($2)}')
        cmd="C-c"
        if [[ "$pane_proc" == "vim" ]]; then
            cmd='":qa" Enter'
        elif [[ "$pane_proc" == "man" ]] || [[ "$pane_proc" == "less" ]]; then
            cmd='"q"'
        elif [[ "$pane_proc" == "bash" ]] || [[ "$pane_proc" == "zsh" ]] || [[ "$pane_proc" == "fish" ]]; then
            cmd='"exit" Enter'
        elif [[ "$pane_proc" == "ssh" ]]; then
            cmd='Enter "~."'
        fi
        echo $cmd | xargs tmux send-keys -t "$pane_id"
    done
    IFS="$old_ifs"
}

@yang-ling
Copy link
Contributor Author

@jhenriquez C-u clears the command line. It has no side effect and can make sure the command line is empty before typing exit

@jhenriquez
Copy link

Oh! It makes sense now. I still don't think the C-c is needed if I'm
following the script along. It's working fine for me without it, though.
There might be cases I assume :)

Thanks @yang-ling!

On Wed, Aug 26, 2015, 9:43 PM SpicyCat notifications@github.com wrote:

@jhenriquez https://github.com/jhenriquez C-u clears the command line.
It has no side effect and can make sure the command line is empty before
typing exit


Reply to this email directly or view it on GitHub
#1 (comment).

@jlipps
Copy link
Owner

jlipps commented Aug 27, 2015

I'd merge this as a PR @yang-ling! Agree with @jhenriquez I'm not sure if we still need the "C-c" (maybe I was being overly protective?) but there may have been a good reason it's there so I'm fine keeping it.

@jlipps jlipps closed this as completed in cafa9d7 Oct 20, 2016
jlipps added a commit that referenced this issue Oct 20, 2016
Another try at "xit not found" error (fix #1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants