Move to Chezmoi
This commit is contained in:
parent
f216c4ff2c
commit
e3498e73b5
59 changed files with 499 additions and 2240 deletions
35
chezmoi/dot_zshrc.d/executable_aliases.zsh
Normal file
35
chezmoi/dot_zshrc.d/executable_aliases.zsh
Normal file
|
@ -0,0 +1,35 @@
|
|||
if [ "$EDITOR" = 'nvim' ]; then
|
||||
alias vi='nvim'
|
||||
alias vim='nvim'
|
||||
alias vimdiff="nvim -d"
|
||||
alias view="nvim -R"
|
||||
fi
|
||||
|
||||
# use reflink cp if supported (yay CoW)
|
||||
if 2>&1 cp --help | grep -qF -- --reflink; then
|
||||
alias cp='cp -i --reflink=auto'
|
||||
else
|
||||
alias cp='cp -i'
|
||||
fi
|
||||
|
||||
alias mv='mv -i'
|
||||
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
alias dco='docker-compose'
|
||||
fi
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
if command -v gtar &> /dev/null; then
|
||||
alias tar='gtar'
|
||||
fi
|
||||
|
||||
if command -v gsed &> /dev/null; then
|
||||
alias sed='gsed'
|
||||
fi
|
||||
;;
|
||||
|
||||
linux*)
|
||||
alias open='xdg-open'
|
||||
;;
|
||||
esac
|
5
chezmoi/dot_zshrc.d/executable_asdf.zsh
Normal file
5
chezmoi/dot_zshrc.d/executable_asdf.zsh
Normal file
|
@ -0,0 +1,5 @@
|
|||
if [ -r ~/.asdf/asdf.sh ]; then
|
||||
. ~/.asdf/asdf.sh
|
||||
# append completions to fpath
|
||||
fpath=(${ASDF_DIR}/completions $fpath)
|
||||
fi
|
3
chezmoi/dot_zshrc.d/executable_autojump.zsh
Normal file
3
chezmoi/dot_zshrc.d/executable_autojump.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
if [ -r /usr/share/autojump/autojump.sh ]; then
|
||||
source /usr/share/autojump/autojump.sh
|
||||
fi
|
3
chezmoi/dot_zshrc.d/executable_aws.zsh
Normal file
3
chezmoi/dot_zshrc.d/executable_aws.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
if command -v aws_completer &> /dev/null; then
|
||||
complete -C "$(command -v aws_completer)" aws
|
||||
fi
|
17
chezmoi/dot_zshrc.d/executable_camera.zsh
Normal file
17
chezmoi/dot_zshrc.d/executable_camera.zsh
Normal file
|
@ -0,0 +1,17 @@
|
|||
if command -v mpv &> /dev/null && command -v fzf &> /dev/null; then
|
||||
if [[ "$OSTYPE" = linux* ]]; then
|
||||
function camera() {
|
||||
(
|
||||
set -euo pipefail
|
||||
|
||||
printf "%s\0" /dev/video* |
|
||||
fzf --print0 --read0 -m -1 --height="$((LINES/4))" |
|
||||
xargs -0 -P 0 -I {} mpv \
|
||||
-vf=hflip \
|
||||
--demuxer-lavf-format=video4linux2 \
|
||||
--demuxer-lavf-o-set=input_format=mjpeg \
|
||||
av://v4l2:{}
|
||||
)
|
||||
}
|
||||
fi
|
||||
fi
|
18
chezmoi/dot_zshrc.d/executable_chezmoi.zsh
Normal file
18
chezmoi/dot_zshrc.d/executable_chezmoi.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
(
|
||||
set -euo pipefail
|
||||
|
||||
CHEZMOI_PATH="$(command -v chezmoi 2> /dev/null)"
|
||||
|
||||
COMPLETION_FILE="${ZSH_COMPLETIONS_DIR}/_chezmoi"
|
||||
if [ -r "$COMPLETION_FILE" ]; then
|
||||
COMPLETION_FILE_CTIME="$(stat -c %Z "$COMPLETION_FILE")"
|
||||
CHEZMOI_FILE_CTIME="$(stat -c %Z "${CHEZMOI_PATH}")"
|
||||
|
||||
if [ "$COMPLETION_FILE_CTIME" -ge "$CHEZMOI_FILE_CTIME" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
chezmoi completion zsh > "$COMPLETION_FILE"
|
||||
chmod +x "$COMPLETION_FILE"
|
||||
)
|
129
chezmoi/dot_zshrc.d/executable_clipboard.zsh
Normal file
129
chezmoi/dot_zshrc.d/executable_clipboard.zsh
Normal file
|
@ -0,0 +1,129 @@
|
|||
# MIT License
|
||||
|
||||
# Copyright (c) 2009-2022 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# System clipboard integration
|
||||
#
|
||||
# This file has support for doing system clipboard copy and paste operations
|
||||
# from the command line in a generic cross-platform fashion.
|
||||
#
|
||||
# This is uses essentially the same heuristic as neovim, with the additional
|
||||
# special support for Cygwin.
|
||||
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
|
||||
#
|
||||
# - pbcopy, pbpaste (macOS)
|
||||
# - cygwin (Windows running Cygwin)
|
||||
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
|
||||
# - xclip (if $DISPLAY is set)
|
||||
# - xsel (if $DISPLAY is set)
|
||||
# - lemonade (for SSH) https://github.com/pocke/lemonade
|
||||
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
|
||||
# - win32yank (Windows)
|
||||
# - tmux (if $TMUX is set)
|
||||
#
|
||||
# Defines two functions, clipcopy and clippaste, based on the detected platform.
|
||||
##
|
||||
#
|
||||
# clipcopy - Copy data to clipboard
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# <command> | clipcopy - copies stdin to clipboard
|
||||
#
|
||||
# clipcopy <file> - copies a file's contents to clipboard
|
||||
#
|
||||
##
|
||||
#
|
||||
# clippaste - "Paste" data from clipboard to stdout
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# clippaste - writes clipboard's contents to stdout
|
||||
#
|
||||
# clippaste | <command> - pastes contents and pipes it to another process
|
||||
#
|
||||
# clippaste > <file> - paste contents to a file
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# # Pipe to another process
|
||||
# clippaste | grep foo
|
||||
#
|
||||
# # Paste to a file
|
||||
# clippaste > file.txt
|
||||
#
|
||||
function detect-clipboard() {
|
||||
emulate -L zsh
|
||||
|
||||
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { pbpaste; }
|
||||
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||
function clippaste() { cat /dev/clipboard; }
|
||||
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||
function clipcopy() { wl-copy < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { wl-paste; }
|
||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
|
||||
function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { xclip -out -selection clipboard; }
|
||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
||||
function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { xsel --clipboard --output; }
|
||||
elif (( ${+commands[lemonade]} )); then
|
||||
function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { lemonade paste; }
|
||||
elif (( ${+commands[doitclient]} )); then
|
||||
function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { doitclient wclip -r; }
|
||||
elif (( ${+commands[win32yank]} )); then
|
||||
function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { win32yank -o; }
|
||||
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
|
||||
function clipcopy() { termux-clipboard-set < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { termux-clipboard-get; }
|
||||
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
|
||||
function clipcopy() { tmux load-buffer "${1:--}"; }
|
||||
function clippaste() { tmux save-buffer -; }
|
||||
elif [[ $(uname -r) = *icrosoft* ]]; then
|
||||
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
||||
else
|
||||
function _retry_clipboard_detection_or_fail() {
|
||||
local clipcmd="${1}"; shift
|
||||
if detect-clipboard; then
|
||||
"${clipcmd}" "$@"
|
||||
else
|
||||
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
|
||||
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
|
||||
# which is not really an error. If the user calls them, they will attempt to redetect
|
||||
# (for example, perhaps the user has now installed xclip) and then either print an error
|
||||
# or proceed successfully.
|
||||
detect-clipboard || true
|
16
chezmoi/dot_zshrc.d/executable_colors.zsh
Normal file
16
chezmoi/dot_zshrc.d/executable_colors.zsh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/zsh
|
||||
|
||||
if command -v dircolors &> /dev/null; then
|
||||
if test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)"; then
|
||||
:
|
||||
else
|
||||
eval "$(dircolors -b)"
|
||||
fi
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias dir='dir --color=auto'
|
||||
alias vdir='vdir --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
37
chezmoi/dot_zshrc.d/executable_fup.sh
Normal file
37
chezmoi/dot_zshrc.d/executable_fup.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
# fup uploads a given file to file.io
|
||||
fup() {
|
||||
local -r FILE_PATH="${1}"
|
||||
local -r EXPIRATION="${2}"
|
||||
if ! [ -f "${FILE_PATH}" ]; then
|
||||
echo 'provide a valid file path'
|
||||
return 1
|
||||
fi
|
||||
|
||||
local URL='https://file.io/'
|
||||
|
||||
if [ -n "${EXPIRATION}" ]; then
|
||||
URL="${URL}?expires=${EXPIRATION}"
|
||||
fi
|
||||
|
||||
local JSON_RETURN
|
||||
if ! JSON_RETURN="$(curl -SsfLF "file=@${FILE_PATH}" "${URL}")"; then
|
||||
echo 'Curl failed'
|
||||
return 1
|
||||
fi
|
||||
|
||||
if echo "${JSON_RETURN}" | grep -q '"success":false'; then
|
||||
echo "${JSON_RETURN}"
|
||||
return 2
|
||||
fi
|
||||
|
||||
echo "https://file.io/$(echo "${JSON_RETURN}" | sed 's/.*key":"//' | sed 's/".*//')"
|
||||
|
||||
if echo "${JSON_RETURN}" | grep -q '"expiry":'; then
|
||||
echo "Expires in $(echo "${JSON_RETURN}" | sed 's/.*expiry":"//' | sed 's/".*//')"
|
||||
else
|
||||
echo 'Expires in 14 days'
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
3
chezmoi/dot_zshrc.d/executable_fzf.zsh
Normal file
3
chezmoi/dot_zshrc.d/executable_fzf.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
2>/dev/null for FZF_FILE in /usr/share/doc/fzf/examples/*.zsh; do
|
||||
source "$FZF_FILE"
|
||||
done
|
17
chezmoi/dot_zshrc.d/executable_git.zsh
Normal file
17
chezmoi/dot_zshrc.d/executable_git.zsh
Normal file
|
@ -0,0 +1,17 @@
|
|||
alias g='git'
|
||||
alias ga='git add'
|
||||
alias gb='git branch'
|
||||
alias gc='git commit -v'
|
||||
alias gcl='git clone --recurse-submodules'
|
||||
alias gco='git checkout'
|
||||
alias gcor='git checkout --recurse-submodules'
|
||||
alias gcp='git cherry-pick'
|
||||
alias gd='git diff'
|
||||
alias gf='git fetch'
|
||||
alias gfo='git fetch origin'
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
alias gl='git pull'
|
||||
alias gm='git merge'
|
||||
alias gp='git push'
|
||||
alias gst='git status'
|
||||
alias gsu='git submodule update'
|
11
chezmoi/dot_zshrc.d/executable_golang-helpers.zsh
Normal file
11
chezmoi/dot_zshrc.d/executable_golang-helpers.zsh
Normal file
|
@ -0,0 +1,11 @@
|
|||
if command -v go &> /dev/null; then
|
||||
go_coverage() {
|
||||
(
|
||||
set -eo pipefail
|
||||
local -r COVERAGE_OUT="$(mktemp)"
|
||||
go test -cover -coverprofile="${COVERAGE_OUT}" ./...
|
||||
go tool cover -func="${COVERAGE_OUT}"
|
||||
rm -f "${COVERAGE_OUT}"
|
||||
)
|
||||
}
|
||||
fi
|
22
chezmoi/dot_zshrc.d/executable_ip-int-convert.sh
Normal file
22
chezmoi/dot_zshrc.d/executable_ip-int-convert.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# convert integer to IP
|
||||
int2ip () {
|
||||
local ip dec=("$@")
|
||||
for e in {3..0}
|
||||
do
|
||||
((octet = dec / (256 ** e) ))
|
||||
((dec -= octet * 256 ** e))
|
||||
ip+=$delim$octet
|
||||
delim=.
|
||||
done
|
||||
printf '%s\n' "$ip"
|
||||
unset delim
|
||||
}
|
||||
|
||||
# convert IP to integer
|
||||
ip2int () {
|
||||
local a b c d ip
|
||||
ip=("$@")
|
||||
IFS=. read -r a b c d <<< "${ip[*]}"
|
||||
printf '%d\n' "$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d))"
|
||||
}
|
93
chezmoi/dot_zshrc.d/executable_notes.sh
Normal file
93
chezmoi/dot_zshrc.d/executable_notes.sh
Normal file
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
|
||||
notes() {
|
||||
local NOTES_DIR="${NOTES_DIR:-${HOME}/notes}"
|
||||
local -r EDITOR="${EDITOR:-vim}"
|
||||
local EDITOR_OPTIONS=()
|
||||
|
||||
if [[ "${EDITOR}" =~ 'vim$' ]]; then
|
||||
EDITOR_OPTIONS=(
|
||||
'-c'
|
||||
'set spell'
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
for ARG in "$@"; do
|
||||
(
|
||||
set -euo pipefail
|
||||
mkdir -p "$NOTES_DIR"
|
||||
cd "$NOTES_DIR"
|
||||
|
||||
case "${ARG}" in
|
||||
'category')
|
||||
shift
|
||||
export NOTES_DIR="$NOTES_DIR/$1"
|
||||
shift
|
||||
|
||||
notes "$@"
|
||||
exit 255
|
||||
;;
|
||||
|
||||
'fzf')
|
||||
"${EDITOR}" "${EDITOR_OPTIONS[@]}" "$(notes ls | fzf)"
|
||||
;;
|
||||
|
||||
'ls')
|
||||
ag -g '' -l "${NOTES_DIR}" | sort -hr
|
||||
;;
|
||||
|
||||
'status')
|
||||
git status
|
||||
;;
|
||||
|
||||
'commit')
|
||||
git add .
|
||||
git commit -m "notes commit $(date)"
|
||||
;;
|
||||
|
||||
'push')
|
||||
git push
|
||||
;;
|
||||
|
||||
'pull')
|
||||
git pull
|
||||
;;
|
||||
|
||||
*)
|
||||
>&2 echo "invalid argument ${ARG}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
)
|
||||
|
||||
local EXIT_CODE=$?
|
||||
if [ $EXIT_CODE != 0 ]; then
|
||||
if [ $EXIT_CODE = 255 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return $EXIT_CODE
|
||||
fi
|
||||
done
|
||||
|
||||
# return if the above loop didn't return a bad code
|
||||
if [ -n "$*" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
(
|
||||
set -euo pipefail
|
||||
|
||||
readonly NOW="$(date +%s)"
|
||||
|
||||
readonly FILE_PATH="${NOTES_DIR}/$(date -d "@${NOW}" +'%Y/%m/%Y-%m-%d').md"
|
||||
|
||||
mkdir -p "$(dirname "${FILE_PATH}")"
|
||||
if ! [ -e "${FILE_PATH}" ]; then
|
||||
echo -e "# $(date -d "@${NOW}" +'%a %d %b %Y')\n\n## todo\n\n" > "${FILE_PATH}"
|
||||
fi
|
||||
|
||||
"${EDITOR}" "${EDITOR_OPTIONS[@]}" "${FILE_PATH}"
|
||||
)
|
||||
}
|
13
chezmoi/dot_zshrc.d/executable_pdf_join.zsh
Normal file
13
chezmoi/dot_zshrc.d/executable_pdf_join.zsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
pdf_join() {
|
||||
(
|
||||
set -euo pipefail
|
||||
|
||||
read -r "output_file?Name of output file: "
|
||||
"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" \
|
||||
-o "$output_file" "$@"
|
||||
|
||||
open "$output_file"
|
||||
)
|
||||
}
|
||||
fi
|
43
chezmoi/dot_zshrc.d/executable_ssh.zsh
Normal file
43
chezmoi/dot_zshrc.d/executable_ssh.zsh
Normal file
|
@ -0,0 +1,43 @@
|
|||
SSH_ENV_CACHE="$HOME/.ssh/environment-$SHORT_HOST"
|
||||
|
||||
function _start_agent() {
|
||||
if _check_ssh_agent_connectivity; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -r "$SSH_ENV_CACHE" ]]; then
|
||||
. $SSH_ENV_CACHE &> /dev/null
|
||||
if _check_ssh_agent_connectivity; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n >! "$SSH_ENV_CACHE"
|
||||
chmod 600 "$SSH_ENV_CACHE"
|
||||
ssh-agent -s > "$SSH_ENV_CACHE"
|
||||
. "$SSH_ENV_CACHE" > /dev/null
|
||||
}
|
||||
|
||||
function _check_ssh_agent_connectivity() {
|
||||
ssh-add -l &> /dev/null
|
||||
if [[ $? -eq 2 ]]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function add_ssh_keys() {
|
||||
declare -a NEW_IDENTITIES
|
||||
|
||||
SSH_AGENT_IDENTITIES="$(ssh-add -l || true)"
|
||||
2>/dev/null for IDENTITY_FILE in ~/.ssh/id_*~*.pub; do
|
||||
if [[ "$SSH_AGENT_IDENTITIES" != *"$(ssh-keygen -lf "$IDENTITY_FILE")"* ]]; then
|
||||
NEW_IDENTITIES+=("$IDENTITY_FILE")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#NEW_IDENTITIES} -gt 0 ]]; then
|
||||
ssh-add ${^NEW_IDENTITIES}
|
||||
fi
|
||||
}
|
||||
|
||||
_start_agent && add_ssh_keys
|
21
chezmoi/dot_zshrc.d/executable_sshtmux.sh
Normal file
21
chezmoi/dot_zshrc.d/executable_sshtmux.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
# create splits in a tmux session for each ssh host
|
||||
sshtmux() {
|
||||
if [ -z "${TMUX}" ]; then
|
||||
echo "This must be executed inside of a tmux session"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${1}" ]; then
|
||||
echo "Please provide of list of hosts separated by spaces"
|
||||
return 1
|
||||
fi
|
||||
|
||||
tmux new-window "ssh"
|
||||
for i in "${@}"; do
|
||||
tmux split-window -h "ssh -o StrictHostKeyChecking=no $i"
|
||||
tmux select-layout tiled > /dev/null
|
||||
sleep .1s
|
||||
done
|
||||
|
||||
tmux select-pane -t 0
|
||||
}
|
5
chezmoi/dot_zshrc.d/executable_tag.zsh
Normal file
5
chezmoi/dot_zshrc.d/executable_tag.zsh
Normal file
|
@ -0,0 +1,5 @@
|
|||
if command -v tag &> /dev/null; then
|
||||
export TAG_SEARCH_PROG=ag # replace with rg for ripgrep
|
||||
tag() { command tag "$@"; source ${TAG_ALIAS_FILE:-/tmp/tag_aliases} 2>/dev/null }
|
||||
alias ag=tag # replace with rg for ripgrep
|
||||
fi
|
67
chezmoi/dot_zshrc.d/executable_upgrade_system.sh
Normal file
67
chezmoi/dot_zshrc.d/executable_upgrade_system.sh
Normal file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
|
||||
upgrade_system() {
|
||||
(
|
||||
set -euo pipefail
|
||||
|
||||
case "$(uname | tr '[:upper:]' '[:lower:]')" in
|
||||
'darwin')
|
||||
if command -v brew &> /dev/null; then
|
||||
brew update
|
||||
brew upgrade
|
||||
fi
|
||||
;;
|
||||
|
||||
'linux')
|
||||
# Flatpak (could be just about any distro)
|
||||
if command -v flatpak &> /dev/null; then
|
||||
flatpak update
|
||||
fi
|
||||
|
||||
# Debian/Ubuntu
|
||||
if command -v apt &> /dev/null; then
|
||||
sudo sh -c 'apt update && apt upgrade'
|
||||
fi
|
||||
|
||||
# Fedora
|
||||
if command -v dnf &> /dev/null; then
|
||||
sudo dnf upgrade
|
||||
fi
|
||||
|
||||
# Arch
|
||||
if command -v yay &> /dev/null; then
|
||||
yay -Syu --devel --timeupdate
|
||||
elif command -v pacman &> /dev/null; then
|
||||
sudo pacman -Syu
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if command -v nvim &> /dev/null; then
|
||||
nvim -c 'PaqSync' -c 'sleep 5' -c 'TSUpdateSync' -c 'sleep 5' -c 'qa'
|
||||
fi
|
||||
|
||||
(
|
||||
for DIR in "$ZSH"/custom/{themes,plugins}/*/; do
|
||||
(
|
||||
cd "${DIR}"
|
||||
[ -d .git ] || exit 0
|
||||
git pull
|
||||
)
|
||||
done
|
||||
)
|
||||
|
||||
(
|
||||
cd "${HOME}/.tmux"
|
||||
git pull
|
||||
if [ -n "${TMUX:-}" ]; then
|
||||
tmux source-file "${HOME}/.tmux.conf"
|
||||
fi
|
||||
)
|
||||
|
||||
if command -v fwupdmgr &> /dev/null; then
|
||||
fwupdmgr refresh
|
||||
fwupdmgr upgrade
|
||||
fi
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue