3 ms·
You should try binding UP/DOWN to history-search-backward and history-search-forward[1]. Adding this to your ~/.inputrc "\e[A": history-search-backward
by pdkl95 8y ago
You should try binding UP/DOWN to history-search-backward and history-search-forward[1]. Adding this to your ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
enables searching by the current line's prefix in all programs that use readline (a lot of languages use readline for their REPL). That is, if you type "cp<UP>" you immediately get the previous command that started with "cp", regardless of how far back it is in your history.
[1] https://codeinthehole.com/tips/the-most-important-command-line-tip-incremental-history-searching-with-inputrc/ https://codeinthehole.com/tips/the-most-important-command-li...
- kbp 8y agoThis is a useful trick, but I don't see how it addresses the issue they talked about. As I understand it, they were saying that Firefox and Chrome's Javascript REPL's scroll up through expressions rather than lines. If you say "const f = () => {" and press enter, it doesn't submit it until you close that brace, and when you use the up arrow to scroll back to it later, you get the whole thing (newlines preserved) instead of single lines of it.