Skip to content

Commit

Permalink
chore: bump scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed Mar 30, 2024
1 parent 940b4b1 commit 67dcd45
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

My personal vimrc configuration files, dotfiles and other scripts. Feel free to contact me or open an issue/PR if you have any questions or suggestions.

## Requirements
## Requirements and Installation

See also `install/README.md`

### Vim/Neovim/VSCode Neovim

Expand Down
2 changes: 2 additions & 0 deletions install/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
fzf通过vim插件安装最新版

定期运行`sync-scripts.sh`同步更新
5 changes: 5 additions & 0 deletions install/sync-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wget --output-document root/z.sh https://github.com/rupa/z/raw/master/z.sh &
wget --output-document root/fzf/fzf-git.sh https://github.com/junegunn/fzf-git.sh/raw/main/fzf-git.sh &
wget --output-document root/scripts/lsix https://github.com/hackerb9/lsix/raw/master/lsix &
wget --output-document root/scripts/v https://github.com/rupa/v/raw/master/v &
wait
6 changes: 3 additions & 3 deletions root/scripts/lsix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# Requirements: just ImageMagick (and a Sixel terminal, of course)

# Version 1.8
# B9 August 2021
# Version 1.8.2
# B9 November 2023

# See end of file for USAGE.

Expand Down Expand Up @@ -194,7 +194,7 @@ main() {

# Only show first frame of animated GIFs if filename not specified.
for x in ${!MAPFILE[@]}; do
if [[ ${MAPFILE[$x]} =~ gif$ ]]; then
if [[ ${MAPFILE[$x]} =~ (gif|webp)$ ]]; then
MAPFILE[$x]="${MAPFILE[$x]}[0]"
fi
done
Expand Down
12 changes: 6 additions & 6 deletions root/z.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ _z() {
# maintain the data file
local tempfile="$datafile.$RANDOM"
local score=${_Z_MAX_SCORE:-9000}
_z_dirs | awk -v path="$*" -v now="$(date +%s)" -v score=$score -F"|" '
_z_dirs | \awk -v path="$*" -v now="$(\date +%s)" -v score=$score -F"|" '
BEGIN {
rank[path] = 1
time[path] = now
Expand All @@ -95,15 +95,15 @@ _z() {
' 2>/dev/null >| "$tempfile"
# do our best to avoid clobbering the datafile in a race condition.
if [ $? -ne 0 -a -f "$datafile" ]; then
env rm -f "$tempfile"
\env rm -f "$tempfile"
else
[ "$_Z_OWNER" ] && chown $_Z_OWNER:"$(id -ng $_Z_OWNER)" "$tempfile"
env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile"
\env mv -f "$tempfile" "$datafile" || \env rm -f "$tempfile"
fi

# tab completion
elif [ "$1" = "--complete" -a -s "$datafile" ]; then
_z_dirs | awk -v q="$2" -F"|" '
_z_dirs | \awk -v q="$2" -F"|" '
BEGIN {
q = substr(q, 3)
if( q == tolower(q) ) imatch = 1
Expand All @@ -128,7 +128,7 @@ _z() {
l) list=1;;
r) typ="rank";;
t) typ="recent";;
x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
x) \sed -i -e "\:^${PWD}|.*:d" "$datafile";;
esac; opt=${opt:1}; done;;
*) fnd="$fnd${fnd:+ }$1";;
esac; last=$1; [ "$#" -gt 0 ] && shift; done
Expand All @@ -144,7 +144,7 @@ _z() {
[ -f "$datafile" ] || return

local cd
cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
cd="$( < <( _z_dirs ) \awk -v t="$(\date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
function frecent(rank, time) {
# relate frequency and time
dx = t - time
Expand Down

0 comments on commit 67dcd45

Please sign in to comment.