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

Incompatibility with "z" #20

Closed
shpoont opened this issue Dec 5, 2015 · 10 comments
Closed

Incompatibility with "z" #20

shpoont opened this issue Dec 5, 2015 · 10 comments

Comments

@shpoont
Copy link

shpoont commented Dec 5, 2015

Steps to reproduce:

  1. Install "z" from https://github.com/rupa/z
  2. Source "z" before "bash-preexec"
  3. Start new shell session

Actual result:

  1. The precmd function is executed
  2. The preexec function is executed with last command from history

Expected result:

  1. The precmd function is executed
@rcaloras
Copy link
Owner

rcaloras commented Dec 6, 2015

@shpoont thanks for opening the issue and using bash-preexec! Noticed you added it to brew and used it as a requirement for your project :D

I'm unable to reproduce this issue with master, so maybe it's due to bugs in v2.2. I'll cut 2.3 for you now.

@rcaloras
Copy link
Owner

rcaloras commented Dec 6, 2015

Just cut 0.2.3 can you give that a try and see if that's working?

@shpoont
Copy link
Author

shpoont commented Dec 7, 2015

Hi, I still have the same problem on 0.2.3

@rcaloras
Copy link
Owner

rcaloras commented Dec 7, 2015

I'm unable to reproduce on OS X or Linux. Bash Versions 3.2 and 4.3 respectively.

~/.bash_profile looks like:

source ~/git/z/z.sh
source ~/git/bash-preexec/bash-preexec.sh

preexec() { echo "just typed $1"; }
precmd() { echo "printing the prompt"; }

Opening a new terminal window:

Last login: Sun Dec  6 19:08:06 on ttys006
printing the prompt
19:11:13-rcaloras-~/git/z (master)$ 

PROMPT_COMMAND looks like this:

19:12:00-rcaloras-~/git/z (master)$ echo "$PROMPT_COMMAND"
__bp_precmd_invoke_cmd; update_terminal_cwd; 
_z --add "$(command pwd -P 2>/dev/null)" 2>/dev/null; __bp_interactive_mode;

What's your PROMPT_COMMAND look like?

@rcaloras
Copy link
Owner

rcaloras commented Dec 7, 2015

Alternatively _z could be invoked via precmd() or preexec() which would avoid empty returns.

@rcaloras
Copy link
Owner

rcaloras commented Dec 7, 2015

FYI there was a similar issue a little while back, but it was just a sourcing problem. So some other folks have been able to use these together successfully :) #4

@rcaloras
Copy link
Owner

rcaloras commented Dec 7, 2015

Perhaps bash-preexec is not the last thing sourced in your config file. __bp_interactive_mode needs to be the last thing in your PROMPT_COMMAND

@rcaloras
Copy link
Owner

rcaloras commented Dec 9, 2015

@shpoont any luck?

@shpoont
Copy link
Author

shpoont commented Dec 11, 2015

Hey @rcaloras I just checked again and it seems to be ok with the latest version. Also I am able to run powerline after bash-preexec and it works fine, just fyi ;)

Thanks for your help!

@shpoont shpoont closed this as completed Dec 11, 2015
@rcaloras
Copy link
Owner

@shpoont great good to hear!

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

2 participants