You can type characters literally by using

the "lnext" functionality (often ^V per default) in your tty driver

However, I bind Ctrl+v to "paste" in my terminal emulator. (Since I don't use control flow) I'd like to rebind lnext to Ctrl+q. I tried the following in ~/.zshrc

setopt noflowcontrol  # Don't use ^s and ^q for control flow
bindkey -r "^Q"       # Unbind ^q from push-line
stty lnext '^Q'       # Bind ^q to lnext

However, it doesn't seem to work. Is there a way to rebind lnext to Ctrl+q?


I've done more troubleshooting, and can't seem to rebind other stty keys. I removed setopt noflowcontrol for testing, then tried stty start '^A' or stty start '^B'. Neither had any effect; start was still bound to Ctrl+q. (FWIW I tried both a literal ^A or ^B and the character itself with lnext preceding it.)

  • 1
    You forgot to use stty to rebind the start character. Sep 20, 2016 at 10:53
  • @ThomasDickey I don't need a start character because I turned off control flow, but do you mean that ^q can only have one function, and I need to unbind it from start? If so, I just tried stty start '^A' before stty lnext '^Q', but it still fails.
    – Sparhawk
    Sep 20, 2016 at 12:17
  • @ThomasDickey Hmm… I troubleshooted a bit more. I've edited the question. Other stty rebinding fails too.
    – Sparhawk
    Sep 20, 2016 at 12:32

1 Answer 1


stty lnext only affects the terminal device line discipline internal editor (the very limited one you get when running applications like cat that don't have their own line editor). For zsh's editor, you'd need to use bindkey (zle does not do like readline (bash's line editor) that queries the tty LD setting to do the same in its own editor).

stty lnext '^Q' start '' -ixon # for tty LD editor
bindkey '^Q' quoted-insert     # for zle

Note that you'd need to do the stty part for every terminal, and do it again any time the tty LD settings are reverted to defaults like after stty sane.

Some systems allow you do change the default tty settings like HPUX with stty lnext '^Q' < /dev/ttyconf.

And for ^V to paste the content of the X11 CLIPBOARD selection at the cursor when in the zsh line editor:

get-clipboard() {
  local clip
  clip=$(xclip -sel c -o 2> /dev/null && echo .) || return
zle -N get-clipboard
bindkey '^V' get-clipboard
  • Thank you, works perfectly! FWIW the ^v code works fine locally, but I prefer using the terminal emulator's ctrl+v function, because otherwise it wouldn't work in ssh sessions. Unfortunately there are only a few emulators that provide that allow setting ^v for paste and ^c for copy (e.g. terminator).
    – Sparhawk
    Sep 21, 2016 at 0:14
  • Should we keep stty ... lines in .zshrc or .zshenv?
    – alper
    Aug 11, 2021 at 13:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .