commit 12c85b867203e53350639378a134cea861b46658 Author: cole-maxwell1 Date: Thu May 23 21:16:09 2024 -0500 Initial commit diff --git a/.scripts/hello.sh b/.scripts/hello.sh new file mode 100755 index 0000000..fd3828c --- /dev/null +++ b/.scripts/hello.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo "Hello world" \ No newline at end of file diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..5753d3c --- /dev/null +++ b/.zshrc @@ -0,0 +1,133 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +############################################### +# Cole's $PATH configs +############################################### + +# Make .local/bin directory if it doesn't exist for user binaries +if [[ ! -d $HOME/.local/bin ]]; then + mkdir -p $HOME/.local/bin + +fi + +# Add .local/bin to $PATH if it doesn't exist +if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then + export PATH=$PATH:$HOME/.local/bin +fi + +# Add script binaries to $PATH if they exist +if [[ -d $HOME/.scripts && ":$PATH:" != *":$HOME/.scripts:"* ]]; then + export PATH=$PATH:$HOME/.scripts +fi + +# Linux specific +# if [[ "$(uname -s)" == "Linux" ]]; then + +# fi + +# MacOS specific +if [[ "$(uname -s)" == "Darwin" ]]; then + # Add python3.8 $PATH if installed and not already in $PATH + if [[ -d $HOME/Library/Python/3.8/bin && ":$PATH:" != *":$HOME/Library/Python/3.8/bin:"* ]]; then + export PATH=$PATH:$HOME/Library/Python/3.8/bin + fi +fi + +# Add goland $PATH if installed and not already in $PATH +if [[ -d /usr/local/go/bin && ":$PATH:" != *":/usr/local/go/bin:"* ]]; then + export PATH=$PATH:/usr/local/go/bin:~/go/bin +fi + +# Add golang local bin path if installed and not already in $PATH +if [[ -d $HOME/go/bin && ":$PATH:" != *":$HOME/go/bin:"* ]]; then + export PATH=$PATH:$HOME/go/bin +fi + +# Add cargo path if installed and not already in $PATH +if [[ -d $HOME/.cargo/bin && ":$PATH:" != *":$HOME/.cargo/bin:"* ]]; then + export PATH=$PATH:$HOME/.cargo/bin +fi + +############################################### +# zsh recommeded default configs +############################################### + +# Autoload functions +autoload -Uz promptinit +autoload -Uz compinit + +# Initialize prompt system +promptinit + +# Set shell options +setopt histignorealldups sharehistory + +# Use emacs keybindings even if EDITOR is set to vi +bindkey -e + +# History settings +HISTSIZE=1000 +SAVEHIST=1000 +HISTFILE=~/.zsh_history + +# Initialize completion system +compinit + +# Completion configuration +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete _correct _approximate +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' menu select=2 +# Directory colors setup +if command -v dircolors &> /dev/null; then + eval "$(dircolors -b)" +elif command -v gdircolors &> /dev/null; then + eval "$(gdircolors -b)" +else + # Define LS_COLORS directly if dircolors is not available + export LS_COLORS="di=34:ln=35:so=32:pi=33:ex=31:bd=46:cd=43:su=37:sg=30:tw=42:ow=44" +fi +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' +zstyle ':completion:*' menu select=long +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl false +zstyle ':completion:*' verbose true +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' + +############################################### +# Cole's custom prompt +############################################### + +# Load Powerlevel10k theme if available +if [[ -f ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme ]]; then + # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. + [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + source ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme +fi + +# Add autosuggestions (lazy load) +if [[ -f ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then + source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh +fi + +############################################### +# Load Cole's custom aliases +############################################### + +# Aliases for lsd (if installed) +# lsd is a rust ls alternative with a lot of features and fun colors/icons (Nerd Fonts required) +if command -v lsd &> /dev/null; then + alias ls="lsd -F" + alias la="lsd -AF" + alias ll="lsd -lAF" + alias lg="lsd -F --group-dirs=first" + alias lt="lsd --tree" +fi diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8f1056 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# ZSH Plugin and Theme +The key to this setup is [GNU `stow`](https://www.gnu.org/software/stow/) a symlink manager. `stow` allows you to easily link the files in the repo directly to where these files would be in your home directory originally. + +I prefer to manually install the my zsh theme and plugins. I like to the `~/.zsh` directory to store the repos of any dependencies I bring into my config. + +# Prerequisites + +## GNU `stow` +Install `stow` with your system's package manager. + +## Nerd Fonts +Make sure you get a nerd font [installed](https://github.com/ryanoasis/nerd-fonts) and [configured](https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#meslo-nerd-font-patched-for-powerlevel10k) for your terminal emulators, text editors, and IDEs of choice. + +## Powerlevel10k + +```sh +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.zsh/powerlevel10k +``` + +## zsh-autosuggestions + +```sh +git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions +``` + +# Configure a New Machine +1. Clone this repository to your home directory + ```sh + git clone https://github.com/cole-maxwell1/dotfiles.git + ``` +2. Run GNU stow + ```sh + cd dotfiles && stow . + ``` +3. Make scripts executable for current user + ```sh + chmod -R u+x ~/dotfiles/.scripts/ + ``` \ No newline at end of file