Solved Alacritty: Home/End not working on command line.

rigoletto@

Developer
Hi,

I've installed x11/alacritty and I cant' get Home/End (beginning-of-line/beginning-of-line) working... 😒

I just uncommented these lines (to make a few things work) of the default configuration file:

Code:
key_bindings:                                                                              
  - { key: Paste,                                       action: Paste          }          
  - { key: Copy,                                        action: Copy           }          
  - { key: L,         mods: Control,                    action: ClearLogNotice }
  - { key: L,         mods: Control, mode: ~Vi|~Search, chars: "\x0c"          }
  - { key: PageUp,    mods: Shift,   mode: ~Alt,        action: ScrollPageUp,  }  
  - { key: PageDown,  mods: Shift,   mode: ~Alt,        action: ScrollPageDown }  
  - { key: Home,      mods: Shift,   mode: ~Alt,        action: ScrollToTop,   }  
  - { key: End,       mods: Shift,   mode: ~Alt,        action: ScrollToBottom }

bindkey -a return:

Code:
"^[[7~" beginning-of-line
"^[[8~" end-of-line

Thanks!

[EDIT]

.zshrc[ (just in case)

Code:
bindkey -e

bindkey    "^[[7~"        beginning-of-line
bindkey "^[[8~"        end-of-line
bindkey    "\e[2~"        overwrite-mode
bindkey    "\e[3~"        delete-char
bindkey "^[Od"        backward-word                 # rxvt
bindkey    "\e[1;5D"    backward-word
bindkey "^[Oc"        forward-word                # rxvt
bindkey    "\e[1;5C"    forward-word
bindkey "^[[A"         history-search-backward
bindkey "^[[B"        history-search-forward
bindkey    "\e[5~"        history-beginning-search-backward
bindkey    "\e[6~"        history-beginning-search-forward
bindkey    "^W"        backward-delete-word
 
Btw, I had it working on the past but I don't have the file anymore (there were some specific configurations), apparently the syntax changed a bit and I am not getting it anymore.

Thanks!
 
If nobody else has a solution this is what I got: Home and End keys are working here on x11/alacritty in shells/zsh, with oh-my-zsh framework installed (git clone) and zshrc.zsh-template used as ~/.zshrc (with additional settings and exported ~/.oh-my-zsh, reading file key-bindings.zsh).

Those sections of the oh-my-zsh key-bindings.zsh file shown below in "Code" makes the Home and End keys functional.

It seems shells/zsh needs this piece of code to have the Home and End keys (and other) working, independent what is set in the alacritty.yml configuration file, for example /bin/csh (or /bin/sh) as login shell running x11/alacritty has the keys working without any configuration.

Code:
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  function zle-line-init() {
    echoti smkx
  }
  function zle-line-finish() {
    echoti rmkx
  }
  zle -N zle-line-init
  zle -N zle-line-finish
fi

# Use emacs key bindings
bindkey -e

# [Home] - Go to beginning of line
if [[ -n "${terminfo[khome]}" ]]; then
  bindkey -M emacs "${terminfo[khome]}" beginning-of-line
  bindkey -M viins "${terminfo[khome]}" beginning-of-line
  bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
fi
# [End] - Go to end of line
if [[ -n "${terminfo[kend]}" ]]; then
  bindkey -M emacs "${terminfo[kend]}"  end-of-line
  bindkey -M viins "${terminfo[kend]}"  end-of-line
  bindkey -M vicmd "${terminfo[kend]}"  end-of-line
fi
x11/alacritty bindkey -a of End and Home with the above configuration:

Code:
"^[OF" end-of-line
"^[OH" beginning-of-line
 
Back
Top