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