From bee944c9416fc263d561fc05af66ede395b1016b Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Thu, 4 Nov 2021 22:24:11 +0100 Subject: Streamline shell init --- exports/.exports | 15 +++++++++++++++ initsh/.initsh | 49 ++++++++++++++++++++++--------------------------- zsh/.zshrc | 8 ++++---- 3 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 exports/.exports diff --git a/exports/.exports b/exports/.exports new file mode 100644 index 0000000..5bc59e1 --- /dev/null +++ b/exports/.exports @@ -0,0 +1,15 @@ +#!/bin/sh + +# PATH +## Set PATH so it includes user's private bin, cargos bin and dotnet if they exist +[ -d "$HOME/bin" ] && export PATH="$HOME/bin:$PATH" +[ -d "$HOME/.local/bin" ] && export PATH="$HOME/.local/bin:$PATH" +[ -d "$HOME/.cargo/bin" ] && export PATH="$HOME/.cargo/bin:$PATH" +[ -d "$HOME/dotnet" ] && export PATH="$HOME/dotnet:$PATH" && export DOTNET_ROOT="$HOME/dotnet" +[ -d "$HOME/.dotnet/tools" ] && export PATH="$HOME/.dotnet/tools:$PATH" + +# DOTNET +export DOTNET_CLI_TELEMETRY_OPTOUT=1 + +# RUST +export RUST_BACKTRACE=full diff --git a/initsh/.initsh b/initsh/.initsh index ecad570..eece39b 100755 --- a/initsh/.initsh +++ b/initsh/.initsh @@ -2,8 +2,6 @@ KERNEL=$(uname -s) -# EXPORTS -[ -f ~/.exports ] && source ~/.exports # EDITORS export EDITOR="nano" export VISUAL="nvim" @@ -12,36 +10,33 @@ export CC="clang" export CXX="clang++" export DCMAKE_C_COMPILER=$CC export DCMAKE_CXX_COMPILER=$CXX -## RUST -export RUST_BACKTRACE=full # Aliases ## Replace ls with exa if installed if [ -x "$(command -v exa)" ]; then - alias ls="exa" - alias l="exa --icons" - alias tree="exa --tree" + alias ls='exa' + alias tree='exa --tree' else - alias ls="ls --color=auto" + alias ls='ls --color=auto' fi ## Editors alias e=$VISUAL alias vim=$VISUAL ## Colors -alias dir="dir --color=auto" -alias grep="grep --color=auto" -alias hexedit="hexedit --color" +alias dir='dir --color=auto' +alias grep='grep --color=auto' +alias hexedit='hexedit --color' ## Some more ls aliases -alias ll="ls -alF" -alias la="ls -a" +alias ll='ls -Al' +alias la='ls -A' # Easy to use copy/paste aliases for different platforms if [ "$KERNEL" = "Linux" ]; then - alias ucopy="xclip -selection c" - alias upaste="xclip -selection clipboard -o" + alias ucopy='xclip -selection c' + alias upaste='xclip -selection clipboard -o' elif [ "$KERNEL" = "Darwin" ]; then - alias ucopy="pbcopy" - alias upaste="pbpaste" + alias ucopy='pbcopy' + alias upaste='pbpaste' fi # Greeting message @@ -56,14 +51,14 @@ if [ -n "$WELCOME_MSG" ]; then OS_DESCRIPTION="$(system_profiler SPSoftwareDataType -detailLevel mini | grep -o "System Version: .*" | awk -F ': ' '{print $2}')" fi - echo - echo -e " \e[1mUser: \e[0;32m$USER\e[0m" - echo -e " \e[1mHostname: \e[0;32m$(uname -n)\e[0m" - echo -e " \e[1mOS: \e[0;32m$OS_DESCRIPTION\e[0m" - echo -e " \e[1mKernel: \e[0;32m$KERNEL $(uname -r)\e[0m" - echo - echo -e " \e[1mDisk usage:\e[0m" - echo - echo -e "$(eval df $DF_ARGS | sed 's/^/ /')" - echo + printf '\n' + printf ' \e[1mUser: \e[0;32m%s\e[0m\n' "$USER" + printf ' \e[1mHostname: \e[0;32m%s\e[0m\n' "$(uname -n)" + printf ' \e[1mOS: \e[0;32m%s\e[0m\n' "$OS_DESCRIPTION" + printf ' \e[1mKernel: \e[0;32m%s %s\e[0m\n' "$KERNEL" "$(uname -r)" + printf '\n' + printf ' \e[1mDisk usage:\e[0m\n' + printf '\n' + printf '%s\n' "$(eval df $DF_ARGS | sed 's/^/ /')" + printf '\n' fi diff --git a/zsh/.zshrc b/zsh/.zshrc index db49ac0..40f7fc1 100755 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,7 +1,4 @@ -# Exec general init script -source ~/.initsh - -# If not running interactively, don't do anything else +# If not running interactively, don't do anything case $- in *i*) ;; *) return;; @@ -122,3 +119,6 @@ ZSH_AUTOSUGGEST_USE_ASYNC=1 [ -n "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ] && source "$ZSH_SYNTAX_HIGHLIGHTING_PATH" [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# Exec general init script +source ~/.initsh -- cgit v1.2.3