Skip to content

Instantly share code, notes, and snippets.

@debxp
Created October 25, 2019 13:26
Show Gist options
  • Save debxp/30b759d2ba002df9d5b7e21cfb694918 to your computer and use it in GitHub Desktop.
Save debxp/30b759d2ba002df9d5b7e21cfb694918 to your computer and use it in GitHub Desktop.
função para realizar buscas nas páginas do terminal
# Basta incluir o código abaixo no mesmo arquivo onde você define os seus aliases (~/.bashrc ou ~/.bash_aliases, por exemplo)
# man pages
mp() {
[[ -n $1 ]] && man $1 && return
local page=$(man -k . | fzf --reverse -e -i --tiebreak=begin)
[[ -n $page ]] && man ${page%% *}
}
# Completar entradas do manual na função 'mp'
_autocomplete_mp() {
[[ ${#COMP_WORDS[@]} -ne 2 ]] && return
COMPREPLY=( $( compgen -W "$(man -k . | awk '{print $1}')" ${COMP_WORDS[1]} ) )
}
complete -F _autocomplete_mp mp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment