mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Merge pull request #132 from ngaro/fixls
lib/theme-and-appearance: Fix broken ls-colors
This commit is contained in:
@@ -60,13 +60,21 @@ esac
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
_omb_util_alias ls='ls --color=auto'
|
||||
#_omb_util_alias ls='dir --color=auto'
|
||||
#_omb_util_alias vdir='vdir --color=auto'
|
||||
|
||||
# Note: aliases "grep", "fgrep", and "egrep" are merged in lib/grep.sh
|
||||
fi
|
||||
|
||||
function _omb_util_alias_select_ls {
|
||||
if command ls --color=auto ~ &>/dev/null; then
|
||||
_omb_command='ls --color=auto'
|
||||
elif command ls -G ~ &>/dev/null; then
|
||||
_omb_command='ls -G'
|
||||
fi
|
||||
}
|
||||
_omb_util_alias_delayed ls
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
|
24
lib/utils.sh
24
lib/utils.sh
@@ -402,6 +402,30 @@ function _omb_util_alias {
|
||||
alias -- "$1"
|
||||
}
|
||||
|
||||
function _omb_util_alias_delayed__init {
|
||||
local _omb_name=$1 _omb_init=${FUNCNAME[1]}
|
||||
local _omb_command=$_omb_name
|
||||
"_omb_util_alias_select_$_omb_name"
|
||||
|
||||
if [[ ! $_omb_command || $_omb_command == "$_omb_name" ]]; then
|
||||
unalias "$_omb_name"
|
||||
else
|
||||
alias "$_omb_name=$_omb_command"
|
||||
fi || return 1
|
||||
|
||||
eval -- "function $_omb_init { command ${_omb_command:-$_omb_name} \"\$@\"; }" && "$_omb_init" "${@:2}"
|
||||
}
|
||||
function _omb_util_alias_delayed {
|
||||
local name=$1 opts=${2-}
|
||||
local func=_omb_util_alias_init_$name
|
||||
eval -- "function $func { _omb_util_alias_delayed__init $name \"\$@\"; }"
|
||||
if [[ :$opts: == *:force:* ]]; then
|
||||
alias "$name=$func"
|
||||
else
|
||||
_omb_util_alias "$name=$func"
|
||||
fi
|
||||
}
|
||||
|
||||
function _omb_util_mktemp {
|
||||
local template=tmp.oh-my-bash.XXXXXXXXXX
|
||||
if _omb_util_command_exists mktemp; then
|
||||
|
Reference in New Issue
Block a user