Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if [[ -n $(which selecta) ]]; then
- # CTRL-R - Paste the selected command from history into the command line
- selecta-history-widget() {
- local selected restore_no_bang_hist
- if [[ -z "$LBUFFER" ]]; then
- selected=( $(fc -l 1 | selecta) )
- else
- selected=( $(fc -l 1 | selecta -s "$LBUFFER") )
- fi
- if $selected; then
- num=$selected[1]
- if [ -n "$num" ]; then
- zle vi-fetch-history -n $num
- fi
- fi
- zle redisplay
- }
- zle -N selecta-history-widget
- bindkey '^R' selecta-history-widget
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement