Jump to content

Problem with snippets in Zsh

Recommended Posts

I recently changed my shell from bash to zsh. I have lots of snippets for terminal use that ends with a line break. With bash that snippets works fine, I meant, paste the command and execute it (as ends with a line break).


The point is that in zsh, doesn't work as I expected. The snippets paste the code and add a line break, but without executing the command. Is there any way of fixing this?



Share this post

Link to post

@jaherran I'm guessing that this may be zsh interpreting the line break differently, similar to using return vs. alt+return. In Terminal/bash, this doesn't make any difference, you may be able to configure zsh to do the same?

Share this post

Link to post
Posted (edited)
20 hours ago, Andrew said:

I'm guessing that this may be zsh interpreting the line break differently


It's a paste thing. ZSH is smart enough to recognise when you paste something into the shell and inserts it literally instead of interpreting it as keystrokes (allowing you to insert tabs or newlines into input easily).


@jaherran You need to put unset zle_bracketed_paste in your ~/.zshrc file, and then ZSH will treat newlines in your snippets as if you were pressing ↩.

Edited by deanishe

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...