mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
Improve gi function
This commit is contained in:
parent
3d871b10c4
commit
1ffcb915d8
|
|
@ -61,9 +61,10 @@ export giCache=~/.giCache
|
|||
export giIndex=$giCache/.list
|
||||
gi() {
|
||||
[ -f $giIndex ] || gi-update-index
|
||||
local preview="echo {} |awk '{print \$2}' |xargs -I% bash -c 'cat $giCache/% 2>/dev/null || (curl -sL https://www.gitignore.io/api/% |tee $giCache/%)'"
|
||||
IFS=$'\n'
|
||||
[[ $# -gt 0 ]] && args="$@" || args="$(cat $giIndex |nl -nrn -w4 -s' ' |fzf -m |awk '{print $2}')"
|
||||
gi-get $args
|
||||
[[ $# -gt 0 ]] && args=($@) || args=($(cat $giIndex |nl -nrn -w4 -s' ' |fzf -m --preview="$preview" --preview-window="right:70%" |awk '{print $2}'))
|
||||
gi-get ${args[@]}
|
||||
}
|
||||
gi-update-index() {
|
||||
mkdir -p $giCache
|
||||
|
|
|
|||
Loading…
Reference in a new issue