Ok this is what I currently have, in my .zshrc, to control the keybinding:
function zle-line-init {
marking=0
}
zle -N zle-line-init
function select-char-right {
if (( $marking != 1 ))
then
marking=1
zle set-mark-command
fi
zle .forward-char
}
zle -N select-char-right
function select-char-left {
if (( $marking != 1 ))
then
marking=1
zle set-mark-command
fi
zle .backward-char
}
zle -N select-char-left
function forward-char {
if (( $marking == 1 ))
then
marking=0
NUMERIC=-1 zle set-mark-command
fi
zle .forward-char
}
zle -N forward-char
function backward-char {
if (( $marking == 1 ))
then
marking=0
NUMERIC=-1 zle set-mark-command
fi
zle .backward-char
}
zle -N backward-char
function delete-char {
if (( $marking == 1 ))
then
zle kill-region
marking=0
else
zle .delete-char
fi
}
zle -N delete-char
bindkey ';6D' select-word-left ## not working yet
bindkey ';6C' select-word-right ## not working yet
bindkey ';2D' select-char-left # assuming xterm
bindkey ';2C' select-char-right # assuming xterm
bindkey ';5D' backward-word
bindkey ';5C' forward-word
bindkey '^[[3~' delete-char
with this, I can:
move word by word with control
select a region to delete with shift (only problem, I have no visual on the marked region)
a delete key that works
Sorry for the confusion, I am currently on xterm terminal (just changed my desktop environment to xfce4)
I would still like to mark a region to kill using ctrl+shift+arrows, haven't been able to do this yet because I don't know how to get the number of chars moved with forward/backward-word..
In a better world, I would also like to have an highlighted marked region... =)
Any idea?