diff --git a/README.md b/README.md index 338cc22..5f355f8 100644 --- a/README.md +++ b/README.md @@ -350,6 +350,22 @@ as `gs` for the extended `git status`, and `ga` for the `git add` function. If you already have an alias like `alias gco="git checkout"`, you can now type `gco 1` to checkout the first file in the output of SCM Breeze's `git status`. +## Custom emojis for username and "staff" group + +The `ll` command adds numbered shortcuts to files, but another fun feature is replacing your +username and the "staff" group with custom emojis: + +![Custom user and staff emojis](/docs/images/custom_user_and_staff_symbols.jpg) + +Set your own emojis by running: + +```bash +echo 🍀 > ~/.user_sym +echo 🖥 > ~/.staff_sym +``` + +I also like using `~/.user_sym` [in my Bash prompt](https://github.com/ndbroadbent/dotfiles/blob/master/bashrc/prompt.sh#L71). + ## Notes about Tab Completion for Aliases diff --git a/docs/images/custom_user_and_staff_symbols.jpg b/docs/images/custom_user_and_staff_symbols.jpg new file mode 100644 index 0000000..b65e055 Binary files /dev/null and b/docs/images/custom_user_and_staff_symbols.jpg differ diff --git a/lib/git/shell_shortcuts.sh b/lib/git/shell_shortcuts.sh index 4c427d8..9b5423e 100644 --- a/lib/git/shell_shortcuts.sh +++ b/lib/git/shell_shortcuts.sh @@ -142,7 +142,18 @@ if [ "$shell_ls_aliases_enabled" = "true" ] && which ruby > /dev/null 2>&1; then puts o.lines.map{|l|l.sub(re){|m|\"%s%-#{u}s %-#{g}s%#{s}s \"%[\$1,*\$3.split]}}" } - ll_output=$(echo "$ll_output" | \sed -$SED_REGEX_ARG "s/ $USER/ $(/bin/cat $HOME/.user_sym)/g" | rejustify_ls_columns) + if [ -f "$HOME/.user_sym" ]; then + local USER_SYM=$(/bin/cat $HOME/.user_sym) + if [ -f "$HOME/.staff_sym" ]; then + local STAFF_SYM=$(/bin/cat $HOME/.staff_sym) + ll_output=$(echo "$ll_output" | \ + \sed -$SED_REGEX_ARG "s/ $USER staff/ $USER_SYM $STAFF_SYM /g") + fi + ll_output=$(echo "$ll_output" | \ + \sed -$SED_REGEX_ARG "s/ $USER/ $USER_SYM /g") + fi + + ll_output=$(echo "$ll_output" | rejustify_ls_columns) fi if [ "$(echo "$ll_output" | wc -l)" -gt "50" ]; then