Add zsh completions

This commit is contained in:
Evie Litherland-Smith 2023-01-13 10:25:07 +00:00
parent b096badab3
commit f706d3ce2c
2 changed files with 23 additions and 12 deletions

3
completions.zsh Normal file
View file

@ -0,0 +1,3 @@
autoload -U bashcompinit
bashcompinit
eval "$(register-python-argcomplete pipx)"

View file

@ -13,9 +13,9 @@ create_symlink () {
} }
git_clone_if_missing () { git_clone_if_missing () {
if [ ! -d $2 ] if [ ! -d "$2" ]
then then
git clone --depth 1 $1 $2 git clone --depth 1 "$1" "$2"
else else
echo "$1 already checked out -> $2" echo "$1 already checked out -> $2"
fi fi
@ -27,21 +27,20 @@ CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
mkdir -p "$CONFIG_DIR" mkdir -p "$CONFIG_DIR"
for FILE in config/* for FILE in config/*
do do
create_symlink $CONFIG_DIR $FILE create_symlink "$CONFIG_DIR" "$FILE"
done done
mkdir -p "$CONFIG_DIR/systemd/user" mkdir -p "$CONFIG_DIR/systemd/user"
for FILE in systemd/* for FILE in systemd/*
do do
create_symlink $CONFIG_DIR/systemd/user $FILE create_symlink "$CONFIG_DIR/systemd/user" "$FILE"
done done
# SSH agent # SSH agent
ssh_agent_export="export SSH_AUTH_SOCK=\"\$XDG_RUNTIME_DIR/ssh-agent.socket\"" ssh_agent_export="export SSH_AUTH_SOCK=\"\$XDG_RUNTIME_DIR/ssh-agent.socket\""
if [ -e "$HOME/.profile" ] grep "$ssh_agent_export" "$HOME/.profile" > /dev/null || echo "$ssh_agent_export" >> "$HOME/.profile"
then grep "$ssh_agent_export" "$HOME/.zprofile" > /dev/null || echo "$ssh_agent_export" >> "$HOME/.zprofile"
grep "$ssh_agent_export" "$HOME/.profile" > /dev/null || echo "$ssh_agent_export" >> "$HOME/.profile" grep "$ssh_agent_export" "$HOME/.bash_profile" > /dev/null || echo "$ssh_agent_export" >> "$HOME/.bash_profile"
fi
systemctl --user enable ssh-agent.service systemctl --user enable ssh-agent.service
@ -54,20 +53,29 @@ sudo pacman --needed -S $(awk '{print $1}' pacman.txt) || echo "Issue installin
# nvim setup - install Packer # nvim setup - install Packer
PACKER_REPO="https://github.com/wbthomason/packer.nvim" PACKER_REPO="https://github.com/wbthomason/packer.nvim"
PACKER_DIR="$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" PACKER_DIR="$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
git_clone_if_missing $PACKER_REPO $PACKER_DIR git_clone_if_missing "$PACKER_REPO" "$PACKER_DIR"
# oh-my-zsh # oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
OHMYZSH_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}" OHMYZSH_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
if [ -d $OHMYZSH_DIR ] if [ -d "$OHMYZSH_DIR" ]
then then
# Powerlevel10k theme # Powerlevel10k theme
POWERLEVEL_REPO="https://github.com/romkatv/powerlevel10k.git" POWERLEVEL_REPO="https://github.com/romkatv/powerlevel10k.git"
POWERLEVEL_DIR="$OHMYZSH_DIR/themes/powerlevel10k" POWERLEVEL_DIR="$OHMYZSH_DIR/themes/powerlevel10k"
git_clone_if_missing $POWERLEVEL_REPO $POWERLEVEL_DIR git_clone_if_missing "$POWERLEVEL_REPO" "$POWERLEVEL_DIR"
# aliases # aliases
create_symlink $OHMYZSH_DIR "./aliases.zsh" create_symlink "$OHMYZSH_DIR" "./aliases.zsh"
create_symlink "$OHMYZSH_DIR" "./completions.zsh"
fi fi
# Set up git editor if missing # Set up git editor if missing
grep "editor" "$HOME/.gitconfig" > /dev/null || git config --global core.editor "nvim" grep "editor" "$HOME/.gitconfig" > /dev/null || git config --global core.editor "nvim"
# Add NerdFont symbols
# TODO currently an issue with the spaces in the file names
# mkdir -p "$HOME/.local/share/fonts"
# for FILE in nerdfont_symbols/*
# do
# create_symlink "$HOME/.local/share/fonts" "$FILE"
# done