aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-11-06 16:14:41 +0100
committerBond_009 <bond.009@outlook.com>2021-11-06 16:14:41 +0100
commit52e39b248922d23c51ab8a0372b92d5d59ef7c80 (patch)
treed185dca1e21346e0a4464fce6ce770081e873b67
parentbee944c9416fc263d561fc05af66ede395b1016b (diff)
Make init script more portable
-rw-r--r--exports/.exports21
-rwxr-xr-xinitsh/.initsh33
2 files changed, 39 insertions, 15 deletions
diff --git a/exports/.exports b/exports/.exports
index 5bc59e1..7ad755b 100644
--- a/exports/.exports
+++ b/exports/.exports
@@ -8,6 +8,27 @@
[ -d "$HOME/dotnet" ] && export PATH="$HOME/dotnet:$PATH" && export DOTNET_ROOT="$HOME/dotnet"
[ -d "$HOME/.dotnet/tools" ] && export PATH="$HOME/.dotnet/tools:$PATH"
+# Colors for BSD tools
+export CLICOLOR=1
+
+# Editor
+## Some applications expect the full path
+if [ -x "$(command -v nvim)" ]; then
+ VISUAL="$(command -v nvim)"
+else
+ VISUAL="$(command -v nano)"
+fi
+export VISUAL
+## Some applications only accept EDITOR
+EDITOR="$(command -v nano)"
+export EDITOR
+
+# C/C++
+if [ -x "$(command -v clang)" ]; then
+ export CC="clang"
+ export CXX="clang++"
+fi
+
# DOTNET
export DOTNET_CLI_TELEMETRY_OPTOUT=1
diff --git a/initsh/.initsh b/initsh/.initsh
index eece39b..1f048fa 100755
--- a/initsh/.initsh
+++ b/initsh/.initsh
@@ -2,29 +2,32 @@
KERNEL=$(uname -s)
-# 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
-
# Aliases
-## Replace ls with exa if installed
+alias e=\$VISUAL
+## Replace vi and vim with neovim if installed
+if [ -x "$(command -v nvim)" ]; then
+ alias vi='nvim'
+ alias vim='nvim'
+fi
+## Replace ls and tree with exa if installed
if [ -x "$(command -v exa)" ]; then
alias ls='exa'
alias tree='exa --tree'
-else
- alias ls='ls --color=auto'
fi
-## Editors
-alias e=$VISUAL
-alias vim=$VISUAL
## Colors
+if [ -x "$(command -v dircolors)" ]; then
+ if [ -f ~/.dircolors ]; then
+ eval "$(dircolors ~/.dircolors)"
+ else
+ eval "$(dircolors)"
+ fi
+fi
+ls --color=auto > /dev/null 2>&1 && alias ls='ls --color=auto'
alias dir='dir --color=auto'
+alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
+alias fgrep='fgrep --color=auto'
+alias egrep='egrep --color=auto'
alias hexedit='hexedit --color'
## Some more ls aliases
alias ll='ls -Al'