From 32a6b9a016b86c714ec03eba8815704f3d7004b1 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 24 Feb 2023 17:56:17 +0100 Subject: [PATCH] bash: disable ble.sh history share complete on first TAB if there's a single matching filename with show-all-if-ambiguous on enable history search with arrow up after starting to type a command --- modules/terminal-life/bash/default.nix | 23 ++++++++++++++--------- modules/terminal-life/default.nix | 2 ++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index b39f692c..8bb95ab5 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -2,6 +2,7 @@ config, pkgs, self, + inputs, ... }: let psCfg = config.pub-solar; @@ -27,33 +28,36 @@ in { eval "$(${pkgs.direnv}/bin/direnv hook bash)" + bind 'set show-all-if-ambiguous on' + # Syntax highlighting, auto suggestions, vim modes, etc. # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs source "$(blesh-share)" --attach=none # ctrl + space to accept autocomplete suggestion ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' # Meta (Alt) + Backspace to delete a word - ble-bind -m 'emacs' -f 'M-C-?' 'kill-backward-cword' + ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword' # Meta (Alt) + p to jump one word backwards - ble-bind -m 'emacs' -f M-p '@nomarked backward-cword' + ble-bind -m 'vi_imap' -f M-p '@nomarked backward-cword' # Meta (Alt) + n to jump one word forwards - ble-bind -m 'emacs' -f M-n '@nomarked forward-cword' + ble-bind -m 'vi_imap' -f M-n '@nomarked forward-cword' # Arrow up and Ctrl + p searches history for entered input - ble-bind -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' - ble-bind -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' + 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' # Arrow down and Ctrl + n searches history for entered input - ble-bind -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' - ble-bind -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + 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' function my/complete-load-hook { - bleopt complete_auto_delay=300 + bleopt complete_auto_delay=500 } blehook/eval-after-load complete my/complete-load-hook bleopt exec_errexit_mark= - bleopt history_share=1 bleopt filename_ls_colors="$LS_COLORS" + bleopt complete_menu_style=desc-raw + # Bash vim mode keybindings if [[ $- == *i* ]]; then # in interactive session set -o vi @@ -72,6 +76,7 @@ in { fi source ${config.age.secrets.environment-secrets.path} + source ${inputs.tritonshell.packages.${pkgs.system}.triton-utils}/bin/ttp.sh # end of .bashrc [[ ''${BLE_VERSION-} ]] && ble-attach diff --git a/modules/terminal-life/default.nix b/modules/terminal-life/default.nix index 8487c0cf..60ce96b5 100644 --- a/modules/terminal-life/default.nix +++ b/modules/terminal-life/default.nix @@ -3,6 +3,7 @@ config, pkgs, self, + inputs, ... }: with lib; let @@ -61,6 +62,7 @@ in { inherit config; inherit pkgs; inherit self; + inherit inputs; }; programs.fzf = import ./fzf { inherit config;