From a6161d402a537e665fc08ae3f4c9b55f16f9b47a Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 14 Jul 2021 19:11:50 +0200 Subject: [PATCH] Define exports in profile, rename sh to shell --- home/.config/sh/environ | 60 ---------------------------- home/.config/{sh => shell}/aliases | 14 +++---- home/.config/{sh => shell}/functions | 0 home/.config/{sh => shell}/handlers | 0 home/.config/{sh => shell}/keybinds | 0 home/.config/shell/profile | 53 ++++++++++++++++++++++++ home/.config/{sh => shell}/prompt | 0 home/.zprofile | 1 + home/.zshrc | 34 ++++++++-------- 9 files changed, 78 insertions(+), 84 deletions(-) delete mode 100755 home/.config/sh/environ rename home/.config/{sh => shell}/aliases (97%) rename home/.config/{sh => shell}/functions (100%) rename home/.config/{sh => shell}/handlers (100%) rename home/.config/{sh => shell}/keybinds (100%) create mode 100755 home/.config/shell/profile rename home/.config/{sh => shell}/prompt (100%) create mode 120000 home/.zprofile diff --git a/home/.config/sh/environ b/home/.config/sh/environ deleted file mode 100755 index e911a01..0000000 --- a/home/.config/sh/environ +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -# Environmental variables -export EDITOR=nvim -export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv -export GPG_TTY=${tty} -export LESS_TERMCAP_md="${yellow}" # Highlight section titles in manual pages -export BASH_SILENCE_DEPRECATION_WARNING=1 # Hide the “default interactive shell is now zsh” warning on macOS. -command -v bat > /dev/null && export MANPAGER="sh -c 'col -bx | bat -l man -p'" # Format manuals with bat (colors) - -# Add executable directories into PATH -PATH+=":$HOME/.local/bin" -PATH+=":$HOME/.local/share/npm/bin" # npm binaries - - -# Only run XDG configs for non-root users -if [ $UID -ne 0 ]; then - # XDG Standard paths - export XDG_CONFIG_HOME="$HOME/.config" - export XDG_CACHE_HOME="$HOME/.cache" - export XDG_DATA_HOME="$HOME/.local/share" - export XDG_RUNTIME_DIR="/run/user/$UID" - - # Per-Application XDG settings - export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" - export LESSHISTFILE="-" - export GTK_RC_FILES="$XDG_CONFIG_HOME/gtk-1.0/gtkrc" - export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" - export KDEHOME="$XDG_CONFIG_HOME/kde" - export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv" - export GNUPGHOME="$XDG_DATA_HOME/gnupg" - export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker" - export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java" - export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" - export PYLINTHOME="$XDG_CACHE_HOME/pylint" - export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" - export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime" - export GOPATH="$XDG_DATA_HOME/go" - export IPYTHONDIR="$XDG_CONFIG_HOME/ipython" - export PYTHON_EGG_CACHE="$XDG_CACHE_HOME/python-eggs" - export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter" - export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history" - export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc" - export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history" - export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass" - export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf" - export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer" - export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages - export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" - - # XDG Alias overrides - alias nvidia-settings='nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings"' - alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' - alias svn='svn --config-dir "$XDG_CONFIG_HOME"/subversion' - - # XDG Function overrides - function ngrok(){ - command ngrok $1 -config=$XDG_CONFIG_HOME/ngrok2/ngrok.yml ${@:2} - } -fi diff --git a/home/.config/sh/aliases b/home/.config/shell/aliases similarity index 97% rename from home/.config/sh/aliases rename to home/.config/shell/aliases index 8a00ed5..9c5fefe 100755 --- a/home/.config/sh/aliases +++ b/home/.config/shell/aliases @@ -55,16 +55,16 @@ else fi # Config access shortcuts -alias cfzshrc='vim ~/.zshrc' +alias cfzsh='vim ~/.config/zsh/.zshrc' alias cfvim='vim ~/.config/nvim/init.vim' alias cfnvim='cfvim' -alias cfalias='vim ~/.config/sh/aliases' -alias cffunctions='vim ~/.config/sh/functions' -alias cfenviron='vim ~/.config/sh/environ' +alias cfalias='vim ~/.config/shell/aliases' +alias cffunctions='vim ~/.config/shell/functions' +alias cfprofile='vim ~/.config/shell/profile' alias cfxdg='cfenviron' -alias cfhandlers='vim ~/.config/sh/handlers' -alias cfprompt='vim ~/.config/sh/prompt' -alias cfkeybinds='vim ~/.config/sh/keybinds' +alias cfhandlers='vim ~/.config/shell/handlers' +alias cfprompt='vim ~/.config/shell/prompt' +alias cfkeybinds='vim ~/.config/shell/keybinds' alias cfxmonad='vim ~/.config/xmonad/xmonad.hs' alias cfxmobar='vim ~/.config/xmobar/xmobarrc.hs && ~/.config/xmobar/multi_mon.sh 2' alias cftodo='vim ~/Personal/todo' diff --git a/home/.config/sh/functions b/home/.config/shell/functions similarity index 100% rename from home/.config/sh/functions rename to home/.config/shell/functions diff --git a/home/.config/sh/handlers b/home/.config/shell/handlers similarity index 100% rename from home/.config/sh/handlers rename to home/.config/shell/handlers diff --git a/home/.config/sh/keybinds b/home/.config/shell/keybinds similarity index 100% rename from home/.config/sh/keybinds rename to home/.config/shell/keybinds diff --git a/home/.config/shell/profile b/home/.config/shell/profile new file mode 100755 index 0000000..35a3e39 --- /dev/null +++ b/home/.config/shell/profile @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Default programs +export EDITOR="nvim" +export BROWSER="firefox" +export TERMINAL="Alacrity" + +# Add all ~/.local/bin folders to PATH +PATH+=":${$(find ~/.local/bin -type d | tr '\n' ':')%%:}" + +# XDG Standard paths +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_RUNTIME_DIR="/run/user/$UID" + +# Pre-Application XDG settings +export LESSHISTFILE="-" +export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" +export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +# Less commonly used applications +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" +export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" +export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime" +export GOPATH="$XDG_DATA_HOME/go" +export IPYTHONDIR="$XDG_CONFIG_HOME/ipython" +#export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker" +#export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv" +#export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java" +#export PYLINTHOME="$XDG_CACHE_HOME/pylint" +#export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history" +#export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc" +#export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history" +#export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass" +#export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf" +#export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages + +# Colorful man pages +export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')" +export LESS_TERMCAP_md="$(printf '%b' '[1;36m')" +export LESS_TERMCAP_me="$(printf '%b' '[0m')" +export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')" +export LESS_TERMCAP_se="$(printf '%b' '[0m')" +export LESS_TERMCAP_us="$(printf '%b' '[1;32m')" +export LESS_TERMCAP_ue="$(printf '%b' '[0m')" +# If we have bat installed, use it as manpager +command -v bat > /dev/null && export MANPAGER="sh -c 'col -bx | bat -l man -p'" # Format manuals with bat (colors) + +# Other program settings +export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv +#export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. + diff --git a/home/.config/sh/prompt b/home/.config/shell/prompt similarity index 100% rename from home/.config/sh/prompt rename to home/.config/shell/prompt diff --git a/home/.zprofile b/home/.zprofile new file mode 120000 index 0000000..8486fca --- /dev/null +++ b/home/.zprofile @@ -0,0 +1 @@ +.config/shell/profile \ No newline at end of file diff --git a/home/.zshrc b/home/.zshrc index 6dc4050..ba241a9 100755 --- a/home/.zshrc +++ b/home/.zshrc @@ -1,15 +1,17 @@ #!/usr/bin/zsh +source /etc/profile + # ZSH Options -setopt auto_cd # cd by typing directory name if it's not a command -setopt auto_list # automatically list choices on ambiguous completion -setopt auto_menu # automatically use menu completion -setopt always_to_end # move cursor to end if word had one match -setopt interactivecomments # allow comments in interactive mode -setopt magicequalsubst # enable filename expansion for arguments of form `x=expression` -setopt notify # report the status of background jobs immediately -setopt numericglobsort # sort filenames numerically when it makes sense -#setopt correct_all # autocorrect commands +setopt auto_cd # cd by typing directory name if it's not a command +setopt auto_list # automatically list choices on ambiguous completion +setopt auto_menu # automatically use menu completion +setopt always_to_end # move cursor to end if word had one match +setopt interactivecomments # allow comments in interactive mode +setopt magicequalsubst # enable filename expansion for arguments of form `x=expression` +setopt notify # report the status of background jobs immediately +setopt numericglobsort # sort filenames numerically when it makes sense +#setopt correct_all # autocorrect commands # ZSH files cleanup export ZSH_CACHE="$HOME/.cache/zsh" @@ -47,21 +49,19 @@ zstyle ':completion:*' group-name '' # group results by category zstyle ':completion:::::' completer _expand _complete _ignored _approximate #enable approximate matches for completio # Color support -autoload -U colors && colors +#autoload -U colors && colors -# Environmental variable exports, including XDG standard definitions -[ -f ~/.config/sh/environ ] && source ~/.config/sh/environ # Setup aliases -[ -f ~/.config/sh/aliases ] && source ~/.config/sh/aliases +[ -f ~/.config/shell/aliases ] && source ~/.config/shell/aliases # Load handlers -[ -f ~/.config/sh/handlers ] && source ~/.config/sh/handlers +[ -f ~/.config/shell/handlers ] && source ~/.config/shell/handlers # Load key bindings -[ -f ~/.config/sh/keybinds ] && source ~/.config/sh/keybinds +[ -f ~/.config/shell/keybinds ] && source ~/.config/shell/keybinds # Load prompt -[ -f ~/.config/sh/prompt ] && . ~/.config/sh/prompt +[ -f ~/.config/shell/prompt ] && source ~/.config/shell/prompt # Load extensions (should be last) -. /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null # Syntax highlighting +. /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh 2>/dev/null # Syntax highlighting . /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null # Auto suggestions . /usr/share/autojump/autojump.zsh 2>/dev/null # Auto-Jump