diff --git a/base/.config/profile/profile.d/base.sh b/base/.config/profile/profile.d/base.sh index 2a4db79..157d873 100644 --- a/base/.config/profile/profile.d/base.sh +++ b/base/.config/profile/profile.d/base.sh @@ -1,7 +1,5 @@ #ft=sh -alias slugify="sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z" - if type nvim >/dev/null 2>/dev/null ; then export EDITOR=nvim alias vim=nvim @@ -9,6 +7,17 @@ else export EDITOR=vim fi +slugify () ( + if [ "$#" -ne 0 ] ; then + echo "$@" | slugify + else + iconv --to-code ascii//TRANSLIT | + sed -E 's/[^a-zA-Z0-9]+/-/g' | + sed -E 's/^-+\|-+$//g' | + tr '[:upper:]' '[:lower:]' + fi +) + source_env_file () { if [ ! -f "${1}" ]; then return