Zsh setup script and organization

This commit is contained in:
2021-12-31 19:26:07 -05:00
parent 4b4fd93cc7
commit df56ba2e4d
6 changed files with 23 additions and 7 deletions

View File

@@ -11,9 +11,6 @@
_source_if() { test -r "$1" && source "$1" || return 0 }
# Load Useful Functions
_source_if "$ZDOTDIR/zsh-functions"
#------------------------------ exports ------------------------------
export ZDOTDIR="$HOME/.config/zsh"
export SHELL="$(which zsh)"
@@ -129,6 +126,10 @@ setopt aliases
# Enable vi mode
bindkey -v
# Load Useful Functions
_source_if "${ZDOTDIR}/zsh-functions"
# Plugins
zsh_add_plugin "zsh-users/zsh-autosuggestions"
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"

View File

@@ -1,3 +1,4 @@
#!/bin/zsh
# Function to source files if they exist
function zsh_add_file() {
[ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1"

View File

@@ -1,6 +1,21 @@
#!/bin/sh
mkdir "${HOME}/.config" >/dev/null 2>&1
config="${HOME}/.config"
local_rc="${PWD}/config/.zshrc"
local_env="${PWD}/config/.zshenv"
local_funcs="${PWD}/config/zsh-functions"
ln -sfv "${PWD}/.zshenv" "${HOME}"
ln -sfv "${PWD}/zsh" "${HOME}/.config/zsh"
_make_dirs() {
mkdir "${config}"
mkdir "${config}/zsh"
}
_make_links() {
ln -sfv "${local_env}" "${HOME}"
ln -sfv "${local_rc}" "${config}/zsh"
ln -sfv "${local_funcs}" "${config}/zsh"
}
# -------------- main -------------------
_make_dirs
_make_links

View File

@@ -1 +0,0 @@
/Users/michael/.dotfiles/zsh/zsh