diff --git a/shell/.config/readline/inputrc b/shell/.config/readline/inputrc index b16ee82..00574a7 100644 --- a/shell/.config/readline/inputrc +++ b/shell/.config/readline/inputrc @@ -6,15 +6,15 @@ $include /etc/inputrc # zsh-style prefix history search: type a prefix, Up/Down walk matching -# history entries with cursor at END of line. Empty prefix = previous/next. +# history entries. Empty prefix = previous/next. # -# Readline's history-search-* leaves the cursor at the prefix boundary, not the -# end (that's why zsh needs its history-search-end widget). There's no built-in -# "search then go to end", so: bind the real functions to throwaway keys, then -# bind the arrows to a MACRO that runs the search and then end-of-line (\C-e). -"\C-x\C-p": history-search-backward -"\C-x\C-n": history-search-forward -"\e[A": "\C-x\C-p\C-e" -"\e[B": "\C-x\C-n\C-e" -"\eOA": "\C-x\C-p\C-e" -"\eOB": "\C-x\C-n\C-e" +# Bind arrows straight to the search functions. Do NOT wrap in a macro that +# appends end-of-line (\C-e) to mimic zsh's cursor-at-end: \C-e moves point to +# the line end, and history-search-* takes its prefix from start-of-line to +# point -- so the next press searches for the whole recalled line, finds +# nothing, and Up/Down go dead. Pure readline has no history-search-end widget; +# cursor lands at the prefix boundary, which is readline's intended behavior. +"\e[A": history-search-backward +"\e[B": history-search-forward +"\eOA": history-search-backward +"\eOB": history-search-forward