Created
October 25, 2019 13:26
-
-
Save debxp/30b759d2ba002df9d5b7e21cfb694918 to your computer and use it in GitHub Desktop.
função para realizar buscas nas páginas do terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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