A WIP Helix keybinding for Z Shell.
Bring comfort of working with Helix keybindings to your Zsh environment.
This plugin attempts to implement Helix keybindings as accurate and complete as much as possible. Any existing keybindings that should reflect the official default Helix keybinds but doesn't are considered bugs.
Clone the repository to wherever you'd like and source the plugin.
git clone https://github.com/Multirious/zsh-helix-mode --depth 1
source ./zsh-helix-mode/zsh-helix-mode.plugin.zsh
Following zplug's plugin installation, add the below to your configuration:
zplug "multirious/zsh-helix-mode", depth:1, at:main
Following Antigen's plugin installation, add the below to your configuration:
antigen bundle multirious/zsh-helix-mode@main
Following Oh My Zsh's plugin installation, clone the repository to $ZSH_CUSTOM/plugins
folder:
git clone https://github.com/Multirious/zsh-helix-mode --depth 1 $ZSH_CUSTOM/plugins/zsh-helix-mode
And add the plugin to the plugins
array:
plugins=(zsh-helix-mode)
Nix (non-flake)
let
zsh-helix-mode = pkgs.fetchFromGithub {
owner = "multirious";
repo = "zsh-helix-mode";
rev = "...";
sha256 = "...";
};
in
''
source ${zsh-helix-mode}/zsh-helix-mode.plugin.zsh
''
{
inputs = {
zsh-helix-mode.url = "github:multirious/zsh-helix-mode/main"
};
}
You can change the cursor color and shape for each mode via these environment variables. The content of these variables should be a string of terminal escape sequences that modify the looks of your terminal cursor. These are printed everytime after mode changes.
ZHM_CURSOR_NORMAL
- Prints the variable whenever the mode changes to normal mode.
- By default, it is
\e[0m\e[2 q\e]12;#B4BEFE\a
which is a string of ANSI escape sequences
that basically means "reset, block cursor, pastel blue".
ZHM_CURSOR_SELECT
- Prints the variable whenever the mode changes to select mode.
- By default, it is
\e[0m\e[2 q\e]12;#F2CDCD\a
which is a string of ANSI escape sequences
that basically means "reset, block cursor, pastel red".
ZHM_CURSOR_INSERT
- Prints the variable whenever the mode changes to insert mode.
- By default, it is
\e[0m\e[5 q\e]12;white\a
which is a string of ANSI escape sequences
that basically means "reset, vertical blinking cursor, white".
This plugin is currently an extension to ZLE. It uses ZLE's marking/highlighting feature to implement selection which ZLE also provided some variables for stylign.
todo
ZHM_CLIPBOARD_PIPE_CONTENT_TO
- System yanked content will be piped to the command in this variable.
- By default, it is
xclip -sel clip
if theDISPLAY
environment variable is found,
orwl-copy
if theWAYLAND_DISPLAY
environment variable is found,
otherwise it is empty.
ZHM_CLIPBOARD_READ_CONTENT_FROM
- System paste will use the stdout output from the command in this variable.
- By default, it is
xclip -o -sel clip
if theDISPLAY
environment variable is found,
orwl-paste --no-newline
if theWAYLAND_DISPLAY
environment variable is found,
otherwise it is empty.
todo
If you wish to use zsh-autosuggestions with this plugin, you can add the following configurations below:
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(
zhm_history_prev
zhm_history_next
)
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(
zhm_move_right
)
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS+=(
zhm_move_next_word_start
zhm_move_next_word_end
)
More details can be seen here.
This configuration has one caveat and that is partial accepting using zhm_move_next_word_start
or zhm_move_next_word_end
will leave one last character unaccepted which some can considered them undesirable/annoying (I know I am).
Please submit an issue/PR if you have a solution!