2015-09-20 20:39:46 +08:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
REPO_DIR="${0%/*}"
|
|
|
|
CONFIG_DIR="$HOME/.config/znt"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Copy configs
|
|
|
|
#
|
|
|
|
|
|
|
|
if ! test -d "$HOME/.config"; then
|
|
|
|
mkdir "$HOME/.config"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! test -d "$CONFIG_DIR"; then
|
|
|
|
mkdir "$CONFIG_DIR"
|
|
|
|
fi
|
|
|
|
|
2016-04-30 21:16:00 +08:00
|
|
|
# 9 files
|
2015-09-20 20:39:46 +08:00
|
|
|
set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
|
|
|
|
|
2016-04-30 21:16:00 +08:00
|
|
|
# Check for random 2 files if they exist
|
|
|
|
# This will shift 0 - 7 elements
|
|
|
|
shift $(( RANDOM % 8 ))
|
|
|
|
if ! test -f "$CONFIG_DIR/$1" || ! test -f "$CONFIG_DIR/$2"; then
|
|
|
|
# Something changed - examine every file
|
|
|
|
set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
|
|
|
|
for i; do
|
|
|
|
if ! test -f "$CONFIG_DIR/$i"; then
|
|
|
|
cp "$REPO_DIR/.config/znt/$i" "$CONFIG_DIR"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2015-09-20 20:39:46 +08:00
|
|
|
|
2016-04-20 13:33:10 +08:00
|
|
|
# Don't leave positional parameters being set
|
|
|
|
set --
|
|
|
|
|
2015-09-20 20:39:46 +08:00
|
|
|
#
|
|
|
|
# Load functions
|
|
|
|
#
|
|
|
|
|
2016-04-30 21:16:00 +08:00
|
|
|
autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize n-help
|
2015-09-20 20:39:46 +08:00
|
|
|
autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget
|
|
|
|
alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history
|
2016-04-30 21:16:00 +08:00
|
|
|
alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help
|
2015-09-20 20:39:46 +08:00
|
|
|
|
|
|
|
zle -N znt-history-widget
|
|
|
|
bindkey '^R' znt-history-widget
|
|
|
|
setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS
|
2016-04-30 21:16:00 +08:00
|
|
|
zstyle ':completion::complete:n-kill::bits' matcher 'r:|=** l:|=*'
|
2015-09-20 20:39:46 +08:00
|
|
|
|