From 0031007691d1243ea0d9d07a85c71b5398ecd324 Mon Sep 17 00:00:00 2001 From: Jens Nolte <jens@nightmarestudio.de> Date: Tue, 7 Apr 2020 14:48:17 +0200 Subject: [PATCH] Add zsh key bindings --- nixos/layers/zsh.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/nixos/layers/zsh.nix b/nixos/layers/zsh.nix index 1250e60..781ea9f 100644 --- a/nixos/layers/zsh.nix +++ b/nixos/layers/zsh.nix @@ -124,6 +124,17 @@ in setopt autocd setopt extendedglob + unsetopt flowcontrol + + + # Set up fzf for ctrl-t (paste selected paths) and alt-c (cd into selected directory) + # This also binds ctrl-r, but that binding is reverted later + source ${pkgs.fzf}/share/fzf/key-bindings.zsh + + # bind ctrl-r and ctrl-s to perform emacs-style history search + bindkey '^R' history-incremental-search-backward + bindkey '^S' history-incremental-search-forward + # Shift-Tab reverse tab through completions bindkey '^[[Z' reverse-menu-complete @@ -172,9 +183,6 @@ in bindkey '^P' up-history bindkey '^N' down-history - # bind ctrl-r to perform backward search in history - bindkey '^r' history-incremental-search-backward - # bind ctrl-a and ctrl-e to move to beginning/end of line bindkey '^a' beginning-of-line bindkey '^e' end-of-line @@ -187,17 +195,19 @@ in zle -N backward-kill-dir bindkey '^[^?' backward-kill-dir - set-cursor-bar (){ - if [[ "$TERM" = xterm* ]]; then + + set-cursor-bar () { + if [[ "$TERM" = xterm* || "$TERM" = tmux* || "$TERM" = screen* ]]; then echo -ne "\e[6 q" fi } set-cursor-block() { - if [[ "$TERM" = xterm* ]]; then + if [[ "$TERM" = xterm* || "$TERM" = tmux* || "$TERM" = screen* ]]; then echo -ne "\e[2 q" fi } + # change cursor on vi mode switch zle-keymap-select() { # FIXME: Activating vi-command-mode (typing ":" in vicmd-keymap) results in incorrect bar cursor -- GitLab