aboutsummaryrefslogtreecommitdiff
path: root/initsh/.initsh
diff options
context:
space:
mode:
Diffstat (limited to 'initsh/.initsh')
-rwxr-xr-xinitsh/.initsh69
1 files changed, 69 insertions, 0 deletions
diff --git a/initsh/.initsh b/initsh/.initsh
new file mode 100755
index 0000000..ecad570
--- /dev/null
+++ b/initsh/.initsh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+KERNEL=$(uname -s)
+
+# EXPORTS
+[ -f ~/.exports ] && source ~/.exports
+# EDITORS
+export EDITOR="nano"
+export VISUAL="nvim"
+## C/C++
+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"
+else
+ 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"
+## Some more ls aliases
+alias ll="ls -alF"
+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"
+elif [ "$KERNEL" = "Darwin" ]; then
+ alias ucopy="pbcopy"
+ alias upaste="pbpaste"
+fi
+
+# Greeting message
+if [ -n "$WELCOME_MSG" ]; then
+ if [ "$KERNEL" = "Linux" ]; then
+ DF_ARGS="-h -T -xtmpfs -xdevtmpfs"
+ OS_DESCRIPTION="$(lsb_release -sd)"
+ # Manjaro has a weird lsb_release, compensate
+ [ "$OS_DESCRIPTION" = '"Manjaro Linux"' ] && OS_DESCRIPTION="Manjaro Linux $(lsb_release -sr) ($(lsb_release -sc))"
+ elif [ "$KERNEL" = "Darwin" ]; then
+ DF_ARGS="-h -l"
+ 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
+fi