DEV Community

Discussion on: Passing a parameter to a zsh keyboard-shortcut

Collapse
 
riscie profile image
riscie

Thats a really nice usecase! Thank you too for sharing it.

Collapse
 
jesusgollonet profile image
jesús gollonet

btw, the code in your example doesn't display any output for me. The branch gets created but I can't see the output from echo or git checkout. After some googling I suspect it might have to do with using a multiline prompt.

for some reason that I don't fully understand, adding a newline after git checkout makes it display for me:

function featbranch() {
    branch_name=$BUFFER
    zle backward-kill-line
    echo "git checkout -b feat/$branch_name"
    git checkout -b "feat/${branch_name}"
    echo "\n" #¯\_(ツ)_/¯
    zle reset-prompt
    zle redisplay
}
Thread Thread
 
riscie profile image
riscie

Thanks for the follow up!

    echo "\n" #¯\_(ツ)_/¯

🤷‍♂️😂