-
Notifications
You must be signed in to change notification settings - Fork 4
/
freshrc
142 lines (116 loc) · 3.59 KB
/
freshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# vim: set ft=sh:
# Bin files
fresh freshshell/fresh bin/fresh --bin
fresh bin/\* --bin
# Some shell aliases
fresh shell/aliases/\*
fresh shell/\*
fresh-options --file=~/.bashrc --marker=#
fresh shell/completions/\*
fresh shell/bashrc-mixins/\*
fresh shell/bashrc
fresh freshshell/fresh contrib/source-build.sh
fresh rupa/z z.sh
fresh-options
fresh freshshell/fresh contrib/completion/fresh-completion.bash
# root dir config files
fresh config/\* --file --filter=erb
# dotconfig files
fresh dotconfig/starship.toml --file=~/.config/starship.toml
# gpg-agent
if [ "$(uname)" = "Darwin" ]; then
fresh gpg-agent.conf --file=~/.gnupg/gpg-agent.conf
fi
# Tmux
fresh-options --file=~/.tmux.conf --marker=#
fresh tmux/\*
fresh-options
# Vim
fresh vim/vimrc --file
fresh vim/vim --file=~/.vim/
# OpenSSH
fresh ssh/config --file=~/.ssh/config
# Gemfile
fresh Gemfile --file=~/Gemfile
fresh Gemfile.lock --file=~/Gemfile.lock
# Bundler
fresh bundle/config --file=~/.bundle/config
# Brewfile
fresh Brewfile --file=~/Brewfile --filter erb
# plist files
fresh plist/com.ragingmenace.MenuMeters.plist --file=~/Library/Preferences/com.ragingmenace.MenuMeters.plist
fresh plist/io.github.martakostova.Pomodoro.plist --file=~/Library/Preferences/io.github.martakostova.Pomodoro.plist
# steampipe
fresh steampipe/config --file=~/.steampipe/config/
# Work
if [ -n "${WORK+x}" ]; then
fresh-options --file
fresh git@gitlab.com:josacar/work-dotfiles.git .bashrc-extra
fresh git@gitlab.com:josacar/work-dotfiles.git .vpnc-script
fresh git@gitlab.com:josacar/work-dotfiles.git ssh/work_config --file=~/.ssh/work_config
fresh-options
fi
install_brew(){
if [ "$(uname)" = "Darwin" ] && ! command -v brew > /dev/null 2>&1; then
echo 'Installing brew'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
cd "$HOME" && brew bundle
fi
}
install_vim_bundle(){
vim +PlugInstall +PlugUpdate +qall
}
install_chefdk_extra_gems(){
install_chefdk_gem kitchen-dokken
install_chefdk_gem kitchen-inspec
install_chefdk_gem inspec
}
install_chefdk_gem(){
gem=$1
if command -v chef > /dev/null 2>&1 && chef gem list --no-installed "$gem" > /dev/null 2>&1; then
chef gem install "$gem"
fi
}
create_neovim_symlinks(){
[ ! -d "$HOME/.config" ] && \
mkdir -p "$HOME/.config"
[ ! -L "$HOME/.config/nvim" ] && \
rm -rf "$HOME/.config/vim" && \
ln -s "$HOME/.vim" "$HOME/.config/nvim"
[ ! -h "$HOME/.config/nvim/init.vim" ] && \
rm -rf "$HOME/.config/nvim/init.vim" && \
ln -s "$HOME/.vimrc" "$HOME/.config/nvim/init.vim"
[ ! -d "$HOME/.vim/files/info" ] && \
mkdir -p "$HOME/.vim/files/info"
}
install_asdf(){
if [ -f /opt/homebrew/bin/asdf ]; then
/opt/homebrew/bin/asdf plugin-add ruby ruby || true
/opt/homebrew/bin/asdf plugin-add terraform || true
fi
}
permissions(){
if ! [ -z ${WORK+x} ]; then
[ -f $HOME/.vpnc-script ] && chmod +x $HOME/.vpnc-script
fi
}
update_defaults(){
if [ "$(uname)" = "Darwin" ]; then
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
defaults write bluetoothaudiod "Enable AptX codec" -bool true
defaults write bluetoothaudiod "Enable AAC codec" -bool true
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write com.apple.screencapture location $HOME/screenshots
fi
}
# fresh hook
fresh_after_build(){
create_neovim_symlinks
install_brew
install_vim_bundle
install_chefdk_extra_gems
install_asdf
update_defaults
permissions
}