BIG UPDATE: zsh: moved lots of things out of the zshrc
This commit is contained in:
parent
a96c4215ed
commit
1eae827160
4 changed files with 81 additions and 61 deletions
6
.config/shell/bin/calc
Executable file
6
.config/shell/bin/calc
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/zsh
|
||||
# Note: this is compatible with `sh`, but because
|
||||
# `sh` does not handle floats, I'm choosing `zsh`.
|
||||
|
||||
# Believe it or not, zsh makes for a fine calculator
|
||||
echo $(($*))
|
|
@ -1,7 +1,13 @@
|
|||
#!/bin/sh
|
||||
# Blake's environment variables
|
||||
# This file should be compatible with standard sh
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-$HOME/.config}/shell"}"
|
||||
if ! [ -d "$SHELL_CONFIG_DIR" ]; then
|
||||
echo "FATAL ERROR: \$SHELL_CONFIG_DIR is not set to a real directory: $SHELL_CONFIG_DIR"
|
||||
fi
|
||||
|
||||
# Intelligently set $EDITOR
|
||||
if command -v nvim > /dev/null;then
|
||||
export EDITOR=nvim
|
||||
|
@ -10,46 +16,60 @@ elif command -v vim > /dev/null;then
|
|||
elif command -v vi > /dev/null;then
|
||||
export EDITOR=vi
|
||||
fi
|
||||
|
||||
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-$HOME/.config}/shell"}"
|
||||
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local}/bin:$SHELL_CONFIG_DIR/bin"
|
||||
export SYSTEMD_EDITOR="$EDITOR"
|
||||
|
||||
|
||||
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local}/bin:$SHELL_CONFIG_DIR/bin"
|
||||
|
||||
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
|
||||
|
||||
export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
||||
# Don't add extra space to the right side of the prompt
|
||||
export ZLE_RPROMPT_INDENT=0
|
||||
|
||||
export ZINIT_HOME_DIR="${XDG_DATA_HOME:-$HOME/.local}/share/zinit"
|
||||
|
||||
|
||||
# Set documents directory (auto set to the repo the file ~/todo points to is in)
|
||||
# shellcheck disable=SC2155
|
||||
[ -h ~/todo ] && export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)"
|
||||
[ -h ~/todo ] && export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)" || DOCS_DIR="$HOME/Documents/docs/"
|
||||
|
||||
## Working directory save settings (see things at bottom of zshrc)
|
||||
WORKING_DIR_SAVE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/last-working-dir"
|
||||
# make the dir for the file if needed
|
||||
! test -d "$(dirname "$WORKING_DIR_SAVE_FILE")" && mkdir -p "$(dirname "$WORKING_DIR_SAVE_FILE")"
|
||||
test -d "$(dirname "$WORKING_DIR_SAVE_FILE")" || mkdir -p "$(dirname "$WORKING_DIR_SAVE_FILE")"
|
||||
|
||||
# Plugin setting >>>
|
||||
# ZSH plugin settings >>>
|
||||
# ZSH Vi Mode
|
||||
export ZVM_VI_HIGHLIGHT_FOREGROUND=#BBC2CF
|
||||
export ZVM_VI_HIGHLIGHT_BACKGROUND=#515860
|
||||
# ZVM_VI_HIGHLIGHT_EXTRASTYLE=bold,underline # bold and underline
|
||||
|
||||
# vim-mode cursor
|
||||
# syntax: "[color] [blinking] [style]" see: https://github.com/softmoth/zsh-vim-mode#mode-in-prompt
|
||||
export MODE_CURSOR_VIINS="blinking bar"
|
||||
export MODE_CURSOR_REPLACE="steady bar"
|
||||
export MODE_CURSOR_VICMD="steady block"
|
||||
export MODE_CURSOR_SEARCH="blinking underline"
|
||||
export MODE_CURSOR_VISUAL="steady block"
|
||||
export MODE_CURSOR_VLINE="steady block"
|
||||
|
||||
# OMZ Completion
|
||||
export COMPLETION_WAITING_DOTS=true
|
||||
|
||||
# Powerlevel 10k
|
||||
export POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD="${POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD:-true}"
|
||||
export POWERLEVEL9K_INSTANT_PROMPT=quiet
|
||||
export POWERLEVEL9K_INSTANT_PROMPT="${POWERLEVEL9K_INSTANT_PROMPT:-quiet}"
|
||||
# TODO?: maybe add a bit of code to select a random theme if none is detected (make sure to disable instant prompt if this happens)
|
||||
export P10K_CONFIG_LOCATION="$SHELL_CONFIG_DIR/p10k/current"
|
||||
# <<<
|
||||
|
||||
###########################################
|
||||
### Directory and file quick access ###
|
||||
###########################################
|
||||
SCD="$SHELL_CONFIG_DIR"
|
||||
DD="/home/blake/Documents/docs/"
|
||||
S="$SHELL_CONFIG_DIR"
|
||||
DD="$DOCS_DIR"
|
||||
|
||||
# vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3
|
||||
# vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3:ts=3
|
||||
|
|
13
.config/shell/functions/mkcd
Normal file
13
.config/shell/functions/mkcd
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
# make a directory and cd into it
|
||||
mkcd() {
|
||||
mkdir -p "$1" || error "$0" $LINENO
|
||||
cd "$1" || error "$0" $LINENO
|
||||
}
|
||||
|
||||
error() {
|
||||
ERROR_CODE="$?"
|
||||
>&2 echo "($1) An error occurred on line number $2"
|
||||
return $ERROR_CODE
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue