From e571774c9734dea484e4254939fc38d9d8e9c79c Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 19 Apr 2024 12:18:53 +0200 Subject: [PATCH] Make alt-d on empty commandline call dirh again alt-d used to do that until evil merge[*] 213e90704 (Merge remote-tracking branch 'upstream/master' into bind_mode, 2014-01-15) which changed the order of the \ed bindings such that the smart dirh version would be shadowed by the simpler ones. [*] git blame alone failed to find it because it skips merge commits. --- CHANGELOG.rst | 1 + share/functions/__fish_shared_key_bindings.fish | 2 +- share/functions/fish_default_key_bindings.fish | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de727c9b6..4279a181f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -125,6 +125,7 @@ New or improved bindings - Multiline commands are indented before being sent to the editor, which matches the rendering in fish. - ``backward-kill-path-component`` and friends now treat ``#`` as part of a path component (:issue:`10271`). - Bindings like :kbd:`alt-l` that print output in between prompts now work correctly with multiline commandlines. +- ``alt-d`` on an empty command line lists the directory history again. This restores the behavior of version 2.1. - `history-prefix-search-{backward,forward}` now maintain the cursor position instead of moving the cursor to the end of the command line (:issue:`10430`). - The ``E`` binding in vi mode now correctly handles the last character of the word, by jumping to the next word (:issue:`9700`). - If the terminal supports shifted key codes from the [kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/), ``shift-enter`` now inserts a newline instead of executing the command line. diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index e6042253c..9c33c061c 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -85,7 +85,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind --preset $argv end end-of-line bind --preset $argv home beginning-of-line - bind --preset $argv alt-d 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end' + bind --preset $argv alt-d 'if test "$(commandline)." = .; __fish_echo dirh; else; commandline -f kill-word; end' bind --preset $argv ctrl-d delete-or-exit bind --preset $argv alt-s 'for cmd in sudo doas please; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end' diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index d3a6ca962..67aea33ab 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -77,8 +77,6 @@ function fish_default_key_bindings -d "emacs-like key binds" bind --preset $argv alt-\< beginning-of-buffer bind --preset $argv alt-\> end-of-buffer - bind --preset $argv alt-d kill-word - bind --preset $argv ctrl-r history-pager # term-specific special bindings