File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -80,21 +80,37 @@ function _fzf_dev {
80
80
zle -N _fzf_dev
81
81
bindkey ' ^F' _fzf_dev
82
82
83
+ function fzf_history {
84
+ history -in -1 0 | \
85
+ fzf --border=rounded \
86
+ --margin=2,16 \
87
+ --prompt=" History » " \
88
+ --pointer=▶ \
89
+ -1 \
90
+ --query " $1 " | \
91
+ awk -F' ' ' {print $2}'
92
+ }
93
+
83
94
function hist {
84
- selected_cmd=$( history -in -1 0 | \
85
- fzf --border=rounded \
86
- --margin=2,16 \
87
- --prompt=" History » " \
88
- --pointer=▶ \
89
- -1 \
90
- --query " $1 " | \
91
- awk -F' ' ' {print $2}' )
95
+ selected_cmd=$( fzf_history $1 )
92
96
93
97
if [[ -n " $selected_cmd " ]]; then
94
98
eval $selected_cmd
95
99
fi
96
100
}
97
101
102
+ function _fzf_hist {
103
+ selected_cmd=$( fzf_history $LBUFFER )
104
+
105
+ if [[ -n " $selected_cmd " ]]; then
106
+ BUFFER=" $selected_cmd "
107
+ zle accept-line
108
+ fi
109
+ }
110
+
111
+ zle -N _fzf_hist
112
+ bindkey ' ^r' _fzf_hist
113
+
98
114
function fapt() {
99
115
local pkg
100
116
pkg=$( apt-cache search ' .*' | fzf -m | awk ' {print $1}' )
You can’t perform that action at this time.
0 commit comments