1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-13 09:20:09 +00:00

installer: use tabs to allow future heredocs

This will allow us to use tab stripping heredocs with `<<-'.
See http://www.tldp.org/LDP/abs/html/here-docs.html#EX71A

Add editorconfig file to enforce this style.
See http://editorconfig.org for more information.
This commit is contained in:
Marc Cornellà 2016-08-09 02:28:47 +02:00
parent 9a832cccef
commit 73ef051aae
2 changed files with 107 additions and 97 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
[*.sh]
indent_size = 4
indent_style = tab

View file

@ -12,6 +12,7 @@ main() {
if command_exists tput; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
@ -68,7 +69,6 @@ main() {
exit 1
}
printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
@ -76,10 +76,10 @@ main() {
fi
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc
cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
sed "/^export ZSH=/ c\\
export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp
export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc
# If this user's login shell is not already "zsh", attempt to switch.