You've already forked dotfiles
feat: Update to the zsh setup, moving functions and aliases to their own
files, changing up the plugins and settings to remove stale setups and to reduce the loading time by nearly half
This commit is contained in:
9
zsh/zsh_aliases
Normal file
9
zsh/zsh_aliases
Normal file
@@ -0,0 +1,9 @@
|
||||
# Aliases Universal
|
||||
alias rm="rm -I" # Prompt for removal of more than three files or recursively to give some protection of mistakes
|
||||
alias mv="mv -i" # Prompt before moving files
|
||||
alias df="df -h" # Always use the human readable formatting
|
||||
alias du="du -h -d 1" # Always use human readable format and only for the current dir by default
|
||||
alias k="killall" # Quick killall
|
||||
alias p="ps aux | grep $1" # Quick
|
||||
alias n="$EDITOR" # Just open the usual editor
|
||||
alias todo="nvim ~/.zettelkasten/TODO.md"
|
||||
18
zsh/zsh_functions
Normal file
18
zsh/zsh_functions
Normal file
@@ -0,0 +1,18 @@
|
||||
### Custom functions
|
||||
# Timing function for checking zsh load speed
|
||||
function timezsh() {
|
||||
shell=$SHELL
|
||||
for i in $(seq 1 10)
|
||||
do
|
||||
ts=$(date +%s%N)
|
||||
$SHELL -i -c exit
|
||||
echo $((($(date +%s%N) - $ts)/1000000))ms
|
||||
done
|
||||
}
|
||||
|
||||
# Custom rsync move function that also removes empty directories that have their contents removed
|
||||
# NOTE: This will delete *any* empty directories in the CWD
|
||||
function rmv() {
|
||||
rsync -avzhP --remove-source-files --ignore-existing "${@:1:$#-1}" "${@:$#}" && \
|
||||
find ./* -depth -type d -empty -exec rmdir "{}" \;
|
||||
}
|
||||
95
zsh/zshrc
Normal file
95
zsh/zshrc
Normal file
@@ -0,0 +1,95 @@
|
||||
# call `zprof` to profile all calls in the current shell
|
||||
# Uncomment here and at the bottom of the file, then fully reopen a terminal
|
||||
# zmodload zsh/zprof
|
||||
|
||||
# Install oh-my-zsh if it doesn't exist
|
||||
if [ ! -d $HOME/.oh-my-zsh/ ]
|
||||
then
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
fi
|
||||
|
||||
### ZSH Configuration
|
||||
## Path variables
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
export MANPAGER="less -R --use-color -Dd+r -Du+b" # Colored MAN pages
|
||||
|
||||
ZSH_THEME="fb-custom"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
HYPHEN_INSENSITIVE="true"
|
||||
DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
### Plugins
|
||||
# Install the zsh-autosuggestions plugin if it doesn't exist
|
||||
if [ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ]
|
||||
then
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
||||
fi
|
||||
|
||||
plugins=(
|
||||
fzf
|
||||
zsh-autosuggestions
|
||||
virtualenvwrapper # Used for autoloading project .venvs
|
||||
)
|
||||
|
||||
# Load Oh My ZSH
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# ZSH options
|
||||
setopt NO_clobber # Do not clobber files by default
|
||||
setopt hist_ignore_all_dups # Replace old history with the newest call to an identical call
|
||||
setopt hist_ignore_space # Remove history lines that start with spaces
|
||||
|
||||
# Experimental
|
||||
setopt append_history inc_append_history share_history
|
||||
setopt auto_param_slash
|
||||
setopt no_case_glob no_case_match
|
||||
|
||||
# Completion options
|
||||
# Give descriptions of what the types of completions given
|
||||
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
|
||||
# Give an actual output when there is no match
|
||||
zstyle ':completion:*:warnings' format '%BNo matches for: %d%b'
|
||||
|
||||
### User configuration
|
||||
export EDITOR=nvim
|
||||
export NVM_CONFIG_PREFIX=$HOME/.local/
|
||||
|
||||
# Paths to prepend to system path
|
||||
path=(
|
||||
$GOPATH/bin
|
||||
$HOME/.cargo/bin
|
||||
$HOME/.local/bin
|
||||
$NVM_CONFIG_PREFIX/bin
|
||||
$path
|
||||
)
|
||||
|
||||
# Autoload keychain for ssh-agent handling if it is installed
|
||||
if command -v keychain &> /dev/null
|
||||
then
|
||||
eval $(keychain --eval --quiet --nogui --noask)
|
||||
fi
|
||||
|
||||
### Environment specific include files
|
||||
include_files=(
|
||||
"$HOME/.config/zsh/fb_theme.zsh"
|
||||
"$HOME/.config/zsh/zsh_local.zsh"
|
||||
"$HOME/.config/zsh/zsh_aliases.zsh"
|
||||
"$HOME/.config/zsh/zsh_exports.zsh"
|
||||
"$HOME/.config/zsh/zsh_functions.zsh"
|
||||
)
|
||||
|
||||
for file in $include_files; do
|
||||
if [ ! -f $file ]
|
||||
then
|
||||
touch $file
|
||||
fi
|
||||
|
||||
source $file
|
||||
done
|
||||
|
||||
# Call to zprof for startup timings
|
||||
# zprof
|
||||
Reference in New Issue
Block a user