Compare commits
133 Commits
info
...
12449788a6
Author | SHA1 | Date | |
---|---|---|---|
12449788a6
|
|||
3b6c18395b
|
|||
c58b27fe29
|
|||
403b8a7e6c
|
|||
8137c7efde
|
|||
b12c01b3cb
|
|||
88262ef200
|
|||
fa00d72cbc
|
|||
e9e9b7fc51
|
|||
5662040673
|
|||
5cfbe03d71
|
|||
4e67805847
|
|||
8956cd7280
|
|||
61fb51b3eb
|
|||
4e8515debe
|
|||
bc90303dc1
|
|||
055de153b1
|
|||
6c0ac78b6e
|
|||
e6678b1a31
|
|||
bd1f46dec6
|
|||
9012696fea
|
|||
0ae83ee81b
|
|||
4112913166
|
|||
8378e9993d
|
|||
e3ff1bcb69
|
|||
8283b6c752
|
|||
785294aef5
|
|||
dc30f109cf
|
|||
d9ef22abc5
|
|||
69ba98a9d5
|
|||
b2436b9e21
|
|||
5a9f0b08c0
|
|||
98deefe039
|
|||
6d29f9afbc
|
|||
20aafe29e8
|
|||
8834da817c
|
|||
25123cece2
|
|||
3f527a0c73
|
|||
3321d21f8b
|
|||
7aac214e04
|
|||
0bb93c3b11
|
|||
ea774fdd8b
|
|||
d872b655c9
|
|||
47b2170058
|
|||
0289d90fb9
|
|||
a54be4863a
|
|||
d05065f3aa
|
|||
af26648283
|
|||
b9b056d10d
|
|||
f77e4a54bc
|
|||
9725317a4a
|
|||
aea9334649
|
|||
8af457ab05
|
|||
d65860c0ac
|
|||
9d1de60648
|
|||
d5209414e9
|
|||
ad4acd935a
|
|||
9bd1bb79ea
|
|||
19571a4046
|
|||
7a8ba289fa
|
|||
086279d721
|
|||
d2061dda65
|
|||
5fd6a13726
|
|||
e10445bf10
|
|||
80ae65a3fa
|
|||
25c314caa9
|
|||
e76ed11c36
|
|||
2ef127fe7a
|
|||
3220c72f6f
|
|||
55324be58e
|
|||
ac9d7a7de6
|
|||
5041d2c7e7
|
|||
f6a2541e4f
|
|||
732d00440e
|
|||
e59ee51009
|
|||
de28616e6c
|
|||
d524b4255a
|
|||
724df8e2d8
|
|||
0ec196bef2
|
|||
23275ec9fc
|
|||
2622b6e7e8
|
|||
4a2b874478
|
|||
48a90c3981
|
|||
f0a6c78243
|
|||
faae072861
|
|||
a70347e7f7
|
|||
3b50183a0d
|
|||
113ce00644
|
|||
e6fef308ef
|
|||
5e2f600eba
|
|||
27137da435
|
|||
cf3e5623ab
|
|||
731471aee7
|
|||
95d73f7f64
|
|||
59c691e5df
|
|||
5e64dfe3fe
|
|||
e1ac7abd92
|
|||
7f0793da39
|
|||
3c91a3f5ae
|
|||
deed34735d
|
|||
54ae3affd0
|
|||
6ecf110b2c
|
|||
bc5e07f76e
|
|||
f07d2d3b35
|
|||
e9ba43b038
|
|||
1c849b0404
|
|||
765d07a7b8
|
|||
6530af46f0
|
|||
5addb3ae5e
|
|||
5626190a83
|
|||
2e41d859c9
|
|||
b0e681a87a
|
|||
786277961d
|
|||
e014ff180f
|
|||
17ef24e460
|
|||
5a06ade27b
|
|||
83a61a4c2f
|
|||
5394f208b6
|
|||
a312de64e1
|
|||
04b31f7a24
|
|||
a6b87e2330
|
|||
4cc414b20d
|
|||
100187ca04
|
|||
ac12fc459b
|
|||
7bf6262945
|
|||
26f29d0514
|
|||
ad82f32828
|
|||
87d9c7f978
|
|||
eeaa54993a
|
|||
32bd17a702
|
|||
9e79767704
|
|||
467332a5ec
|
|||
28231f278c
|
0
.cache/zsh/compcache/.keep
Normal file
0
.cache/zsh/compcache/.keep
Normal file
0
.cache/zsh/completion/.keep
Normal file
0
.cache/zsh/completion/.keep
Normal file
0
.cache/zsh/compzwc/.keep
Normal file
0
.cache/zsh/compzwc/.keep
Normal file
0
.cache/zsh/ssh/.keep
Normal file
0
.cache/zsh/ssh/.keep
Normal file
0
.config/dotfiles/bin/.keep
Normal file
0
.config/dotfiles/bin/.keep
Normal file
32
.config/dotfiles/gen-gitignore.sh
Executable file
32
.config/dotfiles/gen-gitignore.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -ef
|
||||
|
||||
path_gitignore='.config/dotfiles/gitignore'
|
||||
|
||||
gen_gitignore() {
|
||||
git rev-parse --git-dir >/dev/null 2>&1
|
||||
touch "$1"
|
||||
{
|
||||
echo '*'
|
||||
git ls-files | sed -E 's:^:!/:'
|
||||
} > "$1"
|
||||
exit 0
|
||||
}
|
||||
|
||||
me=$(readlink -e "$0")
|
||||
topdir=$(printf '%s' "${me}" | sed -E 's:/[^/]+/[^/]+/[^/]+$::')
|
||||
cd "${topdir}"
|
||||
|
||||
export GIT_OPTIONAL_LOCKS=0
|
||||
|
||||
dir="${me%/*}/repo.git"
|
||||
if [ -d "${dir}" ] ; then
|
||||
## end-point installation
|
||||
GIT_DIR="${dir}"
|
||||
GIT_WORK_TREE="${topdir}"
|
||||
export GIT_DIR GIT_WORK_TREE
|
||||
gen_gitignore "${GIT_WORK_TREE}/${path_gitignore}"
|
||||
else
|
||||
## development tree
|
||||
gen_gitignore "${path_gitignore}"
|
||||
fi
|
0
.config/dotfiles/gitattributes
Normal file
0
.config/dotfiles/gitattributes
Normal file
94
.config/dotfiles/gitignore
Normal file
94
.config/dotfiles/gitignore
Normal file
@@ -0,0 +1,94 @@
|
||||
*
|
||||
!/.cache/zsh/compcache/.keep
|
||||
!/.cache/zsh/completion/.keep
|
||||
!/.cache/zsh/compzwc/.keep
|
||||
!/.cache/zsh/ssh/.keep
|
||||
!/.config/dotfiles/bin/.keep
|
||||
!/.config/dotfiles/gen-gitignore.sh
|
||||
!/.config/dotfiles/gitattributes
|
||||
!/.config/dotfiles/gitignore
|
||||
!/.config/dotfiles/gitignore.vcs
|
||||
!/.config/dotfiles/install.sh
|
||||
!/.config/dotfiles/scripts/.keep
|
||||
!/.config/dotfiles/woodpecker.yml
|
||||
!/.config/htop/htoprc.dist
|
||||
!/.config/mc/ini.dist
|
||||
!/.config/sbuild/config.pl.dist
|
||||
!/.config/zsh.dots/.zshenv
|
||||
!/.config/zsh/_.zsh
|
||||
!/.config/zsh/_wip/enclave.zsh.wip
|
||||
!/.config/zsh/alias.zsh
|
||||
!/.config/zsh/alias/containers.zsh
|
||||
!/.config/zsh/alias/diff.zsh
|
||||
!/.config/zsh/alias/directories.zsh
|
||||
!/.config/zsh/alias/git.zsh
|
||||
!/.config/zsh/alias/gpg.zsh
|
||||
!/.config/zsh/alias/grep.zsh
|
||||
!/.config/zsh/alias/history.zsh
|
||||
!/.config/zsh/alias/idle.zsh
|
||||
!/.config/zsh/alias/k8s.zsh
|
||||
!/.config/zsh/alias/kconfig.zsh
|
||||
!/.config/zsh/alias/ls.zsh
|
||||
!/.config/zsh/alias/openwrt.zsh
|
||||
!/.config/zsh/alias/quilt.zsh
|
||||
!/.config/zsh/alias/sbuild.zsh
|
||||
!/.config/zsh/alias/sudo.zsh
|
||||
!/.config/zsh/alias/telnet.zsh
|
||||
!/.config/zsh/completion/.keep
|
||||
!/.config/zsh/completion/bash.zsh
|
||||
!/.config/zsh/completion/external.zsh
|
||||
!/.config/zsh/completion/system.zsh
|
||||
!/.config/zsh/env.zsh
|
||||
!/.config/zsh/env/aux.zsh
|
||||
!/.config/zsh/env/containers.zsh
|
||||
!/.config/zsh/env/gopath.zsh
|
||||
!/.config/zsh/env/history.zsh
|
||||
!/.config/zsh/env/ld.so.zsh
|
||||
!/.config/zsh/env/pager.zsh
|
||||
!/.config/zsh/env/quilt.zsh
|
||||
!/.config/zsh/env/sed.zsh
|
||||
!/.config/zsh/env/xdg.zsh
|
||||
!/.config/zsh/lib.zsh
|
||||
!/.config/zsh/lib/alternatives.zsh
|
||||
!/.config/zsh/lib/cmdtime.zsh
|
||||
!/.config/zsh/lib/completion.zsh
|
||||
!/.config/zsh/lib/csv.zsh
|
||||
!/.config/zsh/lib/curl.zsh
|
||||
!/.config/zsh/lib/git.zsh
|
||||
!/.config/zsh/lib/gpg.zsh
|
||||
!/.config/zsh/lib/history.zsh
|
||||
!/.config/zsh/lib/prompt.zsh
|
||||
!/.config/zsh/lib/pswalk.zsh
|
||||
!/.config/zsh/lib/say-my.zsh
|
||||
!/.config/zsh/lib/selfservice.zsh
|
||||
!/.config/zsh/lib/systemd.zsh
|
||||
!/.config/zsh/lib/term.zsh
|
||||
!/.config/zsh/lib/time.zsh
|
||||
!/.config/zsh/lib/title.zsh
|
||||
!/.config/zsh/local.zsh.example
|
||||
!/.config/zsh/local/.keep
|
||||
!/.config/zsh/local/completion/.keep
|
||||
!/.config/zsh/local/env.zsh.example
|
||||
!/.config/zsh/opt.zsh
|
||||
!/.config/zsh/opt/chase.zsh
|
||||
!/.config/zsh/opt/completion.zsh
|
||||
!/.config/zsh/opt/directories.zsh
|
||||
!/.config/zsh/opt/history.zsh
|
||||
!/.config/zsh/opt/prompt.zsh
|
||||
!/.config/zsh/rc.zsh
|
||||
!/.config/zsh/rc/completion.zsh
|
||||
!/.config/zsh/rc/gpg-agent.zsh
|
||||
!/.config/zsh/rc/keyboard.zsh
|
||||
!/.config/zsh/rc/pager.zsh
|
||||
!/.config/zsh/rc/prompt.zsh
|
||||
!/.config/zsh/rc/ssh-agent.zsh
|
||||
!/.config/zsh/rc/terminal.zsh
|
||||
!/.config/zsh/var/.keep
|
||||
!/.gdbinit
|
||||
!/.gitconfig
|
||||
!/.sbuildrc.dist
|
||||
!/.screenrc
|
||||
!/.selected_editor
|
||||
!/.vimrc
|
||||
!/.zshenv
|
||||
!/.zshrc
|
18
.config/dotfiles/gitignore.vcs
Normal file
18
.config/dotfiles/gitignore.vcs
Normal file
@@ -0,0 +1,18 @@
|
||||
!/.cache/zsh/compcache/.keep
|
||||
!/.cache/zsh/completion/.keep
|
||||
!/.cache/zsh/compzwc/.keep
|
||||
!/.cache/zsh/ssh/.keep
|
||||
!/.config/zsh/local/.keep
|
||||
!/.config/zsh/local/completion/.keep
|
||||
!/.config/zsh/local/env.zsh.example
|
||||
!/.config/zsh/var/.keep
|
||||
|
||||
/.cache/zsh/compcache/*
|
||||
/.cache/zsh/compdump
|
||||
/.cache/zsh/completion/*
|
||||
/.cache/zsh/compzwc/*
|
||||
/.cache/zsh/ssh/*
|
||||
/.config/zsh/**/*.zwc
|
||||
/.config/zsh/local.zsh
|
||||
/.config/zsh/local/*
|
||||
/.config/zsh/var/*
|
278
.config/dotfiles/install.sh
Executable file
278
.config/dotfiles/install.sh
Executable file
@@ -0,0 +1,278 @@
|
||||
#!/bin/sh
|
||||
set -ef
|
||||
|
||||
uri_krdsh="${GITKRDSH:-https://git.krd.sh/krd}/dotfiles"
|
||||
uri_github="${GITHUB:-https://github.com/rockdrilla}/dotfiles"
|
||||
|
||||
git_branch='main'
|
||||
|
||||
d_repo='.config/dotfiles/repo.git'
|
||||
f_gitignore='.config/dotfiles/gitignore'
|
||||
|
||||
have_cmd() {
|
||||
command -v "$1" >/dev/null 2>&1 || return $?
|
||||
}
|
||||
|
||||
fetch() {
|
||||
if have_cmd curl ; then
|
||||
curl -sSL ${2:+ -o "$2" } "$1" || return $?
|
||||
return 0
|
||||
fi
|
||||
if have_cmd wget ; then
|
||||
if [ -n "$2" ] ; then
|
||||
wget -q -O - "$1" > "$2" || return $?
|
||||
else
|
||||
wget -q -O - "$1" || return $?
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
x=/usr/lib/apt/apt-helper
|
||||
if have_cmd $x ; then
|
||||
if [ -n "$2" ] ; then
|
||||
$x download-file "$1" "$2" || return $?
|
||||
return 0
|
||||
fi
|
||||
__fetch_t=$(mktemp) || return 1
|
||||
set +e
|
||||
(
|
||||
set -e
|
||||
$x download-file "$1" "${__fetch_t}" || return $?
|
||||
cat "${__fetch_t}"
|
||||
)
|
||||
__fetch_r=$?
|
||||
rm -f "${__fetch_t}" ; unset __fetch_t
|
||||
return ${__fetch_r}
|
||||
fi
|
||||
echo 'no method is available to fetch URLs' >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
test_forge() {
|
||||
fetch "$1" "$2" || return 1
|
||||
[ "$(head -n 1 "$2")" = '*' ] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
select_forge() {
|
||||
unset uri_gitignore uri_repo uri_tarball
|
||||
__t=$(mktemp)
|
||||
## try with git.krd.sh
|
||||
while [ -z "${uri_repo}" ] ; do
|
||||
t_gitignore="${uri_krdsh}/raw/branch/${git_branch}/${f_gitignore}"
|
||||
test_forge "${t_gitignore}" "${__t}" || break
|
||||
|
||||
uri_repo="${uri_krdsh}.git"
|
||||
uri_gitignore="${t_gitignore}"
|
||||
uri_tarball="${uri_krdsh}/archive/${git_branch}.tar.gz"
|
||||
|
||||
break
|
||||
done
|
||||
## try with github.com
|
||||
while [ -z "${uri_repo}" ] ; do
|
||||
t_gitignore="${uri_github}/raw/${git_branch}/${f_gitignore}"
|
||||
test_forge "${t_gitignore}" "${__t}" || break
|
||||
|
||||
uri_repo="${uri_github}.git"
|
||||
uri_gitignore="${t_gitignore}"
|
||||
uri_tarball="${uri_github}/archive/refs/heads/${git_branch}.tar.gz"
|
||||
|
||||
break
|
||||
done
|
||||
rm -f "${__t}" ; unset __t
|
||||
unset t_gitignore
|
||||
if [ -n "${uri_repo}" ] ; then
|
||||
return 0
|
||||
fi
|
||||
echo 'no forge is available to fetch URLs' >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
main() {
|
||||
## test connectivity and select forge
|
||||
select_forge
|
||||
|
||||
umask 0077
|
||||
|
||||
if have_cmd git ; then
|
||||
if [ -s "${HOME}/${d_repo}/HEAD" ] ; then
|
||||
dot_update
|
||||
else
|
||||
dot_install
|
||||
fi
|
||||
else
|
||||
echo 'git is missing, proceed "raw" installation.' >&2
|
||||
dot_install_raw
|
||||
fi
|
||||
|
||||
propagate_dist_files
|
||||
|
||||
echo 'installed.' >&2
|
||||
}
|
||||
|
||||
dot_install() {
|
||||
backup_unconditionally
|
||||
git_env
|
||||
mkdir -p "${GIT_DIR}"
|
||||
git init
|
||||
git branch -M "${git_branch}" || true
|
||||
git_config_init
|
||||
git_update
|
||||
}
|
||||
|
||||
dot_update() {
|
||||
git_env
|
||||
git_update
|
||||
}
|
||||
|
||||
find_fast() {
|
||||
find "$@" -printf . -quit | grep -Fq .
|
||||
}
|
||||
|
||||
dot_install_raw() {
|
||||
tf_tar=$(mktemp)
|
||||
fetch "${uri_tarball}" "${tf_tar}"
|
||||
|
||||
td_tree=$(mktemp -d)
|
||||
|
||||
if ! tar_try_extract "${tf_tar}" "${td_tree}" "${f_gitignore}" ; then
|
||||
rm -rf "${tf_tar}" "${td_tree}"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "${tf_tar}"
|
||||
|
||||
tf_list=$(mktemp)
|
||||
fetch "${uri_gitignore}" \
|
||||
| sed -En '/^!\/(.+)$/{s//\1/;p;}' \
|
||||
> "${tf_list}"
|
||||
|
||||
td_backup=$(mktemp -d)
|
||||
while read -r f ; do
|
||||
if [ -f "${HOME}/$f" ] ; then
|
||||
if cmp_files "${td_tree}" "${HOME}" "$f" ; then
|
||||
continue
|
||||
fi
|
||||
d=$(dirname "$f")
|
||||
if [ -n "$d" ] ; then
|
||||
mkdir -p "${td_backup}/$d"
|
||||
fi
|
||||
cat < "${HOME}/$f" > "${td_backup}/$f"
|
||||
fi
|
||||
done < "${tf_list}"
|
||||
rm -f "${tf_list}" ; unset tf_list
|
||||
|
||||
tar -C "${td_tree}" -cf . - | tar -C "${HOME}" -xf -
|
||||
rm -rf "${td_tree}"
|
||||
|
||||
if find_fast "${td_backup}/" -mindepth 1 ; then
|
||||
echo "backed-up files are here: ${td_backup}/"
|
||||
find "${td_backup}/" -mindepth 1 -ls
|
||||
else
|
||||
rmdir "${td_backup}"
|
||||
fi
|
||||
}
|
||||
|
||||
git_env() {
|
||||
GIT_DIR="${HOME}/${d_repo}"
|
||||
GIT_WORK_TREE="${HOME}"
|
||||
export GIT_DIR GIT_WORK_TREE
|
||||
}
|
||||
|
||||
git_config_init() {
|
||||
## remote
|
||||
git remote add origin "${uri_repo}"
|
||||
git config remote.origin.fetch "+refs/heads/${git_branch}:refs/remotes/origin/${git_branch}"
|
||||
git config remote.origin.tagopt '--no-tags'
|
||||
git config "branch.${git_branch}.remote" origin
|
||||
## repo-specific
|
||||
git config core.worktree "${GIT_WORK_TREE}"
|
||||
git config core.excludesfile "${f_gitignore}"
|
||||
}
|
||||
|
||||
git_config() {
|
||||
## repo-specific
|
||||
git remote set-url origin "${uri_repo}"
|
||||
git config core.attributesfile .config/dotfiles/gitattributes
|
||||
## migration (remove later)
|
||||
git config --unset gc.auto || :
|
||||
git config --unset pull.ff || :
|
||||
## size optimization
|
||||
git config core.bigFileThreshold 64k
|
||||
git config core.compression 9
|
||||
git config core.looseCompression 8
|
||||
git config pack.compression 9
|
||||
git config pack.threads 2
|
||||
## generic
|
||||
git config receive.denyNonFastForwards true
|
||||
}
|
||||
|
||||
git_update() {
|
||||
git_config
|
||||
git remote update -p
|
||||
git pull || git reset --hard "origin/${git_branch}"
|
||||
git gc --aggressive --prune=all --force || git gc || true
|
||||
}
|
||||
|
||||
tar_test() {
|
||||
tar --wildcards -tf "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
tar_try_extract() {
|
||||
if tar_test "$1" "$3" ; then
|
||||
tar -C "$2" -xf "$2"
|
||||
return
|
||||
fi
|
||||
opt='--strip-components=1'
|
||||
if tar_test "$1" ${opt} "*/$3" ; then
|
||||
tar -C "$2" ${opt} -xf "$2"
|
||||
return
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
cmp_files() {
|
||||
cmp -s "$1/$3" "$2/$3" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
backup_unconditionally() {
|
||||
tf_list=$(mktemp)
|
||||
fetch "${uri_gitignore}" \
|
||||
| sed -En '/^!\/(.+)$/{s//\1/;p;}' \
|
||||
> "${tf_list}"
|
||||
|
||||
td_backup=$(mktemp -d)
|
||||
while read -r f ; do
|
||||
if [ -f "${HOME}/$f" ] ; then
|
||||
d=$(dirname "$f")
|
||||
if [ -n "$d" ] ; then
|
||||
mkdir -p "${td_backup}/$d"
|
||||
fi
|
||||
mv -f "${HOME}/$f" "${td_backup}/$f"
|
||||
fi
|
||||
done < "${tf_list}"
|
||||
rm -f "${tf_list}" ; unset tf_list
|
||||
|
||||
if find_fast "${td_backup}/" -mindepth 1 ; then
|
||||
echo "backed-up files are here: ${td_backup}/"
|
||||
find "${td_backup}/" -mindepth 1 -ls
|
||||
else
|
||||
rmdir "${td_backup}"
|
||||
fi
|
||||
}
|
||||
|
||||
propagate_dist_files() {
|
||||
tf_list=$(mktemp)
|
||||
sed -En '/^!\/(.+\.dist)$/{s//\1/;p;}' < "${HOME}/${f_gitignore}" > "${tf_list}"
|
||||
|
||||
while read -r f_dist ; do
|
||||
[ -n "${f_dist}" ] || continue
|
||||
[ -f "${f_dist}" ] || continue
|
||||
|
||||
f=${f_dist%.dist}
|
||||
if [ -f "$f" ] ; then continue ; fi
|
||||
|
||||
cp "${f_dist}" "$f"
|
||||
done < "${tf_list}"
|
||||
rm -f "${tf_list}" ; unset tf_list
|
||||
}
|
||||
|
||||
main "$@"
|
0
.config/dotfiles/scripts/.keep
Normal file
0
.config/dotfiles/scripts/.keep
Normal file
34
.config/dotfiles/woodpecker.yml
Normal file
34
.config/dotfiles/woodpecker.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
steps:
|
||||
- name: check
|
||||
image: docker.io/debian:bookworm-slim
|
||||
environment:
|
||||
DEBCONF_NONINTERACTIVE_SEEN: 'true'
|
||||
DEBIAN_FRONTEND: 'noninteractive'
|
||||
DEBIAN_PRIORITY: 'critical'
|
||||
TERM: 'linux'
|
||||
MALLOC_ARENA_MAX: '4'
|
||||
commands:
|
||||
- |
|
||||
: # install required packages
|
||||
apt-get -y update
|
||||
apt-get -y install file findutils git shellcheck zsh
|
||||
apt-get -y clean
|
||||
- |
|
||||
: # verify that repo doesn't contain "garbage"
|
||||
find_fast() {
|
||||
find "$@" -printf . -quit | grep -Fq .
|
||||
}
|
||||
if find_fast ./ -type f -name '*.zwc' ; then
|
||||
echo 'found *.zwc' >&2
|
||||
find ./ -type f -name '*.zwc' | sort -V
|
||||
exit 1
|
||||
fi
|
||||
- |
|
||||
: # try zsh compile
|
||||
git ls-files | sort -uV | xargs -r file -N -i | grep text/x-shellscript | cut -d: -f1 \
|
||||
| xargs -r -n1 zsh -efc 'zcompile -UR "$@"' --
|
||||
find ./ -type f -name '*.zwc' -delete
|
||||
- |
|
||||
: # try shellcheck (except for *.zsh)
|
||||
git ls-files | grep -Fv '.zsh' | sort -uV | xargs -r file -N -i | grep text/x-shellscript | cut -d: -f1 \
|
||||
| xargs -r -n1 shellcheck
|
65
.config/htop/htoprc.dist
Normal file
65
.config/htop/htoprc.dist
Normal file
@@ -0,0 +1,65 @@
|
||||
# Beware! This file is rewritten by htop when settings are changed in the interface.
|
||||
# The parser is also very primitive, and not human-friendly.
|
||||
htop_version=3.3.0
|
||||
config_reader_min_version=3
|
||||
fields=0 48 17 18 38 39 40 2 46 47 49 1
|
||||
hide_kernel_threads=1
|
||||
hide_userland_threads=1
|
||||
hide_running_in_container=0
|
||||
shadow_other_users=0
|
||||
show_thread_names=1
|
||||
show_program_path=1
|
||||
highlight_base_name=1
|
||||
highlight_deleted_exe=1
|
||||
shadow_distribution_path_prefix=1
|
||||
highlight_megabytes=1
|
||||
highlight_threads=1
|
||||
highlight_changes=0
|
||||
highlight_changes_delay_secs=5
|
||||
find_comm_in_cmdline=1
|
||||
strip_exe_from_cmdline=1
|
||||
show_merged_command=0
|
||||
header_margin=1
|
||||
screen_tabs=1
|
||||
detailed_cpu_time=1
|
||||
cpu_count_from_one=0
|
||||
show_cpu_usage=1
|
||||
show_cpu_frequency=1
|
||||
show_cpu_temperature=1
|
||||
degree_fahrenheit=0
|
||||
update_process_names=0
|
||||
account_guest_in_cpu_meter=1
|
||||
color_scheme=0
|
||||
enable_mouse=1
|
||||
delay=11
|
||||
hide_function_bar=0
|
||||
header_layout=three_30_40_30
|
||||
column_meters_0=Hostname System DateTime Uptime Blank Tasks LoadAverage FileDescriptors
|
||||
column_meter_modes_0=2 2 2 2 2 2 2 2
|
||||
column_meters_1=Memory HugePages Swap Blank AllCPUs2
|
||||
column_meter_modes_1=1 1 1 2 1
|
||||
column_meters_2=DiskIO NetworkIO Battery Blank PressureStallCPUSome PressureStallMemorySome PressureStallMemoryFull PressureStallIOSome PressureStallIOFull
|
||||
column_meter_modes_2=2 2 2 2 2 2 2 2 2
|
||||
tree_view=1
|
||||
sort_key=46
|
||||
tree_sort_key=0
|
||||
sort_direction=-1
|
||||
tree_sort_direction=1
|
||||
tree_view_always_by_pid=1
|
||||
all_branches_collapsed=0
|
||||
screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command
|
||||
.sort_key=PERCENT_CPU
|
||||
.tree_sort_key=PID
|
||||
.tree_view_always_by_pid=1
|
||||
.tree_view=1
|
||||
.sort_direction=-1
|
||||
.tree_sort_direction=1
|
||||
.all_branches_collapsed=0
|
||||
screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command
|
||||
.sort_key=PID
|
||||
.tree_sort_key=PID
|
||||
.tree_view_always_by_pid=1
|
||||
.tree_view=1
|
||||
.sort_direction=-1
|
||||
.tree_sort_direction=1
|
||||
.all_branches_collapsed=0
|
2
.config/mc/ini.dist
Normal file
2
.config/mc/ini.dist
Normal file
@@ -0,0 +1,2 @@
|
||||
[Midnight-Commander]
|
||||
skin=dark
|
21
.config/sbuild/config.pl.dist
Normal file
21
.config/sbuild/config.pl.dist
Normal file
@@ -0,0 +1,21 @@
|
||||
$chroot_mode = "schroot";
|
||||
$build_path = '';
|
||||
|
||||
$pgp_options = [ '-us', '-uc', '-ui' ];
|
||||
|
||||
$build_arch_all = 1;
|
||||
$build_arch_any = 1;
|
||||
$check_space = 0;
|
||||
$enable_network = 1;
|
||||
|
||||
$run_autopkgtest = 0;
|
||||
$run_lintian = 0;
|
||||
$run_piuparts = 0;
|
||||
|
||||
$apt_distupgrade = 0;
|
||||
$apt_upgrade = 0;
|
||||
|
||||
$purge_build_directory = 'successful';
|
||||
|
||||
# don't remove this, Perl needs it:
|
||||
1;
|
6
.config/zsh.dots/.zshenv
Normal file
6
.config/zsh.dots/.zshenv
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
if [[ -o interactive ]] ; then
|
||||
## early redirect
|
||||
ZDOTDIR="${ZDOTDIR%/${ZDOTDIR:t2}}"
|
||||
source "${ZDOTDIR}/.zshenv"
|
||||
fi
|
55
.config/zsh/_.zsh
Normal file
55
.config/zsh/_.zsh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## early module load
|
||||
zmodload -s zsh/zprof
|
||||
|
||||
typeset -gA ZSHU
|
||||
|
||||
ZSHU[t_begin]=${(%):-%D{%s.%6.}}
|
||||
|
||||
ZSHU[d_zdot]="${ZDOTDIR}"
|
||||
ZSHU[d_dotfiles]="${ZDOTDIR}/.config/dotfiles"
|
||||
ZSHU[d_conf]="${ZDOTDIR}/.config/zsh"
|
||||
ZSHU[d_cache]="${ZDOTDIR}/.cache/zsh"
|
||||
|
||||
ZSHU[d_var]="${ZSHU[d_conf]}/var"
|
||||
ZSHU[d_bin]="${ZSHU[d_dotfiles]}/bin"
|
||||
ZSHU[d_scripts]="${ZSHU[d_dotfiles]}/scripts"
|
||||
|
||||
## early escape
|
||||
unsetopt global_rcs
|
||||
|
||||
## safety measure:
|
||||
## redirect all following activity within ZDOTDIR to cache
|
||||
export ZDOTDIR="${ZDOTDIR}/.config/zsh.dots"
|
||||
|
||||
## cleanup: start from scratch
|
||||
for i ( a s f d ) ; do unhash -$i -m '*' ; done ; unset i
|
||||
|
||||
## set default umask
|
||||
umask 0022
|
||||
|
||||
zshu_parts=( env opt lib rc alias local )
|
||||
|
||||
for n ( ${zshu_parts} ) ; do
|
||||
[ -s "${ZSHU[d_conf]}/$n.zsh" ] || continue
|
||||
source "${ZSHU[d_conf]}/$n.zsh"
|
||||
done ; unset n
|
||||
|
||||
for n ( ${zshu_parts} ) ; do
|
||||
[ -d "${ZSHU[d_conf]}/$n" ] || continue
|
||||
for i ( "${ZSHU[d_conf]}/$n"/*.zsh(N.r) ) ; do
|
||||
source "$i"
|
||||
done
|
||||
done ; unset i n
|
||||
|
||||
unset zshu_parts
|
||||
|
||||
hash -f
|
||||
|
||||
t=${(%):-%D{%s.%6.}}
|
||||
t=$[ t - ZSHU[t_begin] ]
|
||||
unset 'ZSHU[t_begin]'
|
||||
n=${t#*.}
|
||||
ZSHU[t_load]=${t%.*}.${n:0:4}
|
||||
unset n t
|
63
.config/zsh/_wip/enclave.zsh.wip
Normal file
63
.config/zsh/_wip/enclave.zsh.wip
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/zsh
|
||||
|
||||
if autoload -Uz add-zsh-hook ; then
|
||||
|
||||
ZSHU[f_enclave]="${ZSHU[d_var]}/enclave"
|
||||
[ -f "${ZSHU[f_enclave]}" ] || touch "${ZSHU[f_enclave]}"
|
||||
[ -s "${ZSHU[f_enclave]}" ] && . "${ZSHU[f_enclave]}"
|
||||
|
||||
## <test data>
|
||||
test_enclave_enter() { echo "you are in $1 enclave" 1>&2 ; }
|
||||
test_enclave_leave() { echo "you are left $1 enclave" 1>&2 ; }
|
||||
|
||||
zstyle ":enclave:box1:path:${HOME}/prj/*" ''
|
||||
zstyle ":enclave:box1:path:${HOME}/prj/_stale/*" exclude
|
||||
zstyle ':enclave:box1:env:unset' 'var2'
|
||||
zstyle ':enclave:box1:env:set' 'var1' 1
|
||||
zstyle ':enclave:box1:on_enter' test_enclave_enter
|
||||
zstyle ':enclave:box1:on_leave' test_enclave_leave
|
||||
|
||||
zstyle ":enclave:box2:path:${HOME}/doc/*" ''
|
||||
zstyle ":enclave:box2:path:${HOME}/doc/work/*" exclude
|
||||
zstyle ':enclave:box2:env:unset' 'var1'
|
||||
zstyle ':enclave:box2:env:set' 'var2' 1
|
||||
zstyle ':enclave:box2:on_enter' test_enclave_enter
|
||||
zstyle ':enclave:box2:on_leave' test_enclave_leave
|
||||
|
||||
typeset -g var1=0
|
||||
typeset -g var2=0
|
||||
## </test data>
|
||||
|
||||
__z_enclave_list() {
|
||||
local -aU list=( $(zstyle -L ':enclave:*' \
|
||||
| sed -En "/^zstyle '?:enclave:([^:]+):.*\$/{s//\1/;p;}") )
|
||||
printf '%s' "${(j: :)list}"
|
||||
}
|
||||
|
||||
__z_chpwd_enclave() {
|
||||
[ -z "${PWD}" ] && return
|
||||
## enclave changed? if no - do nothing
|
||||
[ -z "${OLDPWD}" ] && return
|
||||
[ "${PWD}" = "${OLDPWD}" ] && return
|
||||
|
||||
local a
|
||||
zstyle -s ":enclave:*:path:$PWD" '' a && \
|
||||
declare -p a
|
||||
|
||||
## call on_leave()
|
||||
## unset previously set
|
||||
## set previously set
|
||||
|
||||
env > /tmp/env
|
||||
}
|
||||
|
||||
# zstyle -L ':enclave:*'
|
||||
# echo
|
||||
|
||||
|
||||
add-zsh-hook chpwd __z_chpwd_enclave
|
||||
__z_chpwd_enclave
|
||||
|
||||
else
|
||||
echo "enclaves are disabled due to missing hook support" 1>&2
|
||||
fi
|
5
.config/zsh/alias.zsh
Normal file
5
.config/zsh/alias.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
alias which='whence -p '
|
||||
alias which-command='whence -p '
|
||||
alias zsh-which='whence -c '
|
197
.config/zsh/alias/containers.zsh
Normal file
197
.config/zsh/alias/containers.zsh
Normal file
@@ -0,0 +1,197 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -Uga ZSHU_CNTR_SHELLS=( /bin/bash /bin/sh /bin/ash )
|
||||
typeset -ga ZSHU_CNTR_FALLBACK_SHELL=( /busybox/busybox sh )
|
||||
|
||||
alias bud='buildah bud --network=host -f '
|
||||
|
||||
function {
|
||||
local i
|
||||
for i ( run images ps top inspect logs ) ; do
|
||||
alias "pod-$i"="podman $i "
|
||||
done
|
||||
}
|
||||
|
||||
z-pod() { command podman "$@" ; }
|
||||
|
||||
alias podman='z-podman '
|
||||
z-podman() {
|
||||
case "${1:-}" in
|
||||
run ) shift ; z-pod-run "$@" ;;
|
||||
images ) shift ; z-pod-images "$@" ;;
|
||||
ps ) shift ; z-pod-ps "$@" ;;
|
||||
top ) shift ; z-pod-top "$@" ;;
|
||||
* ) z-pod "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
z-pod-run() {
|
||||
z-pod run -e "TERM=${TERM:-linux}" --rm -it "$@"
|
||||
}
|
||||
|
||||
z-pod-images() {
|
||||
local have_flags=0
|
||||
case "$1" in
|
||||
-* ) have_flags=1 ;;
|
||||
esac
|
||||
if [ ${have_flags} = 1 ] ; then
|
||||
z-pod images "$@"
|
||||
return $?
|
||||
fi
|
||||
z-pod images --format 'table {{.ID}} {{.Repository}}:{{.Tag}} {{.Size}} {{.Created}} |{{.CreatedAt}}' "$@"
|
||||
}
|
||||
|
||||
z-pod-ps() {
|
||||
local have_flags=0
|
||||
case "$1" in
|
||||
-* ) have_flags=1 ;;
|
||||
esac
|
||||
if [ ${have_flags} = 1 ] ; then
|
||||
z-pod ps "$@"
|
||||
return $?
|
||||
fi
|
||||
z-pod ps -a --sort names --format 'table {{.ID}} {{.Names}} {{.Image}} {{.CreatedHuman}} {{.Status}}' "$@"
|
||||
}
|
||||
|
||||
z-pod-top() {
|
||||
local have_flags=0
|
||||
case "$1" in
|
||||
-* ) have_flags=1 ;;
|
||||
esac
|
||||
if [ ${have_flags} = 1 ] ; then
|
||||
z-pod top "$@"
|
||||
return $?
|
||||
fi
|
||||
if [ $# -eq 1 ] ; then
|
||||
z-pod top "$1" 'pid,ppid,user,args,pcpu,time,stime,etime,state,nice,rss,vsz'
|
||||
else
|
||||
z-pod top "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
pod-images-grep() {
|
||||
z-pod-images \
|
||||
| {
|
||||
if [ -z "$1" ] ; then
|
||||
head
|
||||
else
|
||||
sed -En "1{p;D};\\${ZSHU_XSED}$1${ZSHU_XSED}p"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
## NB: naive. rewrite!
|
||||
pod-run-sh() {
|
||||
local -a cntr_opts=( --network=host --entrypoint='[]' --user=0:0 )
|
||||
local i
|
||||
local -a shell
|
||||
for i ( ${ZSHU_CNTR_SHELLS} ) ; do
|
||||
echo "pod-run-sh: trying $i as shell" >&2
|
||||
z-pod-run ${cntr_opts[@]} "$@" "$i" -c ':' 2>/dev/null || continue
|
||||
shell=($i) ; break
|
||||
done
|
||||
while [ -z "${shell}" ] ; do
|
||||
echo "pod-run-sh: trying '${ZSHU_CNTR_FALLBACK_SHELL[*]}' as last-resort shell" >&2
|
||||
z-pod-run ${cntr_opts[@]} "$@" ${ZSHU_CNTR_FALLBACK_SHELL[@]} -c ':' 2>/dev/null || break
|
||||
shell=(${ZSHU_CNTR_FALLBACK_SHELL})
|
||||
break
|
||||
done
|
||||
if [ -z "${shell}" ] ; then
|
||||
echo "unable to run: $*"
|
||||
return 1
|
||||
fi
|
||||
z-pod-run ${cntr_opts[@]} "$@" ${shell[@]}
|
||||
}
|
||||
|
||||
## NB: naive. rewrite!
|
||||
sko-inspect() {
|
||||
local i
|
||||
i="${1:?}" ; shift
|
||||
command skopeo inspect "$@" "docker://$i"
|
||||
}
|
||||
|
||||
## NB: naive. rewrite!
|
||||
sko-list-tags() {
|
||||
local i
|
||||
i="${1:?}" ; shift
|
||||
command skopeo list-tags "$@" "docker://$i"
|
||||
}
|
||||
|
||||
## NB: naive. rewrite!
|
||||
pod-dive() {
|
||||
local i
|
||||
i="${1:?}" ; shift
|
||||
command dive "$@" "podman://$i"
|
||||
}
|
||||
|
||||
jq-visual() { jq -C | "${PAGER:-cat}" ; }
|
||||
jq-config() { jq '.[].Config' ; }
|
||||
jq-tags() { jq -r '.Tags[]' ; }
|
||||
|
||||
alias dkr='docker '
|
||||
alias dkr-run='dkr run -e "TERM=${TERM:-linux}" --rm -it '
|
||||
alias dkr-ps='dkr ps '
|
||||
alias dkr-images='dkr images --format "table {{.ID}}\\t{{.Repository}}:{{.Tag}}\\t{{.Size}}\\t{{.CreatedAt}}" '
|
||||
alias dkr-inspect='dkr inspect '
|
||||
alias dkr-logs='dkr logs '
|
||||
|
||||
z-dkr() { command docker "$@" ; }
|
||||
|
||||
z-dkr-run() {
|
||||
z-dkr run -e "TERM=${TERM:-linux}" --rm -it "$@"
|
||||
}
|
||||
|
||||
## NB: naive. rewrite!
|
||||
dkr-run-sh() {
|
||||
local -a cntr_opts=( --network=host --entrypoint='' --user=0:0 )
|
||||
local i
|
||||
local -a shell
|
||||
for i ( ${ZSHU_CNTR_SHELLS} ) ; do
|
||||
echo "dkr-run-sh: trying $i as shell" >&2
|
||||
z-dkr-run ${cntr_opts[@]} "$@" "$i" -c ':' 2>/dev/null || continue
|
||||
shell=($i) ; break
|
||||
done
|
||||
while [ -z "${shell}" ] ; do
|
||||
echo "dkr-run-sh: trying '${ZSHU_CNTR_FALLBACK_SHELL[*]}' as last-resort shell" >&2
|
||||
z-dkr-run ${cntr_opts[@]} "$@" ${ZSHU_CNTR_FALLBACK_SHELL[@]} -c ':' 2>/dev/null || break
|
||||
shell=(${ZSHU_CNTR_FALLBACK_SHELL})
|
||||
break
|
||||
done
|
||||
if [ -z "${shell}" ] ; then
|
||||
echo "unable to run: $*"
|
||||
return 1
|
||||
fi
|
||||
z-dkr-run ${cntr_opts[@]} "$@" ${shell[@]}
|
||||
}
|
||||
|
||||
## NB: naive. rewrite!
|
||||
dkr-dive() {
|
||||
local i
|
||||
i="${1:?}" ; shift
|
||||
command dive "$@" "docker://$i"
|
||||
}
|
||||
|
||||
typeset -g ZSHU_GRP_DOCKER=docker
|
||||
z-adjust-docker() {
|
||||
[ ${UID} -eq 0 ] && return 0
|
||||
|
||||
getent group "${ZSHU_GRP_DOCKER}" >/dev/null || return 1
|
||||
(( ${+commands[docker]} )) || return 127
|
||||
|
||||
local _users=$(getent group "${ZSHU_GRP_DOCKER}" | cut -d: -f4)
|
||||
local -a users=("${(@s[,])_users}")
|
||||
local i found
|
||||
for i ( ${users}) ; do
|
||||
if [ "$i" = "${USERNAME}" ] ; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ -n "${found}" ] && return 0
|
||||
|
||||
(( ${+commands[sudo]} )) || return 127
|
||||
|
||||
alias docker='sudo docker '
|
||||
z-dkr() { command sudo docker "$@" ; }
|
||||
return 0
|
||||
}
|
5
.config/zsh/alias/diff.zsh
Normal file
5
.config/zsh/alias/diff.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-alt-set-static \
|
||||
'diff|. .' \
|
||||
'diff --color=auto|diff'
|
31
.config/zsh/alias/directories.zsh
Normal file
31
.config/zsh/alias/directories.zsh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## alias -g ...='../..'
|
||||
## alias -g ....='../../..'
|
||||
## ...
|
||||
for (( i=3 ; i < 10 ; i++ )) ; do
|
||||
alias -g ${(l:i::.:)}='..'${(l:3*(i-2)::/..:)}
|
||||
done ; unset i
|
||||
|
||||
alias -- -='cd -'
|
||||
alias 1='cd -'
|
||||
## alias 2='cd -2'
|
||||
## ...
|
||||
for (( i=2 ; i < 10 ; i++ )) ; do
|
||||
alias $i="cd -$i"
|
||||
done ; unset i
|
||||
|
||||
## "Go to Dir" - create path if missing
|
||||
gd() {
|
||||
[ $# -lt 2 ] || echo "# gd() takes no more than one argument, seen instead: $#" >&2
|
||||
|
||||
case "$#" in
|
||||
0 ) cd ;;
|
||||
* )
|
||||
if ! [ -d "$1" ] ; then
|
||||
mkdir -p "$1" || return $?
|
||||
fi
|
||||
cd "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
80
.config/zsh/alias/git.zsh
Normal file
80
.config/zsh/alias/git.zsh
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/bin/zsh
|
||||
|
||||
alias gar='git-archive-ref '
|
||||
alias gbr='git-br '
|
||||
alias gds='git diff -p --stat=200 '
|
||||
alias gdu='git-dir-usage '
|
||||
alias ggc='git-gc '
|
||||
alias ggcf='git-gc-force '
|
||||
alias gst='git status -s '
|
||||
|
||||
git-dir-usage() {
|
||||
local gitdir x topdir
|
||||
gitdir=$(__z_git rev-parse --git-dir) || return $?
|
||||
x=$(__z_git rev-parse --path-format=absolute 2>/dev/null) || return $?
|
||||
if [ -n "$x" ] ; then
|
||||
## older git version which does not support "--path-format=absolute"
|
||||
: TODO
|
||||
else
|
||||
gitdir=$(__z_git rev-parse --path-format=absolute --git-dir) || return $?
|
||||
fi
|
||||
|
||||
case "${gitdir}" in
|
||||
*/* ) topdir=${gitdir:h} ; gitdir=${gitdir:t} ;;
|
||||
esac
|
||||
|
||||
local -a subdirs
|
||||
for x ( logs/refs objects/info objects/pack ) ; do
|
||||
[ -d "${gitdir}/$x" ] || continue
|
||||
subdirs+="${gitdir}/$x"
|
||||
done
|
||||
|
||||
(
|
||||
[ -n "${topdir}" ] && cd "${topdir}/"
|
||||
if [ ${#subdirs} -gt 0 ] ; then
|
||||
du -d1 "${subdirs[@]}"
|
||||
fi
|
||||
du -d1 "${gitdir}"
|
||||
) | grep -Ev '^[0-9]K?\s' | sort -Vk2
|
||||
}
|
||||
|
||||
git-gc() {
|
||||
git-dir-usage || return $?
|
||||
echo
|
||||
echo "# git gc $*" >&2
|
||||
z-time idle git gc "$@"
|
||||
echo
|
||||
git-dir-usage
|
||||
}
|
||||
|
||||
git-gc-force() {
|
||||
git-dir-usage || return $?
|
||||
echo
|
||||
echo "# git gc --aggressive --force $*" >&2
|
||||
z-time idle git gc --aggressive --force "$@"
|
||||
echo
|
||||
echo "# git repack -Ad" >&2
|
||||
z-time idle git repack -Ad
|
||||
echo
|
||||
git-dir-usage
|
||||
}
|
||||
|
||||
git-archive-ref() {
|
||||
local name ver gitref topdir c_hash c_time out
|
||||
name="${1:?}" ver="${2:?}" gitref="${3:?}"
|
||||
topdir=$(__z_git rev-parse --show-toplevel) || return $?
|
||||
c_hash=$(__z_git log -n 1 --format='%h' --abbrev=12 "${gitref}") || return $?
|
||||
c_time=$(__z_git log -n 1 --format='%cd' --date='format:%Y%m%d.%H%M%S' "${gitref}") || return $?
|
||||
out="${name}_${ver}+git.${c_time}.${c_hash}.tar"
|
||||
topdir=${topdir:h}
|
||||
git archive --format=tar -o "${topdir}/${out}" --prefix="${name}-${ver}-git.${c_hash}/" "${gitref}" || return $?
|
||||
echo "archived to ${out} in ${topdir}/" >&2
|
||||
}
|
||||
|
||||
git-br() {
|
||||
__z_git -c core.pager='cat' branch --no-abbrev "$@"
|
||||
}
|
||||
|
||||
git-rebase-log() {
|
||||
git log --format='pick %h # %s' --reverse "$@"
|
||||
}
|
14
.config/zsh/alias/gpg.zsh
Normal file
14
.config/zsh/alias/gpg.zsh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/zsh
|
||||
|
||||
gpg-warmup() {
|
||||
(( ${+commands[gpg]} )) || return 127
|
||||
|
||||
local t r
|
||||
|
||||
t=$(mktemp)
|
||||
command gpg -abs "$t"
|
||||
r=$?
|
||||
rm -f "$t" "$t.asc"
|
||||
|
||||
return "$r"
|
||||
}
|
31
.config/zsh/alias/grep.zsh
Normal file
31
.config/zsh/alias/grep.zsh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-alt-grep() {
|
||||
local -a a
|
||||
local n
|
||||
|
||||
a=( ${(@s:|:)1} )
|
||||
[ ${#a} = 0 ] && a=( "$1" )
|
||||
n=${#a}
|
||||
[ -z "$1" ] && n=0
|
||||
case "$n" in
|
||||
0 ) ;;
|
||||
* )
|
||||
z-alt-set-static \
|
||||
"grep|-q -e ' ' ${ZSHU[d_conf]}/_.zsh" \
|
||||
"$1" \
|
||||
"GREP_OPTIONS='' command" \
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
## TODO: add --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}
|
||||
GREP_GNU='--color=auto'
|
||||
|
||||
z-alt-grep "grep ${GREP_GNU}|grep"
|
||||
unfunction z-alt-grep
|
||||
unset GREP_GNU
|
||||
|
||||
alias grep='grep '
|
||||
alias egrep='grep -E '
|
||||
alias fgrep='grep -F '
|
5
.config/zsh/alias/history.zsh
Normal file
5
.config/zsh/alias/history.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
fc() { builtin fc -i "$@" ; }
|
||||
|
||||
# history() { builtin fc -il "$@" ; }
|
42
.config/zsh/alias/idle.zsh
Normal file
42
.config/zsh/alias/idle.zsh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/zsh
|
||||
|
||||
idle() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
local f
|
||||
|
||||
f=$(type "$1")
|
||||
case "$f" in
|
||||
"$1 is /"* )
|
||||
z-idle-ext "$@"
|
||||
;;
|
||||
* )
|
||||
z-idle-int "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
z-idle-ext() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
local -a s
|
||||
|
||||
s+=( $(z-alt-find 'nice -n +40') )
|
||||
s+=( $(z-alt-find 'chrt -i 0' ) )
|
||||
s+=( $(z-alt-find 'ionice -c 3') )
|
||||
command ${s[@]} "$@"
|
||||
}
|
||||
|
||||
z-idle-int() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
## execute in subshell
|
||||
(
|
||||
{
|
||||
command renice -n +40 -p ${sysparams[pid]}
|
||||
command chrt -i -p 0 ${sysparams[pid]}
|
||||
command ionice -c 3 -p ${sysparams[pid]}
|
||||
} </dev/null &>/dev/null
|
||||
"$@"
|
||||
)
|
||||
}
|
3
.config/zsh/alias/k8s.zsh
Normal file
3
.config/zsh/alias/k8s.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/zsh
|
||||
|
||||
alias k='kubectl '
|
23
.config/zsh/alias/kconfig.zsh
Normal file
23
.config/zsh/alias/kconfig.zsh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/zsh
|
||||
|
||||
kconf-set() {
|
||||
local n v
|
||||
n="${1:?}" v=$2
|
||||
shift 2
|
||||
|
||||
[ $# -gt 0 ] || return 1
|
||||
|
||||
command grep -ElZ "^((CONFIG_)?$n=|# (CONFIG_)?$n is not set)" "$@" \
|
||||
| xargs -0 -r sed -i -E -e "s/^(((CONFIG_)?$n)=.+|# ((CONFIG_)?$n) is not set)\$/\\2\\4=$v/"
|
||||
}
|
||||
|
||||
kconf-unset() {
|
||||
local n
|
||||
n="${1:?}"
|
||||
shift
|
||||
|
||||
[ $# -gt 0 ] || return 1
|
||||
|
||||
command grep -ElZ "^(CONFIG_)?$n=" "$@" \
|
||||
| xargs -0 -r sed -i -E -e "s/^((CONFIG_)?$n)=.+\$/# \\1 is not set/"
|
||||
}
|
57
.config/zsh/alias/ls.zsh
Normal file
57
.config/zsh/alias/ls.zsh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/zsh
|
||||
|
||||
if [ -z "${LS_COLORS}" ] ; then
|
||||
(( $+commands[dircolors] )) && eval "$(dircolors -b)"
|
||||
fi
|
||||
|
||||
case "${ZSHU[os_family]}" in
|
||||
bsd | darwin ) export LSCOLORS="Gxfxcxdxbxegedabagacad" ;;
|
||||
esac
|
||||
|
||||
z-alt-ls() {
|
||||
local -a a
|
||||
local n
|
||||
|
||||
a=( ${(@s:|:)1} )
|
||||
[ ${#a} = 0 ] && a=( "$1" )
|
||||
n=${#a}
|
||||
[ -z "$1" ] && n=0
|
||||
case "$n" in
|
||||
0 ) ;;
|
||||
* )
|
||||
z-alt-set-static \
|
||||
'ls|-d .' \
|
||||
"$1" \
|
||||
"LS_OPTIONS='' command"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
LS_GNU='--color=tty --group-directories-first'
|
||||
|
||||
case "${ZSHU[os_type]}" in
|
||||
linux* ) alt="ls ${LS_GNU}|ls" ;;
|
||||
netbsd* ) alt="gls ${LS_GNU}|ls" ;;
|
||||
openbsd* ) alt="gls ${LS_GNU}|colorls -G|ls" ;;
|
||||
freebsd* ) alt="gls ${LS_GNU}|ls -G|ls" ;;
|
||||
darwin* ) alt="gls ${LS_GNU}|ls -G|ls" ;;
|
||||
* ) alt="ls ${LS_GNU}|ls" ;;
|
||||
esac
|
||||
|
||||
z-alt-ls "${alt}"
|
||||
unset -f z-alt-ls
|
||||
unset alt LS_GNU
|
||||
|
||||
[ -n "${LS_COLORS}" ] && zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
case "${ZSHU[os_family]}" in
|
||||
linux ) alias l='ls -lhF ' ;;
|
||||
bsd ) alias l='ls -lhIF ' ;;
|
||||
esac
|
||||
|
||||
alias ll='ls -lAF '
|
||||
|
||||
case "${ZSHU[os_family]}" in
|
||||
linux ) alias lll='ls -lAn --full-time ' ;;
|
||||
bsd ) alias lll='ls -lAnT ' ;;
|
||||
esac
|
14
.config/zsh/alias/openwrt.zsh
Normal file
14
.config/zsh/alias/openwrt.zsh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/zsh
|
||||
|
||||
openwrt-apk-list() {
|
||||
local i w
|
||||
w=$(mktemp -d) ; : "${w:?}"
|
||||
for i ; do
|
||||
[ -n "$i" ] || continue
|
||||
find "$w/" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
|
||||
find "$w/" -mindepth 1 -maxdepth 1 -exec rm -rf {} + || return
|
||||
openwrt-apk extract --no-cache --no-logfile --no-network --no-check-certificate --allow-untrusted --no-chown --destination "$w" "$i"
|
||||
env -C "$w" find ./ -mindepth 1 -exec ls -ldgG --color {} +
|
||||
done
|
||||
rm -rf "$w"
|
||||
}
|
84
.config/zsh/alias/quilt.zsh
Normal file
84
.config/zsh/alias/quilt.zsh
Normal file
@@ -0,0 +1,84 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-quilt() { command quilt "$@" ; }
|
||||
|
||||
quilt-series-strip-comments() {
|
||||
sed -E '/^[[:space:]]*(#|$)/d' "$@"
|
||||
}
|
||||
|
||||
quilt-series-auto() {
|
||||
[ -n "${1:?}" ]
|
||||
[ -d "$1" ] || return 1
|
||||
|
||||
find "$1/" -follow -type f -printf '%P\0' \
|
||||
| sed -zEn '/\.(diff|patch)$/p' \
|
||||
| sort -zuV \
|
||||
| xargs -0r printf '%s\n'
|
||||
}
|
||||
|
||||
krd-quilt() {
|
||||
(( $+commands[quilt] )) || return 127
|
||||
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
local patchdir series tmp_series
|
||||
|
||||
if [ -d "$1" ] ; then
|
||||
patchdir="$1/debian/patches"
|
||||
if [ -d "${patchdir}" ] ; then
|
||||
[ -f "${patchdir}/series" ] || return 1
|
||||
else
|
||||
patchdir="$1"
|
||||
fi
|
||||
|
||||
series="${patchdir}/series"
|
||||
if ! [ -f "${series}" ] ; then
|
||||
mkdir -p "$1/.pc" || return 1
|
||||
series="$1/.pc/krd-quilt-series"
|
||||
touch "${series}" || return 1
|
||||
quilt-series-auto "${patchdir}" > "${series}"
|
||||
fi
|
||||
elif [ -f "$1" ] ; then
|
||||
[ -s "$1" ] || return 1
|
||||
|
||||
series="$1"
|
||||
patchdir=${series:h}
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
local r
|
||||
(
|
||||
z-quilt-default-env
|
||||
set -a
|
||||
QUILT_SERIES="${series}"
|
||||
QUILT_PATCHES="${patchdir}"
|
||||
set +a
|
||||
|
||||
r=0
|
||||
while read -rs i ; do
|
||||
[ -n "$i" ] || continue
|
||||
|
||||
z-quilt --fuzz=0 push "$i"
|
||||
r=$? ; [ $r -eq 0 ] || exit $r
|
||||
z-quilt refresh "$i"
|
||||
r=$? ; [ $r -eq 0 ] || exit $r
|
||||
|
||||
sed -E -i \
|
||||
-e 's#^(-{3} )[^/][^/]*/(.*)$#\1a/\2#;' \
|
||||
-e 's#^(\+{3} )[^/][^/]*/(.*)$#\1b/\2#' \
|
||||
"$i"
|
||||
|
||||
rm -f "$i"'~'
|
||||
done <<< $(
|
||||
if ! z-quilt unapplied ; then
|
||||
quilt-series-strip-comments "${series}" \
|
||||
| sed -E "s${ZSHU_XSED}^${ZSHU_XSED}${patchdir}/${ZSHU_XSED}"
|
||||
fi
|
||||
)
|
||||
exit $r
|
||||
)
|
||||
r=$?
|
||||
|
||||
return $r
|
||||
}
|
74
.config/zsh/alias/sbuild.zsh
Normal file
74
.config/zsh/alias/sbuild.zsh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/zsh
|
||||
|
||||
krd-debsrc() {
|
||||
(( $+commands[deb-src-export] )) || return 127
|
||||
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
local dstdir
|
||||
case "$1" in
|
||||
*/* ) dstdir="$1/src" ;;
|
||||
* ) dstdir="/tmp/$1/src" ;;
|
||||
esac
|
||||
rm -rf "${dstdir}"
|
||||
deb-src-export "${dstdir}"
|
||||
}
|
||||
|
||||
krd-sbuild() {
|
||||
(( $+commands[sbuild] )) || return 127
|
||||
(( $+commands[xz] )) || return 127
|
||||
|
||||
[ -n "${1:?}" ]
|
||||
[ -n "${2:?}" ]
|
||||
|
||||
local topdir
|
||||
case "$1" in
|
||||
*/* ) topdir="$1" ;;
|
||||
* ) topdir="/tmp/$1" ;;
|
||||
esac
|
||||
[ -d "${topdir}" ] || return 1
|
||||
|
||||
local srcdir="${topdir}/src"
|
||||
[ -d "${srcdir}" ] || return 2
|
||||
|
||||
arch="$2"
|
||||
|
||||
## done with args
|
||||
shift 2
|
||||
|
||||
local -a sbuild_env sbuild_args
|
||||
local i
|
||||
for i ; do
|
||||
## naive splitting args and env
|
||||
case "$i" in
|
||||
-*) sbuild_args+=( $i ) ;;
|
||||
*=* ) sbuild_env+=( $i ) ;;
|
||||
*) sbuild_args+=( $i ) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
(
|
||||
for i ( ${sbuild_env} ) ; do
|
||||
export "$i"
|
||||
done
|
||||
|
||||
z-set-tmpdir /tmp
|
||||
|
||||
builddir="${topdir}/${arch}"
|
||||
mkdir -p "${topdir}/all" "${builddir}" "${builddir}-all" "${builddir}-debug"
|
||||
|
||||
cd "${builddir}"
|
||||
for i ( "${srcdir}"/*.dsc(N.r) ) ; do
|
||||
idle sbuild --arch-all --arch-any --arch=${arch} ${sbuild_args[@]} "$i"
|
||||
find -name '*.build' -type l -exec rm -f {} +
|
||||
find -name '*.build' -type f -exec xz -9vv {} +
|
||||
done
|
||||
|
||||
find -name '*_all.deb' -type f -exec mv -fvt "../${arch}-all" {} +
|
||||
find -name '*_all.ddeb' -type f -exec mv -fvt "../${arch}-all" {} +
|
||||
find -name '*dbgsym*.deb' -type f -exec mv -fvt "../${arch}-debug" {} +
|
||||
find -name '*.ddeb' -type f -exec mv -fvt "../${arch}-debug" {} +
|
||||
cd "${builddir}-all"
|
||||
find -type f -exec mv -nvt '../all' {} +
|
||||
)
|
||||
}
|
10
.config/zsh/alias/sudo.zsh
Normal file
10
.config/zsh/alias/sudo.zsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/zsh
|
||||
|
||||
function {
|
||||
local c
|
||||
if [ ${UID} -ne 0 ] ; then
|
||||
c='sudo -i '
|
||||
fi
|
||||
alias sudo-i="$c"
|
||||
alias sudoi="$c"
|
||||
}
|
6
.config/zsh/alias/telnet.zsh
Normal file
6
.config/zsh/alias/telnet.zsh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
case "${ZSHU[os_type]}" in
|
||||
linux-gnu ) alias tl='telnet -K ' ;;
|
||||
*bsd* ) alias tl='telnet -K -N -y ' ;;
|
||||
esac
|
0
.config/zsh/completion/.keep
Normal file
0
.config/zsh/completion/.keep
Normal file
5
.config/zsh/completion/bash.zsh
Normal file
5
.config/zsh/completion/bash.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
for i ( buildah ) ; do
|
||||
__z_comp_bash $i
|
||||
done ; unset i
|
17
.config/zsh/completion/external.zsh
Normal file
17
.config/zsh/completion/external.zsh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -A ZSHU_COMP_EXTERNAL
|
||||
|
||||
for i ( kubectl podman skopeo docker ) ; do
|
||||
ZSHU_COMP_EXTERNAL[$i]="command $i completion zsh"
|
||||
done ; unset i
|
||||
|
||||
## example of "automatic" shell completion generation
|
||||
# ZSHU_COMP_EXTERNAL[yq]='command yq shell-completion zsh'
|
||||
__z_comp_ext__yq() { command yq shell-completion zsh ; }
|
||||
|
||||
## example of more complex shell completion generation
|
||||
# __z_comp__shifty_nifty() { command shifty-nifty completion zsh | sed -E 's/shifty_nifty/shifty-nifty/g' ; }
|
||||
# ZSHU_COMP_EXTERNAL[shifty-nifty]='__z_comp__shifty_nifty'
|
||||
|
||||
z-comp-auto
|
5
.config/zsh/completion/system.zsh
Normal file
5
.config/zsh/completion/system.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
for i ( fd fdfind hyperfine ) ; do
|
||||
__z_comp_system $i
|
||||
done ; unset i
|
96
.config/zsh/env.zsh
Normal file
96
.config/zsh/env.zsh
Normal file
@@ -0,0 +1,96 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## sort-n-fill PATH
|
||||
z-sort-path() {
|
||||
local -a p
|
||||
local -aU t npath games
|
||||
|
||||
p=( ${path} )
|
||||
|
||||
## strip "games" first :)
|
||||
t=( ${(@)p:#*games*} )
|
||||
games+=( ${(@)p:|t} )
|
||||
p=( $t )
|
||||
|
||||
## process in-home part
|
||||
t=( ${(@)p:#${HOME}/*} )
|
||||
npath+=( "${ZSHU[d_scripts]}" "${ZSHU[d_bin]}" "${HOME}/bin" )
|
||||
npath+=( ${(@)p:|t} )
|
||||
p=( $t )
|
||||
|
||||
## process /usr/local/*
|
||||
t=( ${(@)p:#/usr/local/*} )
|
||||
npath+=( /usr/local/sbin /usr/local/bin )
|
||||
npath+=( ${(@)p:|t} )
|
||||
p=( $t )
|
||||
|
||||
## process /usr/*
|
||||
t=( ${(@)p:#/usr/*} )
|
||||
npath+=( /usr/sbin /usr/bin )
|
||||
npath+=( ${(@)p:|t} )
|
||||
p=( $t )
|
||||
|
||||
## now we're with /sbin and /bin... probably :)
|
||||
|
||||
## in case of merged /usr
|
||||
[ -h /sbin ] || npath+=( /sbin )
|
||||
[ -h /bin ] || npath+=( /bin )
|
||||
npath+=( $p )
|
||||
|
||||
## finally... games! xD
|
||||
npath+=( /usr/local/games /usr/games )
|
||||
npath+=( ${games} )
|
||||
|
||||
path=( ${npath} )
|
||||
hash -f
|
||||
}
|
||||
z-sort-path
|
||||
|
||||
unset GREP_OPTIONS
|
||||
unset LS_OPTIONS
|
||||
|
||||
unset LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
|
||||
unset LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
|
||||
export LANG=C.UTF-8
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
z-set-tmpdir() {
|
||||
TMPDIR="$1"
|
||||
TMP="$1"
|
||||
TEMPDIR="$1"
|
||||
TEMP="$1"
|
||||
export TMPDIR TMP TEMPDIR TEMP
|
||||
}
|
||||
z-set-tmpdir "${TMPDIR:=/tmp}"
|
||||
|
||||
ZSHU[uname]=$(uname -s 2>/dev/null)
|
||||
ZSHU[uname]=${ZSHU[uname]:l}
|
||||
|
||||
ZSHU[mach]=$(uname -m 2>/dev/null)
|
||||
ZSHU[mach]=${ZSHU[mach]:l}
|
||||
case "${ZSHU[mach]}" in
|
||||
amd64 ) ZSHU[mach]=x86_64 ;;
|
||||
arm64 ) ZSHU[mach]=aarch64 ;;
|
||||
armv* ) ZSHU[mach]=arm ;;
|
||||
esac
|
||||
|
||||
ZSHU[os_type]=${OSTYPE:l}
|
||||
|
||||
ZSHU[os_family]=${ZSHU[uname]:l}
|
||||
case "${ZSHU[os_family]}" in
|
||||
*bsd ) ZSHU[os_family]=bsd ;;
|
||||
esac
|
||||
|
||||
ZSHU[host_name]=${(%):-%m}
|
||||
ZSHU[host_fqdn]=${(%):-%M}
|
||||
ZSHU[host]=${ZSHU[host_name]}
|
||||
function {
|
||||
[ "${ZSHU[uname]}" = darwin ] || return
|
||||
ZSHU[host]=$(scutil --get ComputerName 2>/dev/null) && return
|
||||
## last resort
|
||||
ZSHU[host]=${ZSHU[host_name]}
|
||||
}
|
||||
|
||||
case "${ZSHU[os_family]}" in
|
||||
linux ) ZSHU[procfs]=/proc ;;
|
||||
esac
|
8
.config/zsh/env/aux.zsh
vendored
Normal file
8
.config/zsh/env/aux.zsh
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/zsh
|
||||
|
||||
set -a
|
||||
NO_AT_BRIDGE=1
|
||||
QT_ACCESSIBILITY=0
|
||||
|
||||
MENUCONFIG_COLOR=blackbg
|
||||
set +a
|
11
.config/zsh/env/containers.zsh
vendored
Normal file
11
.config/zsh/env/containers.zsh
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/zsh
|
||||
|
||||
BUILDAH_FORMAT=docker
|
||||
BUILDAH_ISOLATION=chroot
|
||||
|
||||
typeset -x -m 'BUILDAH_*'
|
||||
|
||||
BUILD_IMAGE_NETWORK=host
|
||||
BUILD_IMAGE_PUSH=0
|
||||
|
||||
typeset -x -m 'BUILD_IMAGE*'
|
21
.config/zsh/env/gopath.zsh
vendored
Normal file
21
.config/zsh/env/gopath.zsh
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-gobin-fixup() {
|
||||
(( ${+commands[go]} )) || return 0
|
||||
|
||||
local gobin
|
||||
gobin=$(command go env GOBIN)
|
||||
if [ -z "${gobin}" ] ; then
|
||||
local gopath
|
||||
gopath=$(command go env GOPATH)
|
||||
[ -n "${gopath}" ] || return 1
|
||||
[ -d "${gopath}" ] || return 0
|
||||
gobin="${gopath}/bin"
|
||||
fi
|
||||
[ -d "${gobin}" ] || mkdir "${gobin}" || return 1
|
||||
## already in PATH?
|
||||
[ "${path[(I)${gobin}]}" = 0 ] || return 0
|
||||
path=( "${gobin}" ${path} )
|
||||
}
|
||||
|
||||
z-gobin-fixup
|
10
.config/zsh/env/history.zsh
vendored
Normal file
10
.config/zsh/env/history.zsh
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## kinda unlimited history
|
||||
HISTSIZE=10000000
|
||||
SAVEHIST=10000000
|
||||
|
||||
ZSHU[f_hist]="${ZSHU[d_var]}/history"
|
||||
[ -f "${ZSHU[f_hist]}" ] || touch "${ZSHU[f_hist]}"
|
||||
|
||||
HISTFILE="${ZSHU[f_hist]}"
|
5
.config/zsh/env/ld.so.zsh
vendored
Normal file
5
.config/zsh/env/ld.so.zsh
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -T LD_LIBRARY_PATH ld_library_path
|
||||
typeset -T LD_PRELOAD ld_preload
|
||||
typeset -T LD_AUDIT ld_audit
|
3
.config/zsh/env/pager.zsh
vendored
Normal file
3
.config/zsh/env/pager.zsh
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/zsh
|
||||
|
||||
export LESS=RSF
|
15
.config/zsh/env/quilt.zsh
vendored
Normal file
15
.config/zsh/env/quilt.zsh
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-quilt-default-env() {
|
||||
set -a
|
||||
QUILT_PATCHES='debian/patches'
|
||||
QUILT_NO_DIFF_INDEX=1
|
||||
QUILT_NO_DIFF_TIMESTAMPS=1
|
||||
QUILT_PATCH_OPTS='--reject-format=unified'
|
||||
QUILT_DIFF_ARGS='-pab --no-timestamps --no-index --color=auto'
|
||||
QUILT_REFRESH_ARGS='-pab --no-timestamps --no-index'
|
||||
QUILT_COLORS='diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33'
|
||||
set +a
|
||||
}
|
||||
|
||||
z-quilt-default-env
|
3
.config/zsh/env/sed.zsh
vendored
Normal file
3
.config/zsh/env/sed.zsh
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -r ZSHU_XSED=$'\027'
|
13
.config/zsh/env/xdg.zsh
vendored
Normal file
13
.config/zsh/env/xdg.zsh
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/zsh
|
||||
|
||||
: ${XDG_CONFIG_HOME:=${HOME}/.config}
|
||||
: ${XDG_CACHE_HOME:=${HOME}/.cache}
|
||||
: ${XDG_DATA_HOME:=${HOME}/.local/share}
|
||||
: ${XDG_RUNTIME_DIR:=${TMPDIR}}
|
||||
: ${XDG_DATA_DIRS:=/usr/local/share:/usr/share}
|
||||
: ${XDG_CONFIG_DIRS:=/etc/xdg}
|
||||
|
||||
typeset -x -m 'XDG*'
|
||||
|
||||
export -T XDG_DATA_DIRS xdg_data_dirs
|
||||
export -T XDG_CONFIG_DIRS xdg_config_dirs
|
6
.config/zsh/lib.zsh
Normal file
6
.config/zsh/lib.zsh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
disable which
|
||||
which() { builtin whence -p "$@"; }
|
||||
which-command() { builtin whence -p "$@"; }
|
||||
zsh-which() { builtin whence -c "$@"; }
|
87
.config/zsh/lib/alternatives.zsh
Normal file
87
.config/zsh/lib/alternatives.zsh
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## alternatives list is pipe-separated list of commands/binaries
|
||||
|
||||
## find (first) candidate in alternatives
|
||||
## $1 - alternatives list
|
||||
## $2 - arguments to test command (USE WITH CAUTION!)
|
||||
z-alt-find() {
|
||||
local -a v a
|
||||
local i c r t
|
||||
|
||||
v=( ${(@s:|:)1} )
|
||||
[ ${#v} = 0 ] && v=( "$1" )
|
||||
for i ( $v ) ; do
|
||||
a=( ${(@s: :)i} )
|
||||
|
||||
c=$(which "${a[1]}")
|
||||
[ -z "$c" ] && continue
|
||||
a[1]="$c"
|
||||
|
||||
# r=$(readlink -f "$c" 2>/dev/null)
|
||||
# [ -z "$r" ] && continue
|
||||
# a[1]="$r"
|
||||
|
||||
if [ -n "$2" ] ; then
|
||||
t="$a $2"
|
||||
command ${(@s: :)t} </dev/null &>/dev/null || continue
|
||||
fi
|
||||
|
||||
echo "${a[@]}"
|
||||
return 0
|
||||
done
|
||||
|
||||
return 127
|
||||
}
|
||||
|
||||
## set function alias for alternative (one-time static resolve)
|
||||
## $1 - function name
|
||||
## $2 - alternatives list
|
||||
## $3 - command wrapper
|
||||
## $4 - function prologue
|
||||
## $5 - function epilogue
|
||||
z-alt-set-static() {
|
||||
local -a s
|
||||
local n t a r
|
||||
|
||||
n="$1" ; t=''
|
||||
if [[ "$n" =~ '\|' ]] ; then
|
||||
t=${n:${MBEGIN}} ; n=${n:0:${MBEGIN}-1}
|
||||
fi
|
||||
a=$(z-alt-find "$2" "$t")
|
||||
if [ -n "$a" ] ; then
|
||||
r=0
|
||||
[ -n "$4" ] && s+=( "$4 ;" )
|
||||
s+=( "${3:-command}" )
|
||||
s+=( "$a \"\$@\" || return 127" )
|
||||
[ -n "$5" ] && s+=( "; $5" )
|
||||
else
|
||||
r=127
|
||||
s+=( 'return 127' )
|
||||
fi
|
||||
eval "$n () { ${s[@]} ; } ; typeset -g $n"
|
||||
|
||||
return $r
|
||||
}
|
||||
|
||||
## set function alias for alternative (dynamic resolve)
|
||||
## $1 - function name
|
||||
## $2 - alternatives list
|
||||
## $3 - command wrapper
|
||||
## $4 - function prologue
|
||||
## $5 - function epilogue
|
||||
z-alt-set-dynamic() {
|
||||
local -a s
|
||||
local n t
|
||||
|
||||
n="$1" ; t=''
|
||||
if [[ "$n" =~ '\|' ]] ; then
|
||||
t=${n:${MBEGIN}} ; n=${n:0:${MBEGIN}-1}
|
||||
fi
|
||||
[ -n "$4" ] && s+=( "$4 ;" )
|
||||
s+=( 'local a=$(z-alt-find' "${(qq)2}" "${t:+' $t'} ) ;" )
|
||||
s+=( "${3:-command}" )
|
||||
s+=( '${(@s: :)a} "$@" || return 127' )
|
||||
[ -n "$5" ] && s+=( "; $5" )
|
||||
eval "$n () { ${s[@]} ; } ; typeset -g $n"
|
||||
}
|
53
.config/zsh/lib/cmdtime.zsh
Normal file
53
.config/zsh/lib/cmdtime.zsh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-time() {
|
||||
local a r
|
||||
|
||||
a=${EPOCHREALTIME}
|
||||
"$@" ; r=$?
|
||||
a=$[ EPOCHREALTIME - a ]
|
||||
a=$(z-ts-to-human "$a" 6)
|
||||
echo >&2
|
||||
echo "time took: $a" >&2
|
||||
|
||||
return $r
|
||||
}
|
||||
|
||||
if autoload -Uz add-zsh-hook ; then
|
||||
|
||||
typeset -gA ZSHU_PS
|
||||
ZSHU_PS[cmd_threshold]=3
|
||||
|
||||
__z_cmdtime_measure() {
|
||||
local t x
|
||||
|
||||
x=${EPOCHREALTIME}
|
||||
|
||||
unset 'ZSHU[cmd_dt]' 'ZSHU_PS[elapsed]'
|
||||
(( ${+ZSHU[cmd_ts]} )) || return
|
||||
|
||||
t=$[ x - ZSHU[cmd_ts] ]
|
||||
ZSHU[cmd_ts]=$x
|
||||
|
||||
x=${ZSHU_PS[cmd_threshold]}
|
||||
x=$[ x + 0 ] || x=0
|
||||
[ "$x" = 0 ] && return
|
||||
|
||||
x=$[ t - x ]
|
||||
[ "${x:0:1}" = '-' ] && return
|
||||
|
||||
t=$(z-ts-to-human "$t")
|
||||
ZSHU[cmd_dt]=$t
|
||||
ZSHU_PS[elapsed]=" %f[%B%F{yellow}+$t%b%f]"
|
||||
}
|
||||
|
||||
__z_cmdtime_set() {
|
||||
ZSHU[cmd_ts]=${EPOCHREALTIME}
|
||||
}
|
||||
|
||||
add-zsh-hook precmd __z_cmdtime_measure
|
||||
add-zsh-hook preexec __z_cmdtime_set
|
||||
|
||||
else
|
||||
echo "cmd time measurement is disabled due to missing hook support" >&2
|
||||
fi
|
145
.config/zsh/lib/completion.zsh
Normal file
145
.config/zsh/lib/completion.zsh
Normal file
@@ -0,0 +1,145 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -gA ZSHU_COMP_FORCE
|
||||
|
||||
ZSHU[f_compdump]="${ZSHU[d_cache]}/compdump"
|
||||
ZSHU[d_completion]="${ZSHU[d_cache]}/completion"
|
||||
ZSHU[d_compzwc]="${ZSHU[d_cache]}/compzwc"
|
||||
ZSHU[d_compcache]="${ZSHU[d_cache]}/compcache"
|
||||
|
||||
typeset -a ZSHU_SYS_FPATH=( ${fpath} )
|
||||
fpath=( "${ZSHU[d_compzwc]}" "${ZSHU[d_completion]}" ${fpath} )
|
||||
|
||||
__z_compdump_print() { printf '#zshu %s %s\n' "$1" "${(P)1}" ; }
|
||||
|
||||
__z_compdump_invalidate() {
|
||||
rm -f "${ZSHU[f_compdump]}"
|
||||
find "${ZSHU[d_compcache]}/" -xdev -type f '!' -name '.keep' -delete
|
||||
ZSHU[compdump_refresh]=1
|
||||
}
|
||||
|
||||
__z_compdump_verify() {
|
||||
local i s
|
||||
|
||||
unset 'ZSHU[compdump_refresh]'
|
||||
ZSHU[compdump_meta]='ZSH_VERSION ZSH_PATCHLEVEL FPATH PATH'
|
||||
for i ( ${(s: :)ZSHU[compdump_meta]} ) ; do
|
||||
s=$(__z_compdump_print "$i")
|
||||
command grep -Fx -e "$s" "${ZSHU[f_compdump]}" &>/dev/null && continue
|
||||
__z_compdump_invalidate
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
__z_compdump_finalize() {
|
||||
local i
|
||||
|
||||
if (( ${+ZSHU[compdump_refresh]} )) ; then
|
||||
{
|
||||
echo
|
||||
for i ( ${(s: :)ZSHU[compdump_meta]} ) ; do
|
||||
__z_compdump_print "$i"
|
||||
done
|
||||
} | tee -a "${ZSHU[f_compdump]}" &>/dev/null
|
||||
unset 'ZSHU[compdump_refresh]'
|
||||
fi
|
||||
unset 'ZSHU[compdump_meta]'
|
||||
}
|
||||
|
||||
## TODO: refactor (e.g. buildah completion is a "bit" broken)
|
||||
__z_comp_bash() {
|
||||
# (( ${+commands[$1]} )) || return 127
|
||||
|
||||
local f p x
|
||||
|
||||
(( ${+_comps[$1]} )) && return 1
|
||||
(( ${+ZSHU[compdump_bash]} )) || return 2
|
||||
(( ${+2} )) && return 0
|
||||
|
||||
f=0
|
||||
for p ( /usr/share/bash-completion/completions ) ; do
|
||||
x="_$1" ; [ -s "$p/$x" ] && f=1 && break
|
||||
x="$1" ; [ -s "$p/$x" ] && f=1 && break
|
||||
done
|
||||
[ "$f" = 0 ] && return 3
|
||||
complete -C "$x" "$1"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
__z_comp_external() {
|
||||
local c f
|
||||
c="$1" ; shift
|
||||
|
||||
(( ${+commands[$c]} )) || return 127
|
||||
|
||||
[ $# -gt 0 ] || return 1
|
||||
|
||||
if ! (( ${+ZSHU_COMP_FORCE[$c]} )) ; then
|
||||
(( ${+_comps[$c]} )) && return 0
|
||||
fi
|
||||
|
||||
f="${ZSHU[d_completion]}/_$c"
|
||||
if ! [ -s "$f" ] ; then
|
||||
if ! "$@" > "$f" ; then
|
||||
rm -f "$f"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
# zcompile -zR "$f"
|
||||
# mv -f "$f.zwc" "${ZSHU[d_compzwc]}/$c.zwc"
|
||||
# emulate zsh -c "autoload -Uz _$c"
|
||||
autoload -Uz "_$c"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
__z_comp_system() {
|
||||
# (( ${+commands[$1]} )) || return 127
|
||||
|
||||
local d
|
||||
|
||||
(( ${+_comps[$1]} )) && return 1
|
||||
|
||||
(( ${+ZSHU_COMP_FORCE[$c]} )) && return 0
|
||||
|
||||
local -a _fpath
|
||||
_fpath=( ${fpath} )
|
||||
fpath=( ${ZSHU_SYS_FPATH} )
|
||||
|
||||
for d ( ${fpath} ) ; do
|
||||
[ -s "$d/_$1" ] || continue
|
||||
# emulate zsh -c "autoload -Uz _$1"
|
||||
autoload -Uz "_$1"
|
||||
fpath=( ${_fpath} )
|
||||
return 0
|
||||
done
|
||||
fpath=( ${_fpath} )
|
||||
return 2
|
||||
}
|
||||
|
||||
## reload or new session are required to regenerate compcache
|
||||
z-comp-invalidate() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
# rm -f "${ZSHU[d_completion]}/_$1" "${ZSHU[d_compzwc]}/_$1.zwc" "${ZSHU[d_compzwc]}/$1.zwc"
|
||||
rm -f "${ZSHU[d_completion]}/_$1"
|
||||
}
|
||||
|
||||
## reload or new session are required to regenerate completions
|
||||
z-comp-flush() {
|
||||
find "${ZSHU[d_completion]}/" "${ZSHU[d_compzwc]}/" -xdev -type f '!' -name '.keep' -delete
|
||||
}
|
||||
|
||||
z-comp-auto() {
|
||||
local c f
|
||||
|
||||
for c ( ${(k)ZSHU_COMP_EXTERNAL} ) ; do
|
||||
__z_comp_external "$c" "${(@s: :)ZSHU_COMP_EXTERNAL[$c]}" && unset "ZSHU_COMP_EXTERNAL[$c]"
|
||||
done
|
||||
|
||||
for f ( ${functions[(I)__z_comp_ext__*]} ) ; do
|
||||
c=${f#__z_comp_ext__}
|
||||
__z_comp_external $c $f && unset -f "$f"
|
||||
done
|
||||
}
|
33
.config/zsh/lib/csv.zsh
Normal file
33
.config/zsh/lib/csv.zsh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## NB: set IFS manually
|
||||
|
||||
z-csv-select() {
|
||||
local field value
|
||||
field="${1:?}" value="${2:?}"
|
||||
|
||||
local line
|
||||
local -a ary
|
||||
while IFS='' read -rs line ; do
|
||||
[ -n "${line}" ] || continue
|
||||
|
||||
ary=()
|
||||
read -rs -A ary <<< "${line}"
|
||||
[ "${ary[${field}]}" = "${value}" ] || continue
|
||||
|
||||
printf '%s' "${line}"
|
||||
return 0
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
z-csv-field() {
|
||||
local field
|
||||
field="${1:?}"
|
||||
|
||||
local -a ary
|
||||
read -rs -A ary
|
||||
|
||||
printf '%s' "${ary[${field}]}"
|
||||
}
|
14
.config/zsh/lib/curl.zsh
Normal file
14
.config/zsh/lib/curl.zsh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/zsh
|
||||
|
||||
__z_curl_headers() {
|
||||
command curl -qsI "$@" 2>/dev/null
|
||||
}
|
||||
__z_curl_location() {
|
||||
__z_curl_headers "$1" \
|
||||
| sed -En '/^[Ll]ocation: (.+)$/{s//\1/;p}'
|
||||
}
|
||||
__z_curl_response() {
|
||||
__z_curl_headers -L "$1" \
|
||||
| sed -En '/^HTTP\/[0-9.]+ ([1-5][0-9]{2})( .+)?$/{s//\1/;p}' \
|
||||
| tail -n 1
|
||||
}
|
155
.config/zsh/lib/git.zsh
Normal file
155
.config/zsh/lib/git.zsh
Normal file
@@ -0,0 +1,155 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## fancy and manageable PS1 for git
|
||||
typeset -gA ZSHU_GIT ZSHU_PM ZSHU_PS
|
||||
ZSHU_PS[git]=0
|
||||
ZSHU_PM[git_branch]='🞷'
|
||||
ZSHU_PM[git_ahead]='↱'
|
||||
ZSHU_PM[git_behind]='↴'
|
||||
ZSHU_PM[git_detach]='☈'
|
||||
ZSHU_PM[git_tag]='🗹'
|
||||
ZSHU_PM[git_commit]='⌽'
|
||||
|
||||
__z_git_avail() { (( $+commands[git] )) ; }
|
||||
|
||||
__z_git() { GIT_OPTIONAL_LOCKS=0 command git "$@"; }
|
||||
|
||||
__z_git_is_repo() { __z_git rev-parse --git-dir &>/dev/null ; }
|
||||
|
||||
__z_git_desc_tag() { __z_git describe --tags "$@" ; }
|
||||
|
||||
z-git-test() {
|
||||
[ "${ZSHU_PS[git]}" = '1' ] || return 1
|
||||
|
||||
__z_git_avail || return $?
|
||||
|
||||
__z_git_is_repo || return 3
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
__z_git_pwd() {
|
||||
unset 'ZSHU_PS[git_ref]' 'ZSHU_PS[git_changes]' 'ZSHU_PS[git_tag]'
|
||||
ZSHU_GIT=()
|
||||
z-git-test || return
|
||||
|
||||
|
||||
local x
|
||||
x=$(__z_git rev-parse --short HEAD 2>/dev/null)
|
||||
[ -n "$x" ] || return
|
||||
ZSHU_GIT[commit]=$x
|
||||
|
||||
## git ref
|
||||
while : ; do
|
||||
ZSHU_GIT[detached]=1
|
||||
x=$(__z_git symbolic-ref --short HEAD 2>/dev/null)
|
||||
if [ -n "$x" ] ; then
|
||||
ZSHU_GIT[detached]=0
|
||||
ZSHU_GIT[ref]=$x
|
||||
ZSHU_PS[git_ref]="%F{green}%B${ZSHU_PM[git_branch]}%b ${ZSHU_GIT[ref]}%f"
|
||||
break
|
||||
fi
|
||||
|
||||
x=$(__z_git for-each-ref --format='%(refname:short)' --count=1 --points-at=${ZSHU_GIT[commit]} refs/heads/ refs/remotes/)
|
||||
if [ -n "$x" ] ; then
|
||||
ZSHU_GIT[detached]=0
|
||||
ZSHU_GIT[ref]=$x
|
||||
ZSHU_PS[git_ref]="%F{yellow}%B${ZSHU_PM[git_branch]}%b ${ZSHU_GIT[ref]}%f"
|
||||
break
|
||||
fi
|
||||
|
||||
ZSHU_GIT[ref]=${ZSHU_GIT[commit]}
|
||||
ZSHU_PS[git_ref]="%F{red}%B${ZSHU_PM[git_detach]}%b ${ZSHU_GIT[ref]}%f"
|
||||
|
||||
break
|
||||
done
|
||||
|
||||
## local<->remote changes
|
||||
while [ ${ZSHU_GIT[detached]} = 0 ] ; do
|
||||
x=$(__z_git for-each-ref --format='%(upstream:short)' --count=1 --points-at=${ZSHU_GIT[commit]} refs/heads/ refs/remotes/)
|
||||
[ -n "$x" ] || break
|
||||
ZSHU_GIT[remote]=$x
|
||||
|
||||
x=$(__z_git rev-list --left-right "${ZSHU_GIT[ref]}...${ZSHU_GIT[remote]}" 2>/dev/null) || break
|
||||
ZSHU_GIT[ref_ahead]=$(echo "$x" | grep -Ec '^<')
|
||||
ZSHU_GIT[ref_behind]=$(echo "$x" | grep -Ec '^>')
|
||||
ZSHU_GIT[ref_changes]=$[ ZSHU_GIT[ref_ahead] + ZSHU_GIT[ref_behind] ]
|
||||
[ ${ZSHU_GIT[ref_changes]} -eq 0 ] && break
|
||||
|
||||
x=''
|
||||
[ ${ZSHU_GIT[ref_ahead]} -eq 0 ] || x="$x${x:+ }%B%F{green}${ZSHU_PM[git_ahead]} ${ZSHU_GIT[ref_ahead]}%b"
|
||||
[ ${ZSHU_GIT[ref_behind]} -eq 0 ] || x="$x${x:+ }%B%F{red}${ZSHU_PM[git_behind]} ${ZSHU_GIT[ref_behind]}%b"
|
||||
ZSHU_PS[git_changes]=$x
|
||||
|
||||
break
|
||||
done
|
||||
|
||||
## git tag
|
||||
while [ ${ZSHU_GIT[detached]} = 1 ] ; do
|
||||
x=$(__z_git_desc_tag --exact-match HEAD 2>/dev/null)
|
||||
if [ -n "$x" ] ; then
|
||||
ZSHU_GIT[tag]=$x
|
||||
ZSHU_PS[git_tag]="%F{green}%B${ZSHU_PM[git_tag]}%b ${ZSHU_GIT[tag]}%f"
|
||||
break
|
||||
fi
|
||||
|
||||
x=$(__z_git_desc_tag HEAD 2>/dev/null)
|
||||
if [ -n "$x" ] ; then
|
||||
ZSHU_GIT[tag]=${x%-*}
|
||||
ZSHU_PS[git_tag]="%F{yellow}%B${ZSHU_PM[git_commit]}%b ${ZSHU_GIT[tag]}%f"
|
||||
break
|
||||
fi
|
||||
|
||||
break
|
||||
done
|
||||
|
||||
## try to fancy split current path
|
||||
while : ; do
|
||||
x=${(%):-%~}
|
||||
[[ "$x" =~ '/.+' ]] || break
|
||||
|
||||
local pfx last mid
|
||||
pfx=$(__z_git rev-parse --show-prefix)
|
||||
pfx="${pfx%/}"
|
||||
if [ -n "${pfx}" ] ; then
|
||||
x=${x%/${pfx}}
|
||||
last="${pfx:t}"
|
||||
mid="${pfx%${last}}"
|
||||
mid="${mid%/}"
|
||||
mid="/${mid}${mid:+/}"
|
||||
|
||||
ZSHU_GIT[path_mid]=${mid}
|
||||
ZSHU_GIT[path_last]=${last}
|
||||
else
|
||||
ZSHU_GIT[path_last]='/'
|
||||
fi
|
||||
break
|
||||
done
|
||||
ZSHU_GIT[path_root]=$x
|
||||
|
||||
x="%F{magenta}${ZSHU_GIT[path_root]:gs/%/%%}"
|
||||
x="$x%F{cyan}${ZSHU_GIT[path_mid]:gs/%/%%}"
|
||||
x="$x%B${ZSHU_GIT[path_last]:gs/%/%%}%f%b"
|
||||
ZSHU_PS[pwd]=$x
|
||||
|
||||
local -a ary
|
||||
ary+="${ZSHU_PS[git_ref]}"
|
||||
ary+="${ZSHU_PS[git_changes]}"
|
||||
ary+="${ZSHU_PS[git_tag]}"
|
||||
x="${(j: :)ary}"
|
||||
[ -z "$x" ] || ZSHU_PS[pwd_extra]=" $x"
|
||||
}
|
||||
|
||||
z-git-enable() { ZSHU_PS[git]=1 ; }
|
||||
z-git-disable() { ZSHU_PS[git]=0 ; }
|
||||
|
||||
z-git-status() {
|
||||
__z_git_avail
|
||||
echo "Git binary: "${(%):-%(?..NOT )}"found in PATH"
|
||||
[ "${ZSHU_PS[git]}" = 1 ]
|
||||
echo "Git prompt: "${(%):-%(?.enabled.disabled)}
|
||||
__z_git_is_repo
|
||||
echo "Git repo: "${(%):-%(?..NOT )}"present"
|
||||
}
|
||||
|
||||
ZSHU[pwd_hook]="${ZSHU[pwd_hook]}${ZSHU[pwd_hook]:+ }__z_git_pwd"
|
45
.config/zsh/lib/gpg.zsh
Normal file
45
.config/zsh/lib/gpg.zsh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-gpgconf-comp-avail() {
|
||||
(( ${+commands[gpgconf]} )) || return 127
|
||||
|
||||
local comp
|
||||
comp="${1:?}"
|
||||
|
||||
local csv
|
||||
csv=$(command gpgconf --list-components | IFS=':' z-csv-select 1 "${comp}")
|
||||
[ -n "${csv}" ]
|
||||
}
|
||||
|
||||
z-gpgconf-comp-opt-avail() {
|
||||
(( ${+commands[gpgconf]} )) || return 127
|
||||
|
||||
local comp opt
|
||||
comp="${1:?}" opt="${2:?}"
|
||||
|
||||
z-gpgconf-comp-avail "${comp}" || return $?
|
||||
|
||||
local csv
|
||||
csv=$(command gpgconf --list-options "${comp}" | IFS=':' z-csv-select 1 "${opt}")
|
||||
[ -n "${csv}" ]
|
||||
}
|
||||
|
||||
## merely that command:
|
||||
## gpgconf --list-options "$1" | awk -F: "/^$2:/{ print \$10 }"
|
||||
z-gpgconf-getopt() {
|
||||
(( ${+commands[gpgconf]} )) || return 127
|
||||
|
||||
local comp opt
|
||||
comp="${1:?}" opt="${2:?}"
|
||||
|
||||
## not really necessary here
|
||||
# z-gpgconf-comp-opt-avail "${comp}" "${opt}" || return $?
|
||||
|
||||
local csv
|
||||
csv=$(command gpgconf --list-options "${comp}" | IFS=':' z-csv-select 1 "${opt}")
|
||||
[ -n "${csv}" ] || return 1
|
||||
|
||||
local v
|
||||
v=$(IFS=':' z-csv-field 10 <<< "${csv}")
|
||||
printf '%s' "$v"
|
||||
}
|
19
.config/zsh/lib/history.zsh
Normal file
19
.config/zsh/lib/history.zsh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-history() {
|
||||
local list
|
||||
|
||||
zparseopts -E l=list
|
||||
if [ -n "${list}" ]; then
|
||||
builtin fc "$@"
|
||||
else
|
||||
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -il "$@" || builtin fc -il "$@" 1
|
||||
fi
|
||||
}
|
||||
|
||||
z-grephist() {
|
||||
local x
|
||||
|
||||
x=$1 ; shift
|
||||
z-history -m "*${x}*" "$@"
|
||||
}
|
51
.config/zsh/lib/prompt.zsh
Normal file
51
.config/zsh/lib/prompt.zsh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -gA ZSHU_PM ZSHU_PS
|
||||
|
||||
ZSHU_PM[rst]='%b%k%u%s%f'
|
||||
ZSHU_PM[crlf]=$'\n'
|
||||
|
||||
ZSHU_PS[shlvl]='%(2L.%B%F{white}|%F{cyan}%L%b%f.)'
|
||||
|
||||
ZSHU_PM[status]='▪'
|
||||
ZSHU_PS[lastcmd]="%B%(?.%F{green}.%F{red})${ZSHU_PM[status]}%f%b"
|
||||
|
||||
ZSHU_PS[pwd_std]='%F{cyan}%B%~%f%b'
|
||||
|
||||
ZSHU_PM[cmd_user]='%F{white}$'
|
||||
ZSHU_PM[cmd_root]='%F{red}#'
|
||||
ZSHU_PS[cmd]="%k%B%(!.${ZSHU_PM[cmd_root]}.${ZSHU_PM[cmd_user]})${ZSHU_PM[rst]} "
|
||||
|
||||
ZSHU_PM[user]='%(!.%F{magenta}.%F{green})%n%f'
|
||||
ZSHU_PM[host]="%B%(!.%F{red}.%F{blue})${ZSHU[host]}%f%b"
|
||||
|
||||
if autoload -Uz add-zsh-hook ; then
|
||||
|
||||
__z_pwd() {
|
||||
local p pfx last
|
||||
|
||||
p=${(%):-%~}
|
||||
[[ "$p" =~ '/.+' ]] || return
|
||||
pfx="${p:h}"
|
||||
pfx="${pfx%%/}"
|
||||
last="${p:t}"
|
||||
ZSHU_PS[pwd]="%F{cyan}${pfx}/%B${last}%f%b"
|
||||
}
|
||||
|
||||
# ZSHU[pwd_hook]=''
|
||||
__z_pwd_hook() {
|
||||
local i
|
||||
|
||||
unset 'ZSHU_PS[pwd]'
|
||||
for i ( ${(s: :)ZSHU[pwd_hook]} __z_pwd ) ; do
|
||||
unset 'ZSHU_PS[pwd_extra]'
|
||||
"$i"
|
||||
(( ${+ZSHU_PS[pwd]} )) && return
|
||||
done
|
||||
}
|
||||
|
||||
add-zsh-hook precmd __z_pwd_hook
|
||||
|
||||
else
|
||||
echo "shiny pwd's are disabled due to missing hook support" >&2
|
||||
fi
|
83
.config/zsh/lib/pswalk.zsh
Normal file
83
.config/zsh/lib/pswalk.zsh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-proc-exists() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
while [ -n "${ZSHU[procfs]}" ] ; do
|
||||
[ -d "${ZSHU[procfs]}" ] || return 1
|
||||
[ -f "${ZSHU[procfs]}/$1/status" ]
|
||||
return $?
|
||||
done
|
||||
|
||||
ps -o 'pid=' -p "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
typeset -Uga ZSHU_PARENTS_PID
|
||||
typeset -ga ZSHU_PARENTS_NAME
|
||||
|
||||
function {
|
||||
local procfs
|
||||
while [ -n "${ZSHU[procfs]}" ] ; do
|
||||
[ -d "${ZSHU[procfs]}" ] || break
|
||||
procfs=1 ; break
|
||||
done
|
||||
|
||||
local i c x _unused
|
||||
|
||||
i=${PPID}
|
||||
while : ; do
|
||||
[ -n "$i" ] || break
|
||||
## don't deal with PID1
|
||||
[ "$i" = 1 ] && break
|
||||
|
||||
ZSHU_PARENTS_PID+=( $i )
|
||||
|
||||
c=
|
||||
while [ "${procfs}" = 1 ] ; do
|
||||
[ -f "${ZSHU[procfs]}/$i/cmdline" ] || break
|
||||
read -d $'\0' -rs c <<< $(cat "${ZSHU[procfs]}/$i/cmdline")
|
||||
break
|
||||
done
|
||||
if [ -z "$c" ] ; then
|
||||
read -rs c _unused <<< "$(ps -o 'comm=' -p "$i" 2>/dev/null)"
|
||||
fi
|
||||
[ -n "$c" ] && ZSHU_PARENTS_NAME+=( "${c:t}" )
|
||||
|
||||
x=
|
||||
while [ "${procfs}" = 1 ] ; do
|
||||
[ -f "${ZSHU[procfs]}/$i/status" ] || break
|
||||
# read -rs _unused x <<< "$(cat "${ZSHU[procfs]}/$i/status" | grep -F 'PPid:')"
|
||||
while read -rs _unused c ; do
|
||||
[ "${_unused}" = 'PPid:' ] || continue
|
||||
x=$c ; break
|
||||
done < "${ZSHU[procfs]}/$i/status"
|
||||
break
|
||||
done
|
||||
if [ -z "$x" ] ; then
|
||||
read -rs x _unused <<< "$(ps -o 'ppid=' -p "$i" 2>/dev/null)"
|
||||
fi
|
||||
i=$x
|
||||
done
|
||||
|
||||
typeset -r ZSHU_PARENTS_PID ZSHU_PARENTS_NAME
|
||||
}
|
||||
|
||||
typeset -gA ZSHU_RUN
|
||||
|
||||
z-run-test() {
|
||||
local k i
|
||||
|
||||
k=$1 ; shift
|
||||
for i ( ${ZSHU_PARENTS_NAME} ) ; do
|
||||
(( ${+argv[(r)$i]} )) || continue
|
||||
|
||||
ZSHU_RUN[$k]=1
|
||||
return
|
||||
done
|
||||
ZSHU_RUN[$k]=0
|
||||
}
|
||||
|
||||
z-run-test gui konsole xterm x-terminal-emulator
|
||||
z-run-test nested SCREEN screen tmux mc
|
||||
z-run-test nested1L mc
|
||||
z-run-test elevated sudo su
|
17
.config/zsh/lib/say-my.zsh
Normal file
17
.config/zsh/lib/say-my.zsh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/zsh
|
||||
|
||||
say_my_name() {
|
||||
set -a
|
||||
GIT_COMMITTER_NAME="$1"
|
||||
GIT_AUTHOR_NAME="$1"
|
||||
DEBFULLNAME="$1"
|
||||
set +a
|
||||
}
|
||||
|
||||
say_my_email() {
|
||||
set -a
|
||||
GIT_COMMITTER_EMAIL="$1"
|
||||
GIT_AUTHOR_EMAIL="$1"
|
||||
DEBEMAIL="$1"
|
||||
set +a
|
||||
}
|
71
.config/zsh/lib/selfservice.zsh
Normal file
71
.config/zsh/lib/selfservice.zsh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/zsh
|
||||
|
||||
dotfiles-update() {
|
||||
"${ZSHU[d_dotfiles]}/install.sh" "$@" || return $?
|
||||
}
|
||||
|
||||
dotfiles-git() { (
|
||||
cd "${ZSHU[d_zdot]}/"
|
||||
set -a
|
||||
GIT_DIR="${ZSHU[d_dotfiles]}/repo.git"
|
||||
GIT_WORK_TREE="${ZSHU[d_zdot]}"
|
||||
set +a
|
||||
z-reload
|
||||
) }
|
||||
|
||||
dotfiles-gen-gitignore() {
|
||||
local x='.config/dotfiles/gen-gitignore.sh'
|
||||
[ -x "$x" ] || {
|
||||
echo "${x:t} is somewhere else" >&2
|
||||
return 1
|
||||
}
|
||||
if [ -d .config/dotfiles/repo.git ] ; then
|
||||
echo "NOT going to change dotfiles installation" >&2
|
||||
return 2
|
||||
fi
|
||||
"$x" "$@"
|
||||
}
|
||||
|
||||
z-zwc-gen() {
|
||||
local i
|
||||
for i ( "${ZSHU[d_conf]}"/**/*.zsh(N.r) ) ; do
|
||||
zcompile -UR "$i"
|
||||
done
|
||||
# for i ( "${ZSHU[d_completion]}"/*(N.r) ) ; do
|
||||
# case "$i" in
|
||||
# *.zwc )
|
||||
# # likely a remnant
|
||||
# rm -f "$i"
|
||||
# continue
|
||||
# ;;
|
||||
# esac
|
||||
# zcompile -UR "$i"
|
||||
# mv -f "$i.zwc" "${ZSHU[d_compzwc]}/"
|
||||
# done
|
||||
}
|
||||
|
||||
z-zwc-flush() {
|
||||
rm -f "${ZSHU[d_conf]}"/**/*.zwc(N.r)
|
||||
}
|
||||
|
||||
z-update() {
|
||||
dotfiles-update || return $?
|
||||
z-cache-flush
|
||||
}
|
||||
|
||||
z-reload() {
|
||||
export ZDOTDIR="${ZSHU[d_zdot]}"
|
||||
local r
|
||||
exec -a "${ZSH_ARGZERO}" "${ZSH_NAME}" "${argv[@]}"
|
||||
r=$?
|
||||
echo "unable to reload (something went wrong), code $r" >&2
|
||||
return $r
|
||||
}
|
||||
|
||||
## reload or new session are required to regenerate compcache
|
||||
z-cache-flush() {
|
||||
find "${ZSHU[d_cache]}/" -xdev -type f '!' -name '.keep' -delete
|
||||
find "${ZSHU[d_zdot]}/.config/zsh.dots/" -xdev -type f '!' -name '.zshenv' -delete
|
||||
z-zwc-flush
|
||||
z-zwc-gen
|
||||
}
|
18
.config/zsh/lib/systemd.zsh
Normal file
18
.config/zsh/lib/systemd.zsh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-systemctl() {
|
||||
command systemctl --quiet --no-pager --lines=0 --no-ask-password "$@"
|
||||
}
|
||||
|
||||
z-systemctl-status-rc() {
|
||||
z-systemctl status "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
z-systemctl-exists() {
|
||||
z-systemctl-status-rc "$@"
|
||||
case "$?" in
|
||||
0 | 1 | 3 ) return 0 ;;
|
||||
## also 4 = "no such unit"
|
||||
* ) return 1 ;;
|
||||
esac
|
||||
}
|
18
.config/zsh/lib/term.zsh
Normal file
18
.config/zsh/lib/term.zsh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -Uga ZSHU_TERM_MISSING
|
||||
|
||||
z-ti-test() {
|
||||
local r i
|
||||
|
||||
r=0
|
||||
for i ; do
|
||||
[ -z "$i" ] && continue
|
||||
if ! (( ${+terminfo[$i]} )) ; then
|
||||
ZSHU_TERM_MISSING+=( "$1" )
|
||||
r=1
|
||||
fi
|
||||
done
|
||||
|
||||
return $r
|
||||
}
|
41
.config/zsh/lib/time.zsh
Normal file
41
.config/zsh/lib/time.zsh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-ts-to-human() {
|
||||
local t s n d h m f x
|
||||
|
||||
t=$1
|
||||
t=$[ float(t) ]
|
||||
s=$[ int(t) ]
|
||||
n=$[ int((t - s) * (10**9)) ]
|
||||
t=$s
|
||||
|
||||
d=0 h=0 m=0
|
||||
if [ $t -ge 86400 ] ; then
|
||||
d=$[ t / 86400 ]
|
||||
t=$[ t % 86400 ]
|
||||
fi
|
||||
if [ $t -ge 3600 ] ; then
|
||||
h=$[ t / 3600 ]
|
||||
t=$[ t % 3600 ]
|
||||
fi
|
||||
if [ $t -ge 60 ] ; then
|
||||
m=$[ t / 60 ]
|
||||
t=$[ t % 60 ]
|
||||
fi
|
||||
|
||||
## strftime does desired rounding for $n/(10**9) internally
|
||||
f=$(strftime '%s.%6.' $t $n)
|
||||
## keep math in sync with format above
|
||||
x=3
|
||||
case "$2" in
|
||||
0 ) x=7 ;;
|
||||
[1-6] ) x=$[ 6 - $2 ] ;;
|
||||
esac
|
||||
[ $x -gt 0 ] && f="${f:0:-$x}s"
|
||||
|
||||
[ $s -ge 60 ] && f="${m}m:$f"
|
||||
[ $s -ge 3600 ] && f="${h}h:$f"
|
||||
[ $s -ge 86400 ] && f="${d}d:$f"
|
||||
|
||||
echo "$f"
|
||||
}
|
58
.config/zsh/lib/title.zsh
Normal file
58
.config/zsh/lib/title.zsh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/bin/zsh
|
||||
|
||||
ZSHU[title_tab]='%15<..<%~%<<'
|
||||
ZSHU[title_window]='%n@%m:%~'
|
||||
|
||||
z-title-tab() {
|
||||
emulate -L zsh
|
||||
|
||||
case "${TERM}" in
|
||||
cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* )
|
||||
print -Pn "\e]1;${1:q}\a"
|
||||
;;
|
||||
screen* | tmux* )
|
||||
## hardstatus
|
||||
print -Pn "\ek${1:q}\e\\"
|
||||
;;
|
||||
* )
|
||||
z-ti-test fsl tsl || return
|
||||
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
z-title-window() {
|
||||
emulate -L zsh
|
||||
|
||||
case "${TERM}" in
|
||||
cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* )
|
||||
print -Pn "\e]2;${1:q}\a"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
z-title() {
|
||||
emulate -L zsh
|
||||
|
||||
## if $2 is unset use $1 as default
|
||||
## if it is set and empty, leave it as is
|
||||
: ${2=$1}
|
||||
|
||||
z-title-tab "$1"
|
||||
z-title-window "$2"
|
||||
}
|
||||
|
||||
if autoload -Uz add-zsh-hook ; then
|
||||
|
||||
__z_title_precmd() {
|
||||
z-title "${ZSHU[title_tab]}" "${ZSHU[title_window]}"
|
||||
}
|
||||
|
||||
add-zsh-hook precmd __z_title_precmd
|
||||
|
||||
else
|
||||
echo "tab/window title handling is disabled due to missing hook support" >&2
|
||||
fi
|
4
.config/zsh/local.zsh.example
Normal file
4
.config/zsh/local.zsh.example
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/zsh
|
||||
|
||||
## skip system-wide podman completion and produce own
|
||||
ZSHU_COMP_FORCE[podman]=1
|
0
.config/zsh/local/.keep
Normal file
0
.config/zsh/local/.keep
Normal file
0
.config/zsh/local/completion/.keep
Normal file
0
.config/zsh/local/completion/.keep
Normal file
11
.config/zsh/local/env.zsh.example
Normal file
11
.config/zsh/local/env.zsh.example
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-ssh-agent
|
||||
z-gpg-agent
|
||||
z-adjust-docker
|
||||
|
||||
## systemctl status podman.socket
|
||||
export DOCKER_HOST=unix:///run/podman/podman.sock
|
||||
|
||||
## systemctl --user status podman.socket
|
||||
export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/podman/podman.sock
|
13
.config/zsh/opt.zsh
Normal file
13
.config/zsh/opt.zsh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/zsh
|
||||
|
||||
unsetopt err_exit
|
||||
unsetopt err_return
|
||||
unsetopt multios
|
||||
|
||||
setopt bsd_echo
|
||||
setopt interactive_comments
|
||||
setopt long_list_jobs
|
||||
setopt monitor
|
||||
setopt prompt_subst
|
||||
setopt zle
|
||||
# setopt magic_equal_subst
|
5
.config/zsh/opt/chase.zsh
Normal file
5
.config/zsh/opt/chase.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-chase() { setopt chase_dots chase_links ; }
|
||||
z-nochase() { unsetopt chase_dots chase_links ; }
|
||||
z-nochase
|
9
.config/zsh/opt/completion.zsh
Normal file
9
.config/zsh/opt/completion.zsh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/zsh
|
||||
|
||||
unsetopt flow_control
|
||||
unsetopt menu_complete
|
||||
|
||||
setopt always_to_end
|
||||
setopt auto_menu
|
||||
setopt complete_aliases
|
||||
setopt complete_in_word
|
7
.config/zsh/opt/directories.zsh
Normal file
7
.config/zsh/opt/directories.zsh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/zsh
|
||||
|
||||
setopt auto_cd
|
||||
setopt auto_pushd
|
||||
setopt cdable_vars
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushd_minus
|
11
.config/zsh/opt/history.zsh
Normal file
11
.config/zsh/opt/history.zsh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/zsh
|
||||
|
||||
setopt append_history
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_all_dups
|
||||
setopt hist_ignore_dups
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history
|
3
.config/zsh/opt/prompt.zsh
Normal file
3
.config/zsh/opt/prompt.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/zsh
|
||||
|
||||
setopt prompt_subst
|
28
.config/zsh/rc.zsh
Normal file
28
.config/zsh/rc.zsh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -Ua zshu_modules
|
||||
zshu_modules+=(
|
||||
complete
|
||||
complist
|
||||
computil
|
||||
datetime
|
||||
langinfo
|
||||
main
|
||||
mathfunc
|
||||
parameter
|
||||
stat
|
||||
system
|
||||
terminfo
|
||||
zle
|
||||
zutil
|
||||
)
|
||||
for i ( ${zshu_modules} ) ; do
|
||||
case "$i" in
|
||||
*/* ) ;;
|
||||
* ) i="zsh/$i" ;;
|
||||
esac
|
||||
zmodload "$i"
|
||||
done
|
||||
unset i zshu_modules
|
||||
|
||||
autoload -Uz +X colors && colors
|
41
.config/zsh/rc/completion.zsh
Normal file
41
.config/zsh/rc/completion.zsh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/zsh
|
||||
|
||||
__z_compdump_verify
|
||||
|
||||
## :completion:<function-name>:<completer>:<command>:<argument>:<tag>
|
||||
|
||||
zstyle ':completion::complete:*' use-cache 1
|
||||
zstyle ':completion::complete:*' cache-path "${ZSHU[d_compcache]}"
|
||||
|
||||
bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns adm amanda apache at avahi avahi-autoipd backup beaglidx bin bind cacti canna clamav colord daemon dbus distcache dnsmasq dovecot fax ftp games gdm gkrellmd gnats gopher hacluster haldaemon halt hplip hsqldb ident irc junkbust kdm ldap list lp mail mailman mailnull man messagebus mldonkey mysql nagios named netdump news nfsnobody nginx nobody nscd ntp ntpsec nut nx obsrun openvpn operator pcap polkitd postfix postgres privoxy proxy pulse pvm quagga radvd redsocks rpc rpcuser rpm rtkit saned sbuild sbws scard sddm shutdown speech-dispatcher squid sshd statd svn sync sys tcpdump tftp tss usbmux uucp uuidd vcsa wwwrun www-data x2gouser xfs '_*' 'systemd-*' 'debian-*' 'Debian-*'
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u ${USER} -o pid,user,comm -w -w"
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
zstyle ':completion:*:kill:*' command 'ps -u ${USER} -o pid,%cpu,tty,cputime,cmd'
|
||||
|
||||
autoload -Uz +X compinit && \
|
||||
compinit -i -C -d "${ZSHU[f_compdump]}"
|
||||
|
||||
unset 'ZSHU[compdump_bash]'
|
||||
if autoload -Uz +X bashcompinit ; then
|
||||
bashcompinit && ZSHU[compdump_bash]=1
|
||||
fi
|
||||
|
||||
for i ( "${ZSHU[d_conf]}"/completion/*.zsh(N.r) ) ; do
|
||||
source "$i"
|
||||
done ; unset i
|
||||
for i ( "${ZSHU[d_conf]}"/local/completion/*.zsh(N.r) ) ; do
|
||||
source "$i"
|
||||
done ; unset i
|
||||
|
||||
__z_compdump_finalize
|
38
.config/zsh/rc/gpg-agent.zsh
Normal file
38
.config/zsh/rc/gpg-agent.zsh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-gpg-agent() {
|
||||
## don't bother with gpg agent socket if it already set
|
||||
[ -z "${GPG_AGENT_INFO}" ] || return 0
|
||||
|
||||
(( ${+commands[gpg-agent]} )) || return 127
|
||||
|
||||
if (( ${+commands[systemctl]} )) ; then
|
||||
local u s
|
||||
for u in gpg-agent.{service,socket} ; do
|
||||
s=$(z-systemctl --user is-enabled $u)
|
||||
case "$s" in
|
||||
disabled ) ;;
|
||||
* ) continue ;;
|
||||
esac
|
||||
z-systemctl --user --now enable $u
|
||||
done
|
||||
fi
|
||||
|
||||
(( ${+commands[gpgconf]} )) || return 127
|
||||
|
||||
local agent_sock
|
||||
agent_sock=$(command gpgconf --list-dirs agent-socket) || return $?
|
||||
[ -n "${agent_sock}" ] || return 3
|
||||
export GPG_AGENT_INFO="${agent_sock}:0:1"
|
||||
|
||||
## don't bother with ssh agent socket if it already set
|
||||
[ -z "${SSH_AUTH_SOCK}" ] || return 0
|
||||
|
||||
local want_ssh_agent ssh_auth_sock
|
||||
want_ssh_agent=$(z-gpgconf-getopt gpg-agent enable-ssh-support)
|
||||
if [ "${want_ssh_agent}" = 1 ] ; then
|
||||
ssh_auth_sock=$(command gpgconf --list-dirs agent-ssh-socket) || return $?
|
||||
[ -n "${ssh_auth_sock}" ] || return 5
|
||||
export SSH_AUTH_SOCK="${ssh_auth_sock}"
|
||||
fi
|
||||
}
|
138
.config/zsh/rc/keyboard.zsh
Normal file
138
.config/zsh/rc/keyboard.zsh
Normal file
@@ -0,0 +1,138 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -A ZSHU_TI_KEYS
|
||||
typeset -A ZSHU_FB_KEYS
|
||||
|
||||
if z-ti-test smkx rmkx ; then
|
||||
zle-line-init() { emulate -L zsh ; echoti smkx ; }
|
||||
zle-line-finish() { emulate -L zsh ; echoti rmkx ; }
|
||||
# zle-line-init() { echoti smkx ; }
|
||||
# zle-line-finish() { echoti rmkx ; }
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
## key [sequence] via terminfo
|
||||
z-kseq-ti() {
|
||||
[ -z "$1" ] && return
|
||||
[ -z "$2" ] && return
|
||||
|
||||
z-ti-test "$2" && ZSHU_TI_KEYS[${terminfo[$2]}]=$1
|
||||
}
|
||||
|
||||
## key [sequence] via fallback
|
||||
z-kseq-fb() {
|
||||
[ -z "$1" ] && return
|
||||
[ -z "$2" ] && return
|
||||
|
||||
ZSHU_FB_KEYS[$2]=$1
|
||||
}
|
||||
|
||||
z-kseq-ti Backspace kbs
|
||||
|
||||
z-kseq-ti Home khome
|
||||
z-kseq-ti End kend
|
||||
z-kseq-ti Insert kich1
|
||||
z-kseq-ti Delete kdch1
|
||||
|
||||
z-kseq-ti Up kcuu1
|
||||
z-kseq-ti Down kcud1
|
||||
z-kseq-ti Left kcub1
|
||||
z-kseq-ti Right kcuf1
|
||||
|
||||
z-kseq-ti PageUp kpp
|
||||
z-kseq-ti PageDown knp
|
||||
|
||||
z-kseq-ti Shift-Tab kcbt
|
||||
|
||||
z-kseq-fb Backspace '^?'
|
||||
z-kseq-fb Home '^[[H'
|
||||
z-kseq-fb End '^[[F'
|
||||
z-kseq-fb Insert '^[[2~'
|
||||
z-kseq-fb Delete '^[[3~'
|
||||
z-kseq-fb Delete # '^[3;5~'
|
||||
|
||||
z-kseq-fb Up '^[[A'
|
||||
z-kseq-fb Down '^[[B'
|
||||
z-kseq-fb Left '^[[D'
|
||||
z-kseq-fb Right '^[[C'
|
||||
|
||||
z-kseq-fb PageUp '^[[5~'
|
||||
z-kseq-fb PageDown '^[[6~'
|
||||
|
||||
z-kseq-fb Ctrl-Delete '^[[3;5~'
|
||||
z-kseq-fb Ctrl-RightArrow '^[[1;5C'
|
||||
z-kseq-fb Ctrl-LeftArrow '^[[1;5D'
|
||||
|
||||
z-kseq-fb Esc-w '\ew'
|
||||
|
||||
z-bind () {
|
||||
local -a maps
|
||||
local -Ua keys
|
||||
local widget i k
|
||||
|
||||
while [ "$1" != "--" ] ; do
|
||||
maps+=( "$1" )
|
||||
shift
|
||||
done
|
||||
shift
|
||||
|
||||
widget="$2"
|
||||
|
||||
keys+=( ${(k)ZSHU_TI_KEYS[(r)$1]} )
|
||||
keys+=( ${(k)ZSHU_FB_KEYS[(r)$1]} )
|
||||
|
||||
[ ${#keys} -eq 0 ] && return 1
|
||||
|
||||
case "${widget}" in
|
||||
/* )
|
||||
widget=${widget:1}
|
||||
emulate zsh -c "autoload -RUz ${widget}"
|
||||
zle -N "${widget}"
|
||||
;;
|
||||
esac
|
||||
|
||||
for i in "${maps[@]}" ; do
|
||||
for k in "${keys[@]}" ; do
|
||||
bindkey -M "$i" "$k" "${widget}"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
z-bind emacs -- Backspace backward-delete-char
|
||||
z-bind viins -- Backspace vi-backward-delete-char
|
||||
z-bind vicmd -- Backspace vi-backward-char
|
||||
z-bind emacs -- Home beginning-of-line
|
||||
z-bind viins vicmd -- Home vi-beginning-of-line
|
||||
z-bind emacs -- End end-of-line
|
||||
z-bind viins vicmd -- End vi-end-of-line
|
||||
z-bind emacs viins -- Insert overwrite-mode
|
||||
z-bind vicmd -- Insert vi-insert
|
||||
z-bind emacs -- Delete delete-char
|
||||
z-bind viins vicmd -- Delete vi-delete-char
|
||||
z-bind emacs viins vicmd -- Up /up-line-or-beginning-search
|
||||
z-bind emacs viins vicmd -- Down /down-line-or-beginning-search
|
||||
z-bind emacs -- Left backward-char
|
||||
z-bind viins vicmd -- Left vi-backward-char
|
||||
z-bind emacs -- Right forward-char
|
||||
z-bind viins vicmd -- Right vi-forward-char
|
||||
z-bind emacs viins vicmd -- PageUp up-line-or-history
|
||||
z-bind emacs viins vicmd -- PageDown down-line-or-history
|
||||
|
||||
z-bind emacs viins vicmd -- Shift-Tab reverse-menu-complete
|
||||
|
||||
z-bind emacs viins vicmd -- Ctrl-Delete kill-word
|
||||
z-bind emacs -- Ctrl-RightArrow forward-word
|
||||
z-bind viins vicmd -- Ctrl-RightArrow vi-forward-word
|
||||
z-bind emacs -- Ctrl-LeftArrow backward-word
|
||||
z-bind viins vicmd -- Ctrl-LeftArrow vi-backward-word
|
||||
|
||||
z-bind emacs viins vicmd -- Esc-w kill-region
|
||||
|
||||
## use emacs key bindings
|
||||
bindkey -e
|
||||
|
||||
for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do
|
||||
[ -s "$i" ] || continue
|
||||
source $i
|
||||
done ; unset i
|
9
.config/zsh/rc/pager.zsh
Normal file
9
.config/zsh/rc/pager.zsh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/zsh
|
||||
|
||||
PAGER=$(z-alt-find 'less|pager|more')
|
||||
if [ -n "${PAGER}" ] ; then
|
||||
export PAGER
|
||||
READNULLCMD=$(which "${PAGER}" | xargs -r readlink -e)
|
||||
else
|
||||
unset PAGER READNULLCMD NULLCMD
|
||||
fi
|
100
.config/zsh/rc/prompt.zsh
Normal file
100
.config/zsh/rc/prompt.zsh
Normal file
@@ -0,0 +1,100 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -gA ZSHU_PS1
|
||||
|
||||
## three-line prompt
|
||||
function {
|
||||
local -a line
|
||||
|
||||
line+="${ZSHU_PM[rst]}"
|
||||
line+="%B%F{black}┌[%b"
|
||||
line+="%F{yellow}%D{%y.%m.%d} %B%D{%H:%M:%S}%f%b"
|
||||
line+="%B%F{black}|%b"
|
||||
line+='${ZSHU_PM[id]:+"%B%F{white}${ZSHU_PM[id]}${ZSHU_PM[rst]}%B%F{black}|%b%f"}'
|
||||
line+="${ZSHU_PM[user]}%F{white}@${ZSHU_PM[host]}"
|
||||
line+='${ZSHU_PS[elapsed]}'
|
||||
line+="${ZSHU_PM[rst]}"
|
||||
|
||||
line+="${ZSHU_PM[crlf]}"
|
||||
|
||||
line+="%B%F{black}┝%f%b "
|
||||
line+='${ZSHU_PS[pwd]:-${ZSHU_PS[pwd_std]}}'
|
||||
line+='${ZSHU_PS[pwd_extra]}'
|
||||
line+="${ZSHU_PM[rst]}"
|
||||
|
||||
line+="${ZSHU_PM[crlf]}"
|
||||
|
||||
line+="%B%F{black}└[%f%b"
|
||||
line+="${ZSHU_PS[lastcmd]}"
|
||||
line+='${ZSHU_PS[shlvl]}'
|
||||
line+="%B%F{black}|%b%f"
|
||||
line+="${ZSHU_PS[cmd]}"
|
||||
|
||||
ZSHU_PS1[3L]="${(j::)line}"
|
||||
}
|
||||
|
||||
## two-line prompt
|
||||
function {
|
||||
local -a line
|
||||
|
||||
line+="${ZSHU_PM[rst]}"
|
||||
line+="%B%F{black}┌[%b"
|
||||
line+='${ZSHU_PM[id]:+"%B%F{white}${ZSHU_PM[id]}${ZSHU_PM[rst]}%B%F{black}|%b%f"}'
|
||||
line+="${ZSHU_PM[user]}%F{white}@${ZSHU_PM[host]}"
|
||||
line+="%B%F{black}|%b"
|
||||
line+='${ZSHU_PS[pwd]:-${ZSHU_PS[pwd_std]}}'
|
||||
line+='${ZSHU_PS[pwd_extra]}'
|
||||
line+='${ZSHU_PS[elapsed]}'
|
||||
line+="${ZSHU_PM[rst]}"
|
||||
|
||||
line+="${ZSHU_PM[crlf]}"
|
||||
|
||||
line+="%B%F{black}└[%f%b"
|
||||
line+="${ZSHU_PS[lastcmd]}"
|
||||
line+='${ZSHU_PS[shlvl]}'
|
||||
line+="%B%F{black}|%b%f"
|
||||
line+="${ZSHU_PS[cmd]}"
|
||||
|
||||
ZSHU_PS1[2L]="${(j::)line}"
|
||||
}
|
||||
|
||||
## one-line prompt
|
||||
function {
|
||||
local -a line
|
||||
|
||||
line+="${ZSHU_PM[rst]}"
|
||||
line+="${ZSHU_PS[lastcmd]}"
|
||||
line+='${ZSHU_PS[shlvl]}'
|
||||
line+="%B%F{black}|%b"
|
||||
line+="${ZSHU_PM[user]}"
|
||||
line+="%B%F{black}|%b"
|
||||
line+='${ZSHU_PM[id]:+"%B%F{white}${ZSHU_PM[id]}${ZSHU_PM[rst]}%B%F{black}|%b%f"}'
|
||||
line+='${ZSHU_PS[pwd]:-${ZSHU_PS[pwd_std]}}'
|
||||
line+='${ZSHU_PS[pwd_extra]}'
|
||||
line+='${ZSHU_PS[elapsed]}'
|
||||
line+="%B%F{black}|%b"
|
||||
line+="${ZSHU_PS[cmd]}"
|
||||
|
||||
ZSHU_PS1[1L]="${(j::)line}"
|
||||
}
|
||||
|
||||
z-ps1() {
|
||||
[ -n "$1" ] || {
|
||||
echo "${ZSHU_PS[ps1]}"
|
||||
return
|
||||
}
|
||||
|
||||
local k
|
||||
for k ( "$1" "${1}L" ) ; do
|
||||
(( ${+ZSHU_PS1[$k]} )) || continue
|
||||
|
||||
ZSHU_PS[ps1]=$k
|
||||
PS1=${ZSHU_PS1[$k]}
|
||||
return
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
z-ps1 3
|
||||
[ "${ZSHU_RUN[nested]}" = 1 ] && z-ps1 2
|
||||
[ "${ZSHU_RUN[nested1L]}" = 1 ] && z-ps1 1
|
66
.config/zsh/rc/ssh-agent.zsh
Normal file
66
.config/zsh/rc/ssh-agent.zsh
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-ssh-agent() {
|
||||
while : ; do
|
||||
[ -n "${SSH_AGENT_PID}" ] || break
|
||||
z-proc-exists "${SSH_AGENT_PID}" || break
|
||||
|
||||
[ -n "${SSH_AUTH_SOCK}" ] || break
|
||||
[ -S "${SSH_AUTH_SOCK}" ] || break
|
||||
|
||||
## don't bother with ssh agent socket if it already set
|
||||
return 0
|
||||
|
||||
break
|
||||
done
|
||||
[ -z "${SSH_AGENT_PID}" ] || kill "${SSH_AGENT_PID}"
|
||||
unset SSH_AGENT_PID
|
||||
|
||||
(( ${+commands[ssh-agent]} )) || return 127
|
||||
|
||||
if [ -z "${SSH_AUTH_SOCK}" ] ; then
|
||||
local sock_dir
|
||||
if [ "${XDG_RUNTIME_DIR}" = "${TMPDIR}" ] ; then
|
||||
sock_dir="${ZSHU[d_zdot]}/.cache/ssh"
|
||||
else
|
||||
sock_dir="${XDG_RUNTIME_DIR}/ssh"
|
||||
fi
|
||||
mkdir -p "${sock_dir}"
|
||||
SSH_AUTH_SOCK="${sock_dir}/ssh-agent.sock"
|
||||
fi
|
||||
|
||||
local pid_file
|
||||
pid_file="${SSH_AUTH_SOCK:h}/ssh-agent.pid"
|
||||
while : ; do
|
||||
[ -s "${pid_file}" ] || break
|
||||
SSH_AGENT_PID=$(cat "${pid_file}")
|
||||
z-proc-exists "${SSH_AGENT_PID}" || break
|
||||
[ -S "${SSH_AUTH_SOCK}" ] || break
|
||||
|
||||
## don't bother with ssh agent socket if it already set
|
||||
export SSH_AGENT_PID SSH_AUTH_SOCK
|
||||
return 0
|
||||
done
|
||||
unset SSH_AGENT_PID
|
||||
|
||||
if [ -S "${SSH_AUTH_SOCK}" ] ; then
|
||||
rm -fv "${SSH_AUTH_SOCK}"
|
||||
fi
|
||||
|
||||
{
|
||||
eval "$(ssh-agent -s -a "${SSH_AUTH_SOCK}")"
|
||||
} >/dev/null
|
||||
|
||||
while : ; do
|
||||
[ -n "${SSH_AGENT_PID}" ] || break
|
||||
[ -n "${SSH_AUTH_SOCK}" ] || break
|
||||
[ -S "${SSH_AUTH_SOCK}" ] || break
|
||||
|
||||
echo "${SSH_AGENT_PID}" > "${pid_file}"
|
||||
export SSH_AGENT_PID SSH_AUTH_SOCK
|
||||
return 0
|
||||
done
|
||||
|
||||
unset SSH_AGENT_PID SSH_AUTH_SOCK
|
||||
return 1
|
||||
}
|
24
.config/zsh/rc/terminal.zsh
Normal file
24
.config/zsh/rc/terminal.zsh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-orig-term() {
|
||||
local -a a
|
||||
local i x
|
||||
|
||||
for i ( ${ZSHU_PARENTS_PID} ) ; do
|
||||
i="${ZSHU[procfs]}/$i/environ"
|
||||
[ -r "$i" ] || continue
|
||||
x=$(sed -zEn '/^TERM=(.+)$/{s//\1/;p;}' "$i" 2>/dev/null | tr -d '\0')
|
||||
[ -n "$x" ] || continue
|
||||
a+=( "$x" )
|
||||
done
|
||||
case "$1" in
|
||||
\* | @ )
|
||||
local ORIG_TERM=( $a )
|
||||
declare -p ORIG_TERM
|
||||
;;
|
||||
* )
|
||||
i='-1' ; x="${1:-$i}"
|
||||
echo "${a[$x]}"
|
||||
;;
|
||||
esac
|
||||
}
|
0
.config/zsh/var/.keep
Normal file
0
.config/zsh/var/.keep
Normal file
6
.gdbinit
Normal file
6
.gdbinit
Normal file
@@ -0,0 +1,6 @@
|
||||
undisplay
|
||||
display /i $pc
|
||||
set disassembly-flavor intel
|
||||
layout asm
|
||||
layout regs
|
||||
set debuginfod enabled on
|
55
.gitconfig
Normal file
55
.gitconfig
Normal file
@@ -0,0 +1,55 @@
|
||||
[advice]
|
||||
detachedHead = false
|
||||
resetNoRefresh = false
|
||||
skippedCherryPicks = false
|
||||
statusAheadBehind = false
|
||||
statusUoption = false
|
||||
suggestDetachingHead = false
|
||||
[commit]
|
||||
gpgSign = false
|
||||
[core]
|
||||
abbrev = 12
|
||||
bigFileThreshold = 16m
|
||||
compression = 7
|
||||
deltaBaseCacheLimit = 128m
|
||||
looseCompression = 2
|
||||
[credential]
|
||||
helper = cache --timeout=86400
|
||||
[fetch]
|
||||
writeCommitGraph = true
|
||||
[gc]
|
||||
aggressiveDepth = 100
|
||||
aggressiveWindow = 500
|
||||
auto = 0
|
||||
bigPackThreshold = 1g
|
||||
pruneExpire = now
|
||||
[grep]
|
||||
threads = 2
|
||||
[index]
|
||||
threads = 2
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[log]
|
||||
showSignature = false
|
||||
[maintainance]
|
||||
auto = false
|
||||
[pack]
|
||||
compression = 7
|
||||
deltaCacheLimit = 2048
|
||||
packSizeLimit = 1g
|
||||
threads = 4
|
||||
useSparse = true
|
||||
writeBitmapLookupTable = true
|
||||
writeReverseIndex = true
|
||||
[pull]
|
||||
ff = only
|
||||
[push]
|
||||
default = simple
|
||||
gpgSign = false
|
||||
[receive]
|
||||
autogc = false
|
||||
keepAlive = 25
|
||||
[reftable]
|
||||
blockSize = 65536
|
||||
[repack]
|
||||
writeBitmaps = true
|
21
.sbuildrc.dist
Normal file
21
.sbuildrc.dist
Normal file
@@ -0,0 +1,21 @@
|
||||
$chroot_mode = "schroot";
|
||||
$build_path = '';
|
||||
|
||||
$pgp_options = [ '-us', '-uc', '-ui' ];
|
||||
|
||||
$build_arch_all = 1;
|
||||
$build_arch_any = 1;
|
||||
$check_space = 0;
|
||||
$enable_network = 1;
|
||||
|
||||
$run_autopkgtest = 0;
|
||||
$run_lintian = 0;
|
||||
$run_piuparts = 0;
|
||||
|
||||
$apt_distupgrade = 0;
|
||||
$apt_upgrade = 0;
|
||||
|
||||
$purge_build_directory = 'successful';
|
||||
|
||||
# don't remove this, Perl needs it:
|
||||
1;
|
10
.screenrc
Normal file
10
.screenrc
Normal file
@@ -0,0 +1,10 @@
|
||||
startup_message off
|
||||
# term screen-256color-s
|
||||
bce off
|
||||
defutf8 on
|
||||
utf8 on on
|
||||
defscrollback 8192
|
||||
defflow off
|
||||
deflogin off
|
||||
# defshell -zsh
|
||||
hardstatus alwaysfirstline "%{= ky}%y.%m.%d%{= kK}|%{= kY}%c:%s%{= kK}|%{= kB}%H%{= kK}|%{= kG}%S%{= kK}|%{= kM}#%w%{-}%= %{= kK}|%{= kr}%l%{= kG}"
|
2
.selected_editor
Normal file
2
.selected_editor
Normal file
@@ -0,0 +1,2 @@
|
||||
# Generated by /usr/bin/select-editor
|
||||
SELECTED_EDITOR="/usr/bin/vim.basic"
|
5
.vimrc
Normal file
5
.vimrc
Normal file
@@ -0,0 +1,5 @@
|
||||
syntax on
|
||||
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
|
||||
set nolist
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
6
.zshenv
Normal file
6
.zshenv
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
if [[ -o interactive ]] ; then
|
||||
## early redirect
|
||||
: "${ZDOTDIR:=${HOME}}"
|
||||
source "${ZDOTDIR}/.config/zsh/_.zsh"
|
||||
fi
|
Reference in New Issue
Block a user