Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh Issue - "!~ " character is not pasted into shell, insted I get "~/.ssh/config"

On Sep 21,  4:27pm, Xavier Martinez Serrano wrote:
} I'm using zsh 4.3.17 (x86_64-unknown-linux-gnu)" version
} and when I was developing some small awk codes, I tried to paste
} them to the terminal, but when I used the operator "!~ " I realised
} that, when pasting, zsh translated it to "~/.ssh/config". Quite annoying

"!" is the history reference character, so !~ means to search for a
history event beginning with a tilde and substitute that event into
the command at that position.

Apparently somewhere in your command history you typed ~/.ssh/config
at the beginning of a line, and now !~ is finding that as the history
event to substitute.

You can "setopt NO_BANG_HIST" to disable this, or you can use single
quotes '!~' to prevent the expansion (double quotes permit it).

It's additinally possible that your /etc/z* files or some other init
file have attached the magic-space widget to the space character.
This causes !-history references to IMMEDIATELY expand when followed
by a space, even a space originating from copy-paste (at your version
number; behavior of paste has changed in very recent zsh).

Messages sorted by: Reverse Date, Date, Thread, Author