From 7dbe853f3a1090b590a479bf96922e93ed474679 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 31 May 2023 20:54:31 +0200 Subject: [PATCH] ble.sh: use fzf ctrl-r history, ble.sh built-in completion Fix selected ble-face region_input Fix jump words limited by space (uword) --- modules/terminal-life/bash/default.nix | 11 +++++++++-- modules/terminal-life/fzf/default.nix | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index 1370f04a..fa535348 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -18,6 +18,9 @@ in { # Run when initializing an interactive shell initExtra = '' + # Use fzf's CTRL-R history widget + source ${pkgs.fzf}/share/fzf/key-bindings.bash + # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh @@ -37,9 +40,11 @@ in { # Meta (Alt) + Backspace to delete a word ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword' # Meta (Alt) + p to jump one word backwards - ble-bind -m 'vi_imap' -f M-p '@nomarked backward-cword' + ble-bind -m 'vi_imap' -f M-p '@nomarked backward-uword' + ble-bind -m 'vi_imap' -f M-left '@nomarked backward-uword' # Meta (Alt) + n to jump one word forwards - ble-bind -m 'vi_imap' -f M-n '@nomarked forward-cword' + ble-bind -m 'vi_imap' -f M-n '@nomarked forward-uword' + ble-bind -m 'vi_imap' -f M-right '@nomarked forward-uword' # Arrow up and Ctrl + p searches history for entered input ble-bind -m 'vi_imap' -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' @@ -47,6 +52,8 @@ in { ble-bind -m 'vi_imap' -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-face region_insert='fg=black,bg=navy' + function my/complete-load-hook { bleopt complete_auto_delay=250 } diff --git a/modules/terminal-life/fzf/default.nix b/modules/terminal-life/fzf/default.nix index 372e768d..88e60592 100644 --- a/modules/terminal-life/fzf/default.nix +++ b/modules/terminal-life/fzf/default.nix @@ -10,5 +10,8 @@ "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" ]; - enableBashIntegration = true; + # Use ble.sh for completions, see + # modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc + # and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion + enableBashIntegration = false; }