File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env zsh
2
+
3
+ main () {
4
+ emulate -LR zsh
5
+
6
+ ztr skip ' @TODO' ' When ABBR_PUSH_HISTORY == 1, abbreviations are included in history'
7
+ }
8
+
9
+ main
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ typeset -gi ABBR_LOG_AVAILABLE_ABBREVIATION_AFTER=${ABBR_LOG_AVAILABLE_ABBREVIAT
47
47
# deprecated
48
48
typeset -gi ABBR_PRECMD_LOGS=${ABBR_PRECMD_LOGS:- 1}
49
49
50
+ # Should abbr-expand-and-accept push the unexpanded line to the shell history? (default false)
51
+ # If true, if abbr-expand-and-accept expands an abbreviation there will be two history entries:
52
+ # the first is what was typed (with the abbreviation), the second is what was run (with the expansion).
53
+ typeset -gi ABBR_PUSH_HISTORY=${ABBR_PUSH_HISTORY:- 0}
54
+
50
55
# Behave as if `--quiet` was passed? (default false)
51
56
typeset -gi ABBR_QUIET=${ABBR_QUIET:- 0}
52
57
@@ -1638,11 +1643,17 @@ abbr-expand-and-accept() {
1638
1643
1639
1644
# do not support debug message
1640
1645
1646
+ local buffer
1647
+
1641
1648
local trailing_space
1642
1649
trailing_space=${LBUFFER##* [^[:IFSSPACE:]]}
1643
1650
1644
1651
if [[ -z $trailing_space ]]; then
1652
+ buffer=$BUFFER
1653
+
1645
1654
zle abbr-expand
1655
+
1656
+ (( ABBR_PUSH_HISTORY )) && [[ $buffer != $BUFFER ]] && print -s $buffer
1646
1657
fi
1647
1658
1648
1659
_abbr_accept-line
You can’t perform that action at this time.
0 commit comments