sh: Add default open script

Simple wrapper for xdg-open functionality. Simply refers
to xdg-open except if there exists mimeo on the system
which it will refer to instead.

So, a simple preference modificator for mimeo over
xdg-open since that is my preference too.

Also gave it a short name so I can do open whenever I
want and don't have to tax my left hand with tying xdg.
This commit is contained in:
Marty Oehme 2023-12-04 08:26:59 +01:00
parent dfaed8c9dd
commit 4cc03a611a
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
8 changed files with 34 additions and 28 deletions

View file

@ -57,31 +57,15 @@ alias myip="curl -s icanhazip.com"
if exist fzf; then
# Display fuzzy-searchable history
alias fzfhistory="history -l -E -D 0 | fzf --tac --height 20"
fzfman() {
fzman() {
man "$(apropos --long "$1" | fzf | awk '{print $2, $1}' | tr -d '()')"
}
# Fuzzy search packages to install
if exist yay; then
fzf_pkg_tool=yay
elif exist paru; then
fzf_pkg_tool=paru
elif exist pacman; then
fzf_pkg_tool=pacman
fi
# shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically
if [ -n "$fzf_pkg_tool" ]; then
alias fzfyay="$fzf_pkg_tool -Slq | fzf -m --preview '$fzf_pkg_tool -Si {1}' | xargs -ro $fzf_pkg_tool -S"
# Fuzzy uninstall packages
alias fzfyayrns="$fzf_pkg_tool -Qeq | fzf -m --preview '$fzf_pkg_tool -Qi {1}' | xargs -ro $fzf_pkg_tool -Rns"
fi
unset fzf_pkg_tool
# ripgrep-all to fzf search through any documents
if exist rga; then
fzfrga() {
fzrga() {
RG_PREFIX="rga --files-with-matches"
xdg-open "$(
open "$(
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
--phony -q "$1" \
@ -90,6 +74,13 @@ if exist fzf; then
)"
}
fi
# quickly fzy search a sqlite database result
if exist sqlite3; then
fzql() {
sqlite3 -header "$1" "$2" | fzf --header-lines=1 --layout=reverse --multi --prompt='fzql> '
}
fi
fi
# vifm