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 integration #44

Open
utdemir opened this issue Jul 22, 2019 · 3 comments
Open

ZSH integration #44

utdemir opened this issue Jul 22, 2019 · 3 comments
Labels
pure ❤️ Uh, oh, just... awesome

Comments

@utdemir
Copy link

utdemir commented Jul 22, 2019

This is not an issue per se, but I wrote a small zsh function to integrate up:

zle-upify() {
    buf="$(echo "$BUFFER" | sed 's/[ |]*$//')"
    tmp="$(mktemp)"
    eval "$buf |& up --unsafe-full-throttle -o '$tmp' 2>/dev/null"
    cmd="$(tail -n +2 "$tmp")"
    rm -f "$tmp"
    BUFFER="$BUFFER | $cmd"
    zle end-of-line
}
zle -N zle-upify

bindkey '^U' zle-upify

If you add this to your zshrc, Ctrl+U will run up passing the current commands output, and when you exit up with Ctrl+X, the result will replace current prompt. It's slightly easier than dealing with upN.sh files.

It was quite useful for me, I'm just sharing this so maybe you'd like to put it to README.md or somewhere people can find out.

@kakulukia
Copy link

awesome! thx @utdemir

@akavel akavel added the pure ❤️ Uh, oh, just... awesome label Mar 3, 2020
@chrisgrieser
Copy link

this is fantastic and makes this up so much more convenient, even. It should really be added to the README for people to find more easily.

@utdemir
Copy link
Author

utdemir commented Jun 1, 2022

I'm glad you liked it @chrisgrieser !

I created a new GitHub project with it: utdemir/zsh-up. So now:

  • It can be used with ZSH plugin managers like antigen or zplug without having to copy-paste code.
  • It should be easier to link from the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pure ❤️ Uh, oh, just... awesome
Projects
None yet
Development

No branches or pull requests

4 participants