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

Re: Convert control characters to bindkey/quoted-insert -style escape sequences



On Wed, Jan 24, 2024 at 5:36 AM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> For example, I want to convert a newline character to ^M and not $'\n'

Ugly, but:

showctl() {
  local -a ctls=(
   # Subshell for throwaway keymap
   $(bindkey -N ctl &&
     bindkey -M ctl -- "$1" '' &&
     bindkey -M ctl)
  )
  print -r -- "${ctls[1]}"
}




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