Skip to content

Commit

Permalink
🔨 Add more sources
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Oct 31, 2022
1 parent 1be08ac commit 8310196
Show file tree
Hide file tree
Showing 25 changed files with 97 additions and 7 deletions.
1 change: 1 addition & 0 deletions functions/helper.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(($+commands[delta])) || delta() {cat}
(($+commands[less])) || less() {ls -l}
(($+commands[finger])) || finger() {(($+commands[pinky])) && pinky $@ || whoami}
(($+commands[pandoc])) || pandoc() {cat ${@[-1]}}
(($+commands[grc])) || grc() {eval ${@[2,-1]}}

# dictionary $ZINIT cannot be passed
Expand Down
2 changes: 1 addition & 1 deletion sources/-command-.zsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# :fzf-tab:complete:-command-:
# :fzf-tab:complete:(-command-:|command:option-(v|V)-rest)
case $group in
'external command')
less =$word
Expand Down
6 changes: 6 additions & 0 deletions sources/cowsay.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# :fzf-tab:complete:(\\|*/|)cowsay:
case $group in
'cow file')
cowsay -f $word hello
;;
esac
6 changes: 6 additions & 0 deletions sources/flatpak.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# :fzf-tab:complete:(\\|*/|)flatpak:
case $group in
argument)
flatpak $word --help | bat --color=always -plhelp
;;
esac
3 changes: 3 additions & 0 deletions sources/gio.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# :fzf-tab:complete:(\\|*/|)gio:
[[ -f $realpath ]] && less $realpath \
|| gio help $word 2>&1 | bat --color=always -plhelp
2 changes: 2 additions & 0 deletions sources/gm.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)gm:
gm $word -help | bat --color=always -plhelp
2 changes: 2 additions & 0 deletions sources/gtk-launch.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)gtk-launch:values
less {/usr,~/.local}/share/applications/$word.desktop(N)
6 changes: 6 additions & 0 deletions sources/ip.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# :fzf-tab:complete:(\\|*/|)ip:
case $group in
'ip command')
ip $word help 2>&1 | bat --color=always -plhelp
;;
esac
2 changes: 2 additions & 0 deletions sources/jq.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)jq:argument-rest
[[ -f $realpath ]] && jq -Cr . $realpath 2> /dev/null || less $realpath
9 changes: 9 additions & 0 deletions sources/kitty.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# :fzf-tab:complete:(\\|*/|)kitty:
case $group in
'external command')
less =$word
;;
'%BEntry points%b')
kitty $word --help | bat --color=always -plhelp
;;
esac
12 changes: 10 additions & 2 deletions sources/libreoffice.zsh
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# :fzf-tab:complete:(\\|*/|)libreoffice:
[[ -f $realpath ]] && libreoffice --headless --cat $realpath || less $realpath
# :fzf-tab:complete:(\\|*/|)(libre|s)office:
if [[ -f $realpath && ${realpath:e} == xls* ]]; then
libreoffice --headless --convert-to html --outdir /tmp $realpath \
2>&1 > /dev/null && pandoc -t markdown -o - /tmp/${realpath:t:r}.html \
| bat --color=always -plmarkdown && rm /tmp/${realpath:t:r}.html
elif [[ -f $realpath ]]; then
libreoffice --headless --cat $realpath
else
less $realpath
fi
2 changes: 2 additions & 0 deletions sources/limit.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|)limit:
limit $word
2 changes: 2 additions & 0 deletions sources/nmap.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)nmap:argument-rest
nmap $word
15 changes: 12 additions & 3 deletions sources/pacman.zsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# :fzf-tab:complete:(\\|*/|)(pacman|yay):argument-rest
[ $group != repository/package ] \
&& pacman -Qi $word | bat --color=always -plyaml
# :fzf-tab:complete:(\\|*/|)(pacman|yay):(argument-(rest|1)|option-l-1)
case $group in
'package file')
less $realpath
;;
(('installed '|)package|'local packages'))
pacman -Qi $word | bat --color=always -plyaml
;;
packages)
pacman -Si $word | bat --color=always -plyaml
;;
esac
2 changes: 2 additions & 0 deletions sources/pipx.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)pipx:
pipx $word --help | bat --color=always -plhelp
6 changes: 6 additions & 0 deletions sources/poetry.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# :fzf-tab:complete:(\\|*/|)poetry:
case $group in
command)
poetry $word --help | bat --color=always -plhelp
;;
esac
9 changes: 9 additions & 0 deletions sources/snap.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# :fzf-tab:complete:(\\|*/|)snap:
case $group in
option)
snap help $word | bat --color=always -plhelp
;;
argument)
snap list $word 2> /dev/null
;;
esac
2 changes: 2 additions & 0 deletions sources/stat.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)stat:argument-rest
stat $realpath
2 changes: 1 addition & 1 deletion sources/systemctl-help.zsh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# :fzf-tab:complete:systemctl-help:*
systemctl help $word | bat --color=always -plhelp
systemctl help $word 2> /dev/null | bat --color=always -plhelp
2 changes: 2 additions & 0 deletions sources/ulimit.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)ulimit:options
ulimit $word | bat --color=always -plhelp
2 changes: 2 additions & 0 deletions sources/uname.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)uname:options
uname $word | bat --color=always -plhelp
2 changes: 2 additions & 0 deletions sources/wezterm-command-shell-completion.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)wezterm-command-shell-completion:option--shell-1
wezterm shell-completion --shell=$word | bat --color=always -plsh
2 changes: 2 additions & 0 deletions sources/wezterm-command-start.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)wezterm-command-start:argument-rest
less =$word
2 changes: 2 additions & 0 deletions sources/wezterm.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :fzf-tab:complete:(\\|*/|)wezterm:argument-1
wezterm help $word | bat --color=always -plhelp
3 changes: 3 additions & 0 deletions sources/xdg-settings.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# :fzf-tab:complete:(\\|*/|)xdg-settings:
file=$(xdg-settings get $word)
[[ -n $file ]] && less {/usr,~/.local}/share/applications/$file(N)

0 comments on commit 8310196

Please sign in to comment.