Twitter Email
silvercircle No addendum
A Jekyll test site with no particular purpose.

Cygwin and ZSH - Delete, Home and End keys

Author: AlexVie
Title: Cygwin and ZSH - Delete, Home and End keys
Language: en-US
Categories: Development
Created: 15:09 on Thursday, 26. October 2017
Modified: 15:09 on Thursday, 26. October 2017
Excerpt:

Under certain configurations, the Home, End and Delete keys will insert arbitrary characters (in most cases, the tilde symbol) when using the popular ZSH under Cygwin.

This is caused by a wrong or missing keyboard configuration and easy to fix by adding a few lines to the .zshrc.

Tags: first
Page layout: no_sidebar
Last modified:
150 Words
15:09 | by AlexVie in Development
Reading time: approx. 0 minute(s).

Under certain configurations, the Home, End and Delete keys will insert arbitrary characters (in most cases, the tilde symbol) when using the popular ZSH under Cygwin. The issue is caused by a wrong or missing keyboard configuration and easy to fix by adding a few lines to the .zshrc.

# ctrl-left and ctrl-right
bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-word

# ctrl-bs and ctrl-del
bindkey "\e[3;5~" kill-word
bindkey "\C-_"    backward-kill-word

# del, home and end
bindkey "\e[3~" delete-char
bindkey "\e[H"  beginning-of-line
bindkey "\e[F"  end-of-line

# alt-bs
bindkey "\e\d"  undo

The above section will add keyboard shortcuts for traversing through words as well as fix the Homeand End keys. It will also fix the backspace and delete key behavior by adding properly configured sequences for deleting the next and previous words.