diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-11-05 17:51:43 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-11-05 17:51:43 +0100 |
| commit | ce919c3e2d566ec3d0f8574bdc4c22212cd86d0f (patch) | |
| tree | e7200e76ca10a3c157a67737518d3a5268c7ec89 | |
| parent | 050db4c2c3681940730d16439315c9a58a4a8672 (diff) | |
Make more portable
| -rwxr-xr-x | initsh/.initsh | 23 | ||||
| -rwxr-xr-x | zsh/.zshrc | 5 |
2 files changed, 18 insertions, 10 deletions
diff --git a/initsh/.initsh b/initsh/.initsh index c937757..47af88c 100755 --- a/initsh/.initsh +++ b/initsh/.initsh @@ -11,8 +11,14 @@ if [ -x "$(command -v nvim)" ]; then fi ## Replace ls and tree with exa if installed if [ -x "$(command -v exa)" ]; then - alias ls='exa' + alias ls='exa --group-directories-first' alias tree='exa --tree' + # exa doesn't have the --almost-all option + alias la='ls -al' +else + # TODO: can we add --group-directories-first here? + ls --color=auto > /dev/null 2>&1 && alias ls='ls --color=auto' + alias la='ls -A' fi ## Colors if [ -x "$(command -v dircolors)" ]; then @@ -22,7 +28,7 @@ if [ -x "$(command -v dircolors)" ]; then 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' @@ -31,8 +37,7 @@ alias egrep='egrep --color=auto' alias hexedit='hexedit --color' alias minicom='minicom -c on' ## Some more ls aliases -alias ll='ls -Al' -alias la='ls -A' +alias ll='ls -l' # Easy to use copy/paste aliases for different platforms if [ "$KERNEL" = "Linux" ]; then @@ -47,9 +52,13 @@ fi 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))" + if [ -x "$(command -v lsb_release)" ]; then + 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))" + else + OS_DESCRIPTION="$(uname --operating-system)" + fi elif [ "$KERNEL" = "Darwin" ]; then DF_ARGS="-h -l" OS_DESCRIPTION="$(system_profiler SPSoftwareDataType -detailLevel mini | grep -o "System Version: .*" | awk -F ': ' '{print $2}')" @@ -101,8 +101,7 @@ export DEFAULT_USER="$USER" # Don't indent prompt export ZLE_RPROMPT_INDENT=0 -# Powerlevel9k -[ -n "$POWERLEVEL9K_THEME" ] && source "$POWERLEVEL9K_THEME" +[ -n "$ZSH_THEME" ] && source "$ZSH_THEME" ## Settings POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir dir_writable vcs) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status background_jobs command_execution_time time) @@ -118,7 +117,7 @@ ZSH_AUTOSUGGEST_USE_ASYNC=1 # Syntax highlighting [ -n "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ] && source "$ZSH_SYNTAX_HIGHLIGHTING_PATH" -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh +[ -f "$ZSH_FZF_PATH" ] && source "$ZSH_FZF_PATH" # Exec general init script source ~/.initsh |
