Compare commits
4 Commits
1d6da564f0
...
4c3c713c2d
Author | SHA1 | Date |
---|---|---|
Andrew Coleman | 4c3c713c2d | |
Andrew Coleman | cd44c17014 | |
Andrew Coleman | e7ee35ac24 | |
Andrew Coleman | d9bb16459f |
|
@ -0,0 +1,120 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "${DEBUG-}" ] && set -x
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
shellcheck "$0" || exit 1
|
||||
shfmt -i 2 -d -s "$0"
|
||||
|
||||
has_bin() {
|
||||
[ -e "$HOME/.nix-profile/bin/$1" ]
|
||||
}
|
||||
|
||||
if ! pgrep nix-daemon >/dev/null 2>&1; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||
# shellcheck disable=SC1091
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
# shellcheck disable=SC1091
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix.sh
|
||||
else
|
||||
echo "Attempting nix upgrade... may prompt for sudo password"
|
||||
sudo nix upgrade-nix
|
||||
fi
|
||||
|
||||
PATH="$PATH:$HOME/.nix-profile/bin"
|
||||
|
||||
has_bin "cachix" || nix profile install nixpkgs#cachix
|
||||
if ! has_bin "devenv"; then
|
||||
cachix use devenv
|
||||
nix profile install --accept-flake-config github:cachix/devenv/latest
|
||||
fi
|
||||
|
||||
if [ ! -d "$HOME/.cargo" ]; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain stable --profile complete -y
|
||||
fi
|
||||
|
||||
has_bin "atuin" || nix profile install nixpkgs#atuin
|
||||
has_bin "bash" || nix profile install nixpkgs#bashInteractive
|
||||
has_bin "bat" || nix profile install nixpkgs#bat
|
||||
has_bin "bw" || nix profile install nixpkgs#bitwarden-cli
|
||||
has_bin "broot" || nix profile install nixpkgs#broot
|
||||
has_bin "cargo-dist" || nix profile install nixpkgs#cargo-dist
|
||||
has_bin "cargo-flamegraph" || nix profile install nixpkgs#cargo-flamegraph
|
||||
has_bin "cargo-release" || nix profile install nixpkgs#cargo-release
|
||||
has_bin "cargo-udeps" || nix profile install nixpkgs#cargo-udeps
|
||||
has_bin "cheat" || nix profile install nixpkgs#cheat
|
||||
has_bin "chezmoi" || nix profile install nixpkgs#chezmoi
|
||||
has_bin "croc" || nix profile install nixpkgs#croc
|
||||
has_bin "curlie" || nix profile install nixpkgs#curlie
|
||||
has_bin "dbmate" || nix profile install nixpkgs#dbmate
|
||||
has_bin "delta" || nix profile install nixpkgs#delta
|
||||
[ -e "$HOME/.cargo/bin/ddbug" ] || cargo install --git https://github.com/gimli-rs/ddbug
|
||||
has_bin "difft" || nix profile install nixpkgs#difftastic
|
||||
has_bin "direnv" || nix profile install nixpkgs#direnv
|
||||
has_bin "dnsproxy" || nix profile install nixpkgs#dnsproxy
|
||||
has_bin "dust" || nix profile install nixpkgs#du-dust
|
||||
has_bin "eza" || nix profile install nixpkgs#eza
|
||||
has_bin "fd" || nix profile install nixpkgs#fd
|
||||
has_bin "flake-checker" || nix profile install github:DeterminateSystems/flake-checker
|
||||
has_bin "flamegraph" || nix profile install nixpkgs#flamegraph
|
||||
has_bin "fx" || nix profile install nixpkgs#fx
|
||||
has_bin "fzf" || nix profile install nixpkgs#fzf
|
||||
has_bin "git" || nix profile install nixpkgs#git
|
||||
has_bin "git-gone" || nix profile install nixpkgs#git-gone
|
||||
has_bin "goawk" || nix profile install nixpkgs#goawk
|
||||
has_bin "grep" || nix profile install nixpkgs#gnugrep
|
||||
has_bin "grex" || nix profile install nixpkgs#grex
|
||||
has_bin "gron" || nix profile install nixpkgs#gron
|
||||
has_bin "gum" || nix profile install nixpkgs#gum
|
||||
has_bin "helix" || nix profile install nixpkgs#helix
|
||||
has_bin "hexyl" || nix profile install nixpkgs#hexyl
|
||||
has_bin "htop" || nix profile install nixpkgs#htop
|
||||
has_bin "httpie" || nix profile install nixpkgs#httpie
|
||||
has_bin "htmlq" || nix profile install nixpkgs#htmlq
|
||||
has_bin "hyperfine" || nix profile install nixpkgs#hyperfine
|
||||
has_bin "jc" || nix profile install nixpkgs#jc
|
||||
has_bin "jiq" || nix profile install nixpkgs#jiq
|
||||
has_bin "jo" || nix profile install nixpkgs#jo
|
||||
has_bin "jq" || nix profile install nixpkgs#jq
|
||||
has_bin "jqp" || nix profile install nixpkgs#jqp
|
||||
has_bin "just" || nix profile install nixpkgs#just
|
||||
has_bin "kibi" || nix profile install nixpkgs#kibi
|
||||
has_bin "kondo" || nix profile install nixpkgs#kondo
|
||||
has_bin "kubie" || nix profile install nixpkgs#kubie
|
||||
has_bin "llama" || nix profile install nixpkgs#llama
|
||||
has_bin "mdbook" || nix profile install nixpkgs#mdbook
|
||||
has_bin "mosh" || nix profile install nixpkgs#mosh
|
||||
has_bin "nix-bisect" || nix profile install nixpkgs#nix-bisect
|
||||
# fails for some odd reason at the moment
|
||||
#has_bin "nix-doc" || nix profile install nixpkgs#nix-doc
|
||||
command -v "nix-doc" >/dev/null || cargo install nix-doc
|
||||
has_bin "nix-init" || nix profile install nixpkgs#nix-init
|
||||
has_bin "nix-search" || nix profile install github:peterldowns/nix-search-cli --refresh
|
||||
has_bin "nurl" || nix profile install nixpkgs#nurl
|
||||
has_bin "nvim" || nix profile install nixpkgs#neovim
|
||||
has_bin "ouch" || nix profile install nixpkgs#ouch
|
||||
has_bin "pstree" || nix profile install nixpkgs#pstree
|
||||
#nix profile install nixpkgs#prettylist
|
||||
has_bin "q" || nix profile install nixpkgs#q
|
||||
has_bin "rg" || nix profile install nixpkgs#ripgrep
|
||||
has_bin "rq" || nix profile install nixpkgs#rq
|
||||
has_bin "rustfilt" || nix profile install nixpkgs#rustfilt
|
||||
has_bin "sd" || nix profile install nixpkgs#sd
|
||||
has_bin "shellcheck" || nix profile install nixpkgs#shellcheck
|
||||
has_bin "shfmt" || nix profile install nixpkgs#shfmt
|
||||
has_bin "spacer" || nix profile install nixpkgs#spacer
|
||||
has_bin "starship" || nix profile install nixpkgs#starship
|
||||
has_bin "terminal-notifier" || nix profile install nixpkgs#terminal-notifier
|
||||
has_bin "tig" || nix profile install nixpkgs#tig
|
||||
has_bin "tldr" || nix profile install nixpkgs#tealdeer
|
||||
has_bin "tokei" || nix profile install nixpkgs#tokei
|
||||
has_bin "upterm" || nix profile install nixpkgs#upterm
|
||||
has_bin "vim" || nix profile install nixpkgs#vim
|
||||
has_bin "watchexec" || nix profile install nixpkgs#watchexec
|
||||
has_bin "xcp" || nix profile install nixpkgs#xcp
|
||||
has_bin "xh" || nix profile install nixpkgs#xh
|
||||
has_bin "xsv" || nix profile install nixpkgs#xsv
|
||||
has_bin "zenith" || nix profile install nixpkgs#zenith
|
||||
has_bin "zola" || nix profile install nixpkgs#zola
|
||||
has_bin "zoxide" || nix profile install nixpkgs#zoxide
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "${DEBUG-}" ] && set -x
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
shellcheck "$0" || exit 1
|
||||
shfmt -i 2 -d -s "$0"
|
||||
|
||||
newest_wezterm_release() {
|
||||
curl -s -H "Accept: application/vnd.github+json" -L https://api.github.com/repos/wez/wezterm/releases/latest | jq -r '.assets | map(select(.name | startswith("WezTerm-macos"))) | first.browser_download_url'
|
||||
}
|
||||
LATEST_WEZTERM=$(newest_wezterm_release)
|
||||
|
||||
install_latest_wezterm() {
|
||||
curl -Lo wezterm.zip "$LATEST_WEZTERM"
|
||||
ouch d wezterm.zip
|
||||
mv WezTerm-macos-*/WezTerm.app /Applications/ && rm -rf wezterm.zip WezTerm-macos-*
|
||||
}
|
||||
|
||||
if [ ! -e /Applications/WezTerm.app ]; then
|
||||
install_latest_wezterm
|
||||
else
|
||||
current_wezterm=$(/Applications/WezTerm.app/Contents/MacOS/wezterm -V | awk '{print $2}')
|
||||
if ! echo "$LATEST_WEZTERM" | grep "$current_wezterm" >/dev/null; then
|
||||
install_latest_wezterm
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -d /usr/local/bin ] || sudo mkdir /usr/local/bin
|
||||
|
||||
install_typst() {
|
||||
echo "manually installing typst"
|
||||
curl -sLO https://github.com/typst/typst/releases/download/22-03-21-2/typst-x86_64-apple-darwin.tar.gz
|
||||
ouch d typst*.tar.gz
|
||||
sudo install -m 755 typst*/typst /usr/local/bin/
|
||||
rm -rf ./typst*
|
||||
}
|
||||
|
||||
[ -e "/usr/local/bin/typst" ] || install_typst
|
|
@ -0,0 +1,21 @@
|
|||
_default:
|
||||
@just --list
|
||||
|
||||
# performs steps for mac
|
||||
mac:
|
||||
./install-cli-tools.sh
|
||||
./setup-shell-config.sh
|
||||
./install-mac-apps.sh
|
||||
|
||||
# performs steps for linux
|
||||
linux:
|
||||
./install-cli-tools.sh
|
||||
./setup-shell-config.sh
|
||||
|
||||
# checks all shell scripts for errors
|
||||
shellcheck:
|
||||
shellcheck *.sh
|
||||
|
||||
# formats all shell scripts consistently
|
||||
shfmt:
|
||||
shfmt -i 2 -w -s *.sh
|
328
setup-mac.sh
328
setup-mac.sh
|
@ -1,328 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "${DEBUG-}" ] && set -x
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
if ! pgrep nix-daemon >/dev/null 2>&1; then
|
||||
sh <"$(curl -L https://nixos.org/nix/install)"
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/.config"
|
||||
|
||||
mkdir -p "$HOME/.config/nix"
|
||||
if [ ! -f "$HOME/.config/nix/nix.conf" ]; then
|
||||
echo "experimental-features = nix-command flakes" >>"$HOME/.config/nix/nix.conf"
|
||||
echo "trusted-users = root andrew" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon
|
||||
cachix use devenv
|
||||
nix profile install --accept-flake-config github:cachix/devenv/latest
|
||||
fi
|
||||
|
||||
has_bin() {
|
||||
[ -e "$HOME/.nix-profile/bin/$1" ]
|
||||
}
|
||||
|
||||
has_bin "atuin" || nix profile install nixpkgs#atuin
|
||||
has_bin "bash" || nix profile install nixpkgs#bashInteractive
|
||||
has_bin "bat" || nix profile install nixpkgs#bat
|
||||
has_bin "bw" || nix profile install nixpkgs#bitwarden-cli
|
||||
has_bin "broot" || nix profile install nixpkgs#broot
|
||||
has_bin "cargo-dist" || nix profile install nixpkgs#cargo-dist
|
||||
has_bin "cargo-flamegraph" || nix profile install nixpkgs#cargo-flamegraph
|
||||
has_bin "cargo-release" || nix profile install nixpkgs#cargo-release
|
||||
has_bin "cargo-udeps" || nix profile install nixpkgs#cargo-udeps
|
||||
has_bin "cheat" || nix profile install nixpkgs#cheat
|
||||
has_bin "chezmoi" || nix profile install nixpkgs#chezmoi
|
||||
has_bin "croc" || nix profile install nixpkgs#croc
|
||||
has_bin "curlie" || nix profile install nixpkgs#curlie
|
||||
has_bin "delta" || nix profile install nixpkgs#delta
|
||||
has_bin "difft" || nix profile install nixpkgs#difftastic
|
||||
has_bin "direnv" || nix profile install nixpkgs#direnv
|
||||
has_bin "dnsproxy" || nix profile install nixpkgs#dnsproxy
|
||||
has_bin "dust" || nix profile install nixpkgs#du-dust
|
||||
has_bin "exa" || nix profile install nixpkgs#exa
|
||||
has_bin "fd" || nix profile install nixpkgs#fd
|
||||
has_bin "flake-checker" || nix profile install github:DeterminateSystems/flake-checker
|
||||
has_bin "flamegraph" || nix profile install nixpkgs#flamegraph
|
||||
has_bin "fx" || nix profile install nixpkgs#fx
|
||||
has_bin "fzf" || nix profile install nixpkgs#fzf
|
||||
has_bin "git" || nix profile install nixpkgs#git
|
||||
has_bin "git-gone" || nix profile install nixpkgs#git-gone
|
||||
has_bin "goawk" || nix profile install nixpkgs#goawk
|
||||
has_bin "grep" || nix profile install nixpkgs#gnugrep
|
||||
has_bin "grex" || nix profile install nixpkgs#grex
|
||||
has_bin "gron" || nix profile install nixpkgs#gron
|
||||
has_bin "gum" || nix profile install nixpkgs#gum
|
||||
has_bin "hexyl" || nix profile install nixpkgs#hexyl
|
||||
has_bin "htop" || nix profile install nixpkgs#htop
|
||||
has_bin "httpie" || nix profile install nixpkgs#httpie
|
||||
has_bin "htmlq" || nix profile install nixpkgs#htmlq
|
||||
has_bin "hyperfine" || nix profile install nixpkgs#hyperfine
|
||||
has_bin "jc" || nix profile install nixpkgs#jc
|
||||
has_bin "jiq" || nix profile install nixpkgs#jiq
|
||||
has_bin "jq" || nix profile install nixpkgs#jq
|
||||
has_bin "jqp" || nix profile install nixpkgs#jqp
|
||||
has_bin "just" || nix profile install nixpkgs#just
|
||||
has_bin "kibi" || nix profile install nixpkgs#kibi
|
||||
has_bin "kondo" || nix profile install nixpkgs#kondo
|
||||
has_bin "kubie" || nix profile install nixpkgs#kubie
|
||||
has_bin "llama" || nix profile install nixpkgs#llama
|
||||
has_bin "mdbook" || nix profile install nixpkgs#mdbook
|
||||
has_bin "mosh" || nix profile install nixpkgs#mosh
|
||||
has_bin "nix-bisect" || nix profile install nixpkgs#nix-bisect
|
||||
# fails for some odd reason at the moment
|
||||
#has_bin "nix-doc" || nix profile install nixpkgs#nix-doc
|
||||
command -v "nix-doc" >/dev/null || cargo install nix-doc
|
||||
has_bin "nix-init" || nix profile install nixpkgs#nix-init
|
||||
has_bin "nix-search" || nix profile install github:peterldowns/nix-search-cli --refresh
|
||||
has_bin "nurl" || nix profile install nixpkgs#nurl
|
||||
has_bin "nvim" || nix profile install nixpkgs#neovim
|
||||
has_bin "ouch" || nix profile install nixpkgs#ouch
|
||||
has_bin "pstree" || nix profile install nixpkgs#pstree
|
||||
#nix profile install nixpkgs#prettylist
|
||||
has_bin "q" || nix profile install nixpkgs#q
|
||||
has_bin "rg" || nix profile install nixpkgs#ripgrep
|
||||
has_bin "rq" || jnix profile install nixpkgs#rq
|
||||
has_bin "rustfilt" || nix profile install nixpkgs#rustfilt
|
||||
has_bin "sd" || nix profile install nixpkgs#sd
|
||||
has_bin "shellcheck" || nix profile install nixpkgs#shellcheck
|
||||
has_bin "shfmt" || nix profile install nixpkgs#shfmt
|
||||
has_bin "spacer" || nix profile install nixpkgs#spacer
|
||||
has_bin "starship" || nix profile install nixpkgs#starship
|
||||
has_bin "terminal-notifier" || nix profile install nixpkgs#terminal-notifier
|
||||
has_bin "tig" || nix profile install nixpkgs#tig
|
||||
has_bin "tldr" || nix profile install nixpkgs#tealdeer
|
||||
has_bin "tokei" || nix profile install nixpkgs#tokei
|
||||
has_bin "upterm" || nix profile install nixpkgs#upterm
|
||||
has_bin "vim" || nix profile install nixpkgs#vim
|
||||
has_bin "watchexec" || nix profile install nixpkgs#watchexec
|
||||
has_bin "xcp" || nix profile install nixpkgs#xcp
|
||||
has_bin "xh" || nix profile install nixpkgs#xh
|
||||
has_bin "xsv" || nix profile install nixpkgs#xsv
|
||||
has_bin "zenith" || nix profile install nixpkgs#zenith
|
||||
has_bin "zola" || nix profile install nixpkgs#zola
|
||||
has_bin "zoxide" || nix profile install nixpkgs#zoxide
|
||||
|
||||
PATH="$PATH:$HOME/.nix-profile/bin"
|
||||
|
||||
newest_wezterm_release() {
|
||||
curl -s -H "Accept: application/vnd.github+json" -L https://api.github.com/repos/wez/wezterm/releases/latest | jq -r '.assets | map(select(.name | startswith("WezTerm-macos"))) | first.browser_download_url'
|
||||
}
|
||||
LATEST_WEZTERM=$(newest_wezterm_release)
|
||||
|
||||
install_latest_wezterm() {
|
||||
curl -Lo wezterm.zip "$LATEST_WEZTERM"
|
||||
ouch d wezterm.zip
|
||||
mv WezTerm-macos-*/WezTerm.app /Applications/ && rm -rf wezterm.zip WezTerm-macos-*
|
||||
}
|
||||
|
||||
if [ ! -e /Applications/WezTerm.app ]; then
|
||||
install_latest_wezterm
|
||||
else
|
||||
current_wezterm=$(/Applications/WezTerm.app/Contents/MacOS/wezterm -V | awk '{print $2}')
|
||||
if ! echo "$LATEST_WEZTERM" | grep "$current_wezterm" >/dev/null; then
|
||||
install_latest_wezterm
|
||||
fi
|
||||
fi
|
||||
|
||||
cat <<EOF >"$HOME/.wezterm.lua"
|
||||
local wezterm = require 'wezterm'
|
||||
local config = {}
|
||||
|
||||
if wezterm.config_builder then
|
||||
config = wezterm.config_builder()
|
||||
end
|
||||
|
||||
config.font = wezterm.font_with_fallback({
|
||||
{ family = 'Operator Mono', weight = 'Book' },
|
||||
'Symbols Nerd Font'
|
||||
})
|
||||
config.font_size = 22.0
|
||||
config.color_scheme = 'One Light (base16)'
|
||||
config.window_background_opacity = 0.9
|
||||
config.initial_rows = 30
|
||||
config.initial_cols = 120
|
||||
config.use_fancy_tab_bar = false
|
||||
config.mouse_bindings = {
|
||||
{
|
||||
event = { Up = { streak = 1, button = 'Left' } },
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action.OpenLinkAtMouseCursor,
|
||||
},
|
||||
}
|
||||
config.keys = {
|
||||
-- Make Ctrl-b equivalent to Alt-b which many line editors interpret as backward-word
|
||||
{key="b", mods="CTRL", action=wezterm.action{SendString="\x1bb"}},
|
||||
-- Make Ctrl-f equivalent to Alt-f which many line editors interpret as forward-word
|
||||
{key="f", mods="CTRL", action=wezterm.action{SendString="\x1bf"}},
|
||||
}
|
||||
|
||||
return config
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.config/starship.toml"
|
||||
[container]
|
||||
disabled=true
|
||||
EOF
|
||||
|
||||
mkdir -p "$HOME/.config/helix/themes"
|
||||
cat <<EOF >"$HOME/.config/helix/config.toml"
|
||||
theme = "mylight"
|
||||
|
||||
[editor]
|
||||
true-color = true
|
||||
color-modes = true
|
||||
idle-timeout = 75
|
||||
mouse = false
|
||||
bufferline = "multiple"
|
||||
auto-pairs = false
|
||||
|
||||
[editor.indent-guides]
|
||||
render = true
|
||||
|
||||
[editor.cursor-shape]
|
||||
insert = "bar"
|
||||
normal = "block"
|
||||
select = "underline"
|
||||
|
||||
[editor.whitespace.render]
|
||||
space = "all"
|
||||
tab = "all"
|
||||
|
||||
[keys.normal]
|
||||
"$" = "goto_line_end"
|
||||
"^" = "goto_line_start"
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.config/helix/themes/mylight.toml"
|
||||
inherits = "onelight"
|
||||
|
||||
"comment" = { fg = "grey" }
|
||||
"comment.line" = { fg = "grey" }
|
||||
"comment.block" = { fg = "grey" }
|
||||
"comment.block.documentation" = { fg = "grey" }
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.gitconfig"
|
||||
[push]
|
||||
default = simple
|
||||
|
||||
[user]
|
||||
name = Andrew Coleman
|
||||
email = penguincoder@gmail.com
|
||||
|
||||
[advice]
|
||||
detachedHead = false
|
||||
|
||||
[core]
|
||||
filemode = true
|
||||
eol = lf
|
||||
autocrlf = input
|
||||
pager = delta
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[delta]
|
||||
line-numbers = true
|
||||
#line-numbers-zero-style = white
|
||||
line-numbers-minus-style = bold red
|
||||
line-numbers-plus-style = bold green
|
||||
file-style = omit
|
||||
hunk-header-style = file
|
||||
syntax-theme = OneHalfLight
|
||||
|
||||
[rebase]
|
||||
autoStash = true
|
||||
|
||||
[merge]
|
||||
tool = vimdiff
|
||||
conflictstyle = diff3
|
||||
prompt = false
|
||||
|
||||
[pull]
|
||||
rebase = true
|
||||
|
||||
[color]
|
||||
branch = auto
|
||||
diff = auto
|
||||
status = auto
|
||||
ui = true
|
||||
|
||||
[color "branch"]
|
||||
current = yellow reverse
|
||||
local = yellow
|
||||
remote = green
|
||||
|
||||
[color "diff"]
|
||||
meta = yellow bold
|
||||
frag = magenta bold
|
||||
old = red bold
|
||||
new = green bold
|
||||
|
||||
[color "status"]
|
||||
added = yellow
|
||||
changed = green
|
||||
untracked = red
|
||||
|
||||
[alias]
|
||||
logp = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
|
||||
lg = log --graph --date-order --first-parent \
|
||||
--pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
|
||||
lgb = log --graph --date-order --branches --first-parent \
|
||||
--pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
|
||||
lga = log --graph --date-order --all \
|
||||
--pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
|
||||
up = pull --rebase
|
||||
branches-last-updated = branch -rv --sort=committerdate --format='%(HEAD) %(color:green)%(committerdate:relative)%(color:reset)\t%(color:magenta)%(authorname)%(color:reset)\t%(color:yellow)%(refname:short)%(color:reset)'
|
||||
EOF
|
||||
|
||||
if [ ! -d "$HOME/.cargo" ]; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain stable --profile complete -y
|
||||
fi
|
||||
|
||||
cat <<EOF >"$HOME/.tmux.conf"
|
||||
set-option -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION"
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.vimrc"
|
||||
" gratis https://swordandsignals.com/2020/12/13/5-lines-in-vimrc.html
|
||||
set hlsearch " highlight all search results
|
||||
set ignorecase " do case insensitive search
|
||||
set incsearch " show incremental search results as you type
|
||||
set number " display line number
|
||||
set noswapfile " disable swap file
|
||||
" can also be summarized as
|
||||
set hls ic is nu noswf
|
||||
" from https://www.guckes.net/vim/setup.html
|
||||
set ai nocp ek hid ru sc vb wmnu noeb noet nosol
|
||||
set bs=2 fo=cqrt ls=2 shm=at ww=<,>,h,l
|
||||
set comments=b:#,:%,n:>
|
||||
set list listchars=tab:>=,trail:-
|
||||
set viminfo=%,'50,\"100,:100,n~/.viminfo
|
||||
EOF
|
||||
|
||||
install -m 640 ./.zshrc "$HOME/"
|
||||
|
||||
AUTO_FILE="$HOME/.zshrc.auto"
|
||||
{
|
||||
atuin init zsh --disable-up-arrow
|
||||
direnv hook zsh
|
||||
starship init zsh --print-full-init
|
||||
zoxide init zsh
|
||||
} >"$AUTO_FILE"
|
||||
|
||||
[ -d /usr/local/bin ] || sudo mkdir /usr/local/bin
|
||||
|
||||
install_typst() {
|
||||
echo "manually installing typst"
|
||||
curl -sLO https://github.com/typst/typst/releases/download/22-03-21-2/typst-x86_64-apple-darwin.tar.gz
|
||||
ouch d typst*.tar.gz
|
||||
sudo install -m 755 typst*/typst /usr/local/bin/
|
||||
rm -rf ./typst*
|
||||
}
|
||||
|
||||
[ -e "/usr/local/bin/typst" ] || install_typst
|
||||
|
||||
shellcheck "$0" || exit 1
|
||||
shfmt -i 2 -d -s "$0"
|
|
@ -0,0 +1,170 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "${DEBUG-}" ] && set -x
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
shellcheck "$0" || exit 1
|
||||
shfmt -i 2 -d -s "$0"
|
||||
|
||||
mkdir -p "$HOME/.config"
|
||||
|
||||
cat <<EOF >"$HOME/.wezterm.lua"
|
||||
local wezterm = require 'wezterm'
|
||||
local config = {}
|
||||
|
||||
if wezterm.config_builder then
|
||||
config = wezterm.config_builder()
|
||||
end
|
||||
|
||||
config.font = wezterm.font_with_fallback({
|
||||
{ family = 'Operator Mono', weight = 'Book' },
|
||||
'Symbols Nerd Font'
|
||||
})
|
||||
config.font_size = 22.0
|
||||
-- config.color_scheme = 'One Light (base16)'
|
||||
config.color_scheme = 'Material Darker (base16)'
|
||||
config.window_background_opacity = 0.9
|
||||
config.initial_rows = 30
|
||||
config.initial_cols = 120
|
||||
config.use_fancy_tab_bar = false
|
||||
config.mouse_bindings = {
|
||||
{
|
||||
event = { Up = { streak = 1, button = 'Left' } },
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action.OpenLinkAtMouseCursor,
|
||||
},
|
||||
}
|
||||
config.keys = {
|
||||
-- Make Ctrl-b equivalent to Alt-b which many line editors interpret as backward-word
|
||||
{key="b", mods="CTRL", action=wezterm.action{SendString="\x1bb"}},
|
||||
-- Make Ctrl-f equivalent to Alt-f which many line editors interpret as forward-word
|
||||
{key="f", mods="CTRL", action=wezterm.action{SendString="\x1bf"}},
|
||||
}
|
||||
|
||||
return config
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.config/starship.toml"
|
||||
[container]
|
||||
disabled=true
|
||||
EOF
|
||||
|
||||
mkdir -p "$HOME/.config/helix/themes"
|
||||
cat <<EOF >"$HOME/.config/helix/config.toml"
|
||||
theme = "Molokai"
|
||||
|
||||
[editor]
|
||||
true-color = true
|
||||
color-modes = true
|
||||
idle-timeout = 75
|
||||
mouse = false
|
||||
bufferline = "multiple"
|
||||
auto-pairs = false
|
||||
|
||||
[editor.indent-guides]
|
||||
render = true
|
||||
|
||||
[editor.cursor-shape]
|
||||
insert = "bar"
|
||||
normal = "block"
|
||||
select = "underline"
|
||||
|
||||
[editor.whitespace.render]
|
||||
tab = "all"
|
||||
|
||||
[editor.soft-wrap]
|
||||
enable = true
|
||||
EOF
|
||||
|
||||
curl -sLo "$HOME/.config/themes.gitconfig" "https://raw.githubusercontent.com/dandavison/delta/main/themes.gitconfig"
|
||||
cat <<EOF >"$HOME/.gitconfig"
|
||||
[include]
|
||||
path = "~/.config/themes.gitconfig"
|
||||
|
||||
[push]
|
||||
default = simple
|
||||
|
||||
[user]
|
||||
name = Andrew Coleman
|
||||
email = penguincoder@gmail.com
|
||||
|
||||
[advice]
|
||||
detachedHead = false
|
||||
|
||||
[core]
|
||||
filemode = true
|
||||
eol = lf
|
||||
autocrlf = input
|
||||
pager = delta
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[delta]
|
||||
line-numbers = true
|
||||
file-style = omit
|
||||
hunk-header-style = file
|
||||
features = calochortus-lyallii
|
||||
|
||||
[rebase]
|
||||
autoStash = true
|
||||
|
||||
[merge]
|
||||
tool = vimdiff
|
||||
conflictstyle = diff3
|
||||
prompt = false
|
||||
|
||||
[pull]
|
||||
rebase = true
|
||||
|
||||
[color]
|
||||
branch = auto
|
||||
diff = auto
|
||||
status = auto
|
||||
ui = true
|
||||
|
||||
[color "branch"]
|
||||
current = yellow reverse
|
||||
local = yellow
|
||||
remote = green
|
||||
|
||||
[color "status"]
|
||||
added = yellow
|
||||
changed = green
|
||||
untracked = red
|
||||
|
||||
[alias]
|
||||
logp = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
|
||||
lg = log --graph --date-order --first-parent \
|
||||
--pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
|
||||
lgb = log --graph --date-order --branches --first-parent \
|
||||
--pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
|
||||
lga = log --graph --date-order --all \
|
||||
--pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
|
||||
up = pull --rebase
|
||||
branches-last-updated = branch -rv --sort=committerdate --format='%(HEAD) %(color:green)%(committerdate:relative)%(color:reset)\t%(color:magenta)%(authorname)%(color:reset)\t%(color:yellow)%(refname:short)%(color:reset)'
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.tmux.conf"
|
||||
set-option -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION"
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$HOME/.vimrc"
|
||||
" gratis https://swordandsignals.com/2020/12/13/5-lines-in-vimrc.html
|
||||
set hlsearch " highlight all search results
|
||||
set ignorecase " do case insensitive search
|
||||
set incsearch " show incremental search results as you type
|
||||
set number " display line number
|
||||
set noswapfile " disable swap file
|
||||
" can also be summarized as
|
||||
set hls ic is nu noswf
|
||||
" from https://www.guckes.net/vim/setup.html
|
||||
set ai nocp ek hid ru sc vb wmnu noeb noet nosol
|
||||
set bs=2 fo=cqrt ls=2 shm=at ww=<,>,h,l
|
||||
set comments=b:#,:%,n:>
|
||||
set list listchars=tab:>=,trail:-
|
||||
set viminfo=%,'50,\"100,:100,n~/.viminfo
|
||||
EOF
|
||||
|
||||
install -m 640 ./.zshrc "$HOME/"
|
|
@ -0,0 +1,150 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Example Bash Shell Script
|
||||
# from https://betterdev.blog/minimal-safe-bash-script-template/
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
|
||||
|
||||
# declare globals as readonly
|
||||
readonly SCRIPT_NAME
|
||||
SCRIPT_NAME="$(basename "$0")"
|
||||
|
||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [-h] [-v] [-f] -p param_value arg1 [arg2...]
|
||||
|
||||
Script description here.
|
||||
|
||||
Available options:
|
||||
|
||||
-h, --help Print this help and exit
|
||||
-v, --verbose Print script debug info
|
||||
-f, --flag Some flag description
|
||||
-p, --param Some param description
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
trap - SIGINT SIGTERM ERR EXIT
|
||||
# script cleanup here
|
||||
}
|
||||
|
||||
setup_colors() {
|
||||
if [[ -t 2 ]] && [[ -z ${NO_COLOR-} ]] && [[ ${TERM-} != "dumb" ]]; then
|
||||
NOCOLOR='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
|
||||
else
|
||||
# shellcheck disable=SC2034
|
||||
NOCOLOR='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
|
||||
fi
|
||||
}
|
||||
|
||||
# you only need one of the following two functions
|
||||
# simple function to redirect output to stderr (good)
|
||||
msg() {
|
||||
echo >&2 -e "${1-}"
|
||||
}
|
||||
|
||||
# more structured logging (better)
|
||||
log() {
|
||||
local -r level="$1"
|
||||
local -r message="$2"
|
||||
local -r timestamp=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
# colorize your log output here, if desired
|
||||
echo >&2 -e "${timestamp} [${level}] [$SCRIPT_NAME] ${message}"
|
||||
}
|
||||
|
||||
die() {
|
||||
local msg=$1
|
||||
local code=${2-1} # default exit status 1
|
||||
log "FATAL" "$msg"
|
||||
exit "$code"
|
||||
}
|
||||
|
||||
assert_not_empty() {
|
||||
local -r arg_name="$1"
|
||||
local -r arg_value="$2"
|
||||
|
||||
if [[ -z $arg_value ]]; then
|
||||
log "ERROR" "The value for '$arg_name' cannot be empty"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
assert_is_installed() {
|
||||
local -r name="$1"
|
||||
|
||||
if [[ ! $(command -v "$name") ]]; then
|
||||
log "ERROR" "The binary '$name' is required by this script but is not installed or in the system's PATH."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
parse_params() {
|
||||
while :; do
|
||||
case "${1-}" in
|
||||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
-v | --verbose)
|
||||
set -x
|
||||
;;
|
||||
--no-color)
|
||||
NO_COLOR=1
|
||||
;;
|
||||
-f | --flag) # example flag
|
||||
# FLAG=1
|
||||
;;
|
||||
-p | --param) # example named parameter
|
||||
assert_not_empty "--param", "${2-}"
|
||||
PARAM="${2-}"
|
||||
shift
|
||||
;;
|
||||
-?*)
|
||||
die "Unknown option: $1"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# check required params and arguments
|
||||
assert_is_installed "bash"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# default values of variables set from parse_params
|
||||
# to avoid having these variables here, you will need to define the work of
|
||||
# the script as another function that takes arguments and call it with local
|
||||
# variables declared in parse_params:
|
||||
#
|
||||
# run() {
|
||||
# local -r flag=$1
|
||||
# }
|
||||
#
|
||||
# parse_params() {
|
||||
# local flag=0
|
||||
# ...
|
||||
# run $flag
|
||||
# }
|
||||
FLAG=0
|
||||
PARAM=''
|
||||
readonly ARGS=("$@")
|
||||
|
||||
parse_params "$@"
|
||||
setup_colors
|
||||
|
||||
# script logic here
|
||||
|
||||
log "INFO" "${RED}Read parameters:${NOCOLOR}"
|
||||
log "INFO" "- flag: ${FLAG}"
|
||||
log "INFO" "- param: ${PARAM}"
|
||||
log "INFO" "- arguments: ${ARGS[*]-}"
|
Loading…
Reference in New Issue