mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
Cleaning up zshrc
This commit is contained in:
@@ -7,19 +7,20 @@ tap "federico-terzi/espanso"
|
|||||||
cask_args appdir: "~/Applications", require_sha: true
|
cask_args appdir: "~/Applications", require_sha: true
|
||||||
|
|
||||||
# formula
|
# formula
|
||||||
|
brew "docker-completion" # Docker cli completions
|
||||||
brew "espanso" # Espanso: Text expander
|
brew "espanso" # Espanso: Text expander
|
||||||
brew "fd" # required for some neovim plugins
|
brew "fd" # required for some neovim plugins
|
||||||
brew "figlet"
|
brew "figlet" # for ascii art / text
|
||||||
brew "gh" # Github CLI
|
brew "gh" # Github CLI
|
||||||
brew "git"
|
brew "git"
|
||||||
brew "mas"
|
brew "mas" # Mac AppStore apps from cli
|
||||||
brew "neovim"
|
brew "neovim"
|
||||||
brew "node" # required for some LSP servers in neovim
|
brew "node" # required for some LSP servers in neovim
|
||||||
brew "pure"
|
brew "pure" # for cli prompt
|
||||||
brew "ripgrep"
|
brew "ripgrep"
|
||||||
brew "stow"
|
brew "stow" # for dotfile linking / placement.
|
||||||
brew "swift-format"
|
brew "swift-format" # for formatting swift files
|
||||||
brew "tmux"
|
brew "tmux" # terminal multi-plexer
|
||||||
brew "zsh"
|
brew "zsh"
|
||||||
brew "zsh-completions"
|
brew "zsh-completions"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
setopt appendhistory
|
#------------------------------ exports ------------------------------
|
||||||
setopt sharehistory
|
export ZDOTDIR="$HOME/.config/zsh"
|
||||||
setopt incappendhistory
|
export SHELL="$(which zsh)"
|
||||||
|
export DOCUMENTS="$HOME/Documents"
|
||||||
|
export DOWNLOADS="$HOME/Downloads"
|
||||||
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
|
export DESKTOP="$HOME/Desktop"
|
||||||
|
export SCRIPTS="$HOME/.local/scripts"
|
||||||
|
export TERM=xterm-256color
|
||||||
|
export EDITOR=vi
|
||||||
|
export VISUAL=vi
|
||||||
|
export EDITOR_PREFIX=vi
|
||||||
|
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||||
|
|
||||||
autoload -U up-line-or-beginning-search
|
autoload -U up-line-or-beginning-search
|
||||||
autoload -U down-line-or-beginning-search
|
autoload -U down-line-or-beginning-search
|
||||||
@@ -14,33 +25,110 @@ autoload -Uz colors && colors
|
|||||||
# Load Useful Functions
|
# Load Useful Functions
|
||||||
source "$ZDOTDIR/zsh-functions"
|
source "$ZDOTDIR/zsh-functions"
|
||||||
|
|
||||||
zsh_add_file "zsh-exports"
|
#------------------------------ path ------------------------------
|
||||||
|
|
||||||
|
path_append() {
|
||||||
|
declare arg
|
||||||
|
for arg in "$@"; do
|
||||||
|
test -d "$arg" || continue
|
||||||
|
PATH=${PATH//":$arg:"/:}
|
||||||
|
PATH=${PATH/#"$arg:"/}
|
||||||
|
PATH=${PATH/%":$arg"/}
|
||||||
|
export PATH="${PATH:+"$PATH:"}$arg"
|
||||||
|
done
|
||||||
|
} && export path_append
|
||||||
|
|
||||||
|
path_prepend() {
|
||||||
|
declare arg
|
||||||
|
for arg in "$@"; do
|
||||||
|
test -d "$arg" || continue
|
||||||
|
PATH=${PATH//:"$arg:"/:}
|
||||||
|
PATH=${PATH/#"$arg:"/}
|
||||||
|
PATH=${PATH/%":$arg"/}
|
||||||
|
export PATH="$arg${PATH:+":$PATH"}"
|
||||||
|
done
|
||||||
|
} && export path_prepend
|
||||||
|
|
||||||
|
fpath_prepend() {
|
||||||
|
declare arg
|
||||||
|
for arg in "$@"; do
|
||||||
|
test -d "$arg" || continue
|
||||||
|
FPATH=${FPATH//:"$arg:"/:}
|
||||||
|
FPATH=${FPATH/#"$arg:"/}
|
||||||
|
FPATH=${FPATH/%":$arg"/}
|
||||||
|
export FPATH="$arg${FPATH:+":$FPATH"}"
|
||||||
|
done
|
||||||
|
} && export fpath_prepend
|
||||||
|
|
||||||
|
|
||||||
|
# last arg will be first in path
|
||||||
|
path_prepend \
|
||||||
|
"$(brew --prefix)/sbin" \
|
||||||
|
"$(brew --prefix)/bin" \
|
||||||
|
"$HOME/.local/bin" \
|
||||||
|
"$SCRIPTS"
|
||||||
|
|
||||||
|
fpath_prepend \
|
||||||
|
"$(brew --prefix)/share/zsh/site-functions" \
|
||||||
|
"$(brew --prefix)/share/zsh-completions" \
|
||||||
|
"$ZDOTDIR/completions"
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------ history ------------------------------
|
||||||
|
setopt appendhistory # append to history
|
||||||
|
setopt sharehistory # share history across multiple sessions
|
||||||
|
setopt incappendhistory # adds commands as typed, not at shell exit
|
||||||
|
setopt hist_expire_dups_first # expire duplicates first
|
||||||
|
setopt hist_ignore_dups # do not store duplicates
|
||||||
|
setopt hist_find_no_dups # ignore duplicates when searching
|
||||||
|
setopt hist_reduce_blanks # do not store blank lines.
|
||||||
|
|
||||||
|
export HISTSIZE=5000
|
||||||
|
export HISTFILESIZE=10000
|
||||||
|
export HISTFILE=$ZDOTDIR/history
|
||||||
|
|
||||||
|
#set -o vi
|
||||||
|
|
||||||
|
#------------------------------ cdpath ------------------------------
|
||||||
|
setopt autocd
|
||||||
|
export CDPATH=".:$DOTFILES:$HOME"
|
||||||
|
|
||||||
|
#------------------------------ options ------------------------------
|
||||||
|
# (see `man zshoptions`)
|
||||||
|
setopt chaselinks
|
||||||
|
setopt extended_glob
|
||||||
|
setopt glob_dots
|
||||||
|
setopt glob_star_short
|
||||||
|
setopt clobber
|
||||||
|
setopt interactive_comments
|
||||||
|
setopt aliases
|
||||||
|
|
||||||
|
# Enable vi mode
|
||||||
|
bindkey -v
|
||||||
|
|
||||||
|
#zsh_add_file "zsh-exports"
|
||||||
zsh_add_file "zsh-aliases"
|
zsh_add_file "zsh-aliases"
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
||||||
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"
|
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"
|
||||||
|
|
||||||
# Homebrew
|
#------------------------------ completions ------------------------------
|
||||||
if [ "$(which brew)" ]; then
|
# case insensitive path-completion
|
||||||
eval "$(brew shellenv)"
|
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
|
||||||
fi
|
|
||||||
|
# partial completion suggestions
|
||||||
|
zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix
|
||||||
|
|
||||||
# compinit
|
|
||||||
fpath=("$ZDOTDIR/completions" $fpath)
|
|
||||||
autoload -Uz compinit; compinit
|
|
||||||
zstyle ':completion:*' menu select
|
zstyle ':completion:*' menu select
|
||||||
|
autoload -Uz compinit; compinit # zstyle(s) should be added before this.
|
||||||
zmodload zsh/complist
|
zmodload zsh/complist
|
||||||
_comp_options+=(globdots) # Include hidden files.
|
_comp_options+=(globdots) # Include hidden files.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Prompt / managed by brew. (`brew install pure`)
|
# Prompt / managed by brew. (`brew install pure`)
|
||||||
#fpath+="$ZDOTDIR/plugins/pure"
|
|
||||||
autoload -Uz promptinit; promptinit
|
autoload -Uz promptinit; promptinit
|
||||||
prompt pure
|
prompt pure
|
||||||
|
|
||||||
# Enable vi mode
|
|
||||||
#bindkey -v
|
|
||||||
|
|
||||||
cat < "$ZDOTDIR/banner"
|
cat < "$ZDOTDIR/banner"
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
HISTSIZE=200
|
|
||||||
HISTFILE=$ZDOTDIR/history
|
|
||||||
|
|
||||||
# shell
|
|
||||||
export SHELL="$(which zsh)"
|
|
||||||
|
|
||||||
# Allow useful scripts in ~/.bin to be in the search path.
|
|
||||||
export PATH=~/.bin:$PATH
|
|
||||||
export PATH=~/.local/scripts:$PATH
|
|
||||||
|
|
||||||
if [ -d /opt/homebrew ]; then
|
|
||||||
export PATH=/opt/homebrew/bin:$PATH
|
|
||||||
export PATH=/opt/homebrew/sbin:$PATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Allow git to work on mounted volumes
|
|
||||||
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
|
||||||
|
|
||||||
|
|
||||||
# zsh-completions installed by homebrew
|
|
||||||
if type brew &>/dev/null; then
|
|
||||||
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
|
|
||||||
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
export EDITOR="nvim"
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user