mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
feat(config): add down-arrow binding for silent pj invocation on empty prompt
This commit is contained in:
1 parent
818bc4910b
commit
a507b25c85
3 files changed
+26
-1
No files matched your search
@@ -0,0 +1,18 @@
|
||||
function _pj_bind_down --description "down arrow: pj on an idle empty prompt, else the preset down-or-search"
|
||||
# Mirror of atuin's up binding (atuin owns up, this owns down). Everything
|
||||
# that legitimately needs the arrow keys keeps them:
|
||||
# - non-empty buffer → multiline cursor movement / forward history search
|
||||
# - paging mode → tab-completion pager navigation (tab on an empty
|
||||
# line opens the pager with an empty buffer)
|
||||
# - search mode → history-search navigation
|
||||
set -l buf (commandline | string collect)
|
||||
if test -n "$buf"; or commandline --paging-mode; or commandline --search-mode
|
||||
commandline -f down-or-search
|
||||
return
|
||||
end
|
||||
|
||||
# PJ_QUIET keeps pj silent when the tree has no package.json, so down is a
|
||||
# no-op outside JS projects instead of printing an error on every press.
|
||||
PJ_QUIET=1 pj
|
||||
commandline -f repaint
|
||||
end
|
||||
Reference in new issue
Block a user