-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfreshrc
More file actions
203 lines (169 loc) · 5.51 KB
/
freshrc
File metadata and controls
203 lines (169 loc) · 5.51 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# vim: set ft=sh:
fresh freshshell/fresh bin/fresh --bin
for file in ~/.bash_profile ~/.bashrc; do
fresh shell/noninteractive.sh --file=$file
fresh shell/path_pre.sh --file=$file
fresh shell/path.sh --file=$file
fresh shell/path_post.sh --file=$file
fresh shell/source-build.sh --file=$file
done
fresh-options --file=~/.bash_logout
fresh shell/logout/*
fresh-options
fresh 'bin/*' --bin
fresh JonathonMA/junkscripts 'bin/*' --bin
fresh jasoncodes/ctrlp-modified.vim lib/branch.sh --bin
fresh jasoncodes/ctrlp-modified.vim lib/branch_modified.sh --bin
fresh jasoncodes/ctrlp-modified.vim lib/modified.sh --bin
ensure_checkout() {
local _tmp="$(mktemp)"
fresh-options --file=$_tmp
fresh "$@"
fresh-options
rm "$_tmp"
}
# Shell
fresh shell/noninteractive.sh
fresh shell/has_command_pre.sh
fresh 'shell/xdg_pre.sh'
fresh 'shell/xdg/*'
fresh 'shell/xdg_post.sh'
fresh 'shell/aliases/*'
fresh 'shell/config/*'
fresh shell/has_command_post.sh
fresh rcaloras/bash-preexec bash-preexec.sh
fresh 'shell/preexec.sh'
fresh 'shell/local.sh'
if [ -L "$HOME/.ecryptfs" ]; then
fresh JonathonMA/mlocate-encrypted-home locate-home.sh
fi
if [ -d ~/.local/share/dotfiles/private ]; then
fresh 'private/shell/*'
fi
# Config
fresh-options --file
fresh 'legacy-config/*'
fresh-options
fresh seebi/dircolors-solarized dircolors.ansi-dark --file=~/.config/dircolors
xdg_filter_sed() { cat<<SED
s|\${XDG_CONFIG_HOME}|\${HOME}/.config|g
s|\${XDG_CACHE_HOME}|\${HOME}/.cache|g
s|\${XDG_DATA_HOME}|\${HOME}/.local/share|g
s|\${XDG_STATE_HOME}|\${HOME}/.local/state|g
SED
}
# Config
xdg_filter() {
local _xdg_filter="$(mktemp)"
xdg_filter_sed > "$_xdg_filter"
(cd "${FRESH_LOCAL}/config/xdg-filtered/" && find . -type f) | while read i; do
fresh --file=~/.config/"$i" "config/xdg-filtered/$i" --filter="sed -f '$_xdg_filter'"
done
}
xdg_filter
xdg_populate() {
if [ -d "$FRESH_LOCAL"/"$1" ]; then
(cd "$FRESH_LOCAL"/"$1" && find . -type d -not -path '*xdg-filtered*' -exec mkdir -p "$2"/{} \;)
(cd "$FRESH_LOCAL"/"$1" && find . -type f -not -path '*xdg-filtered*' -and -not -name .keep -exec ln -sf "$FRESH_LOCAL"/"$1"/{} "$2"/{} \;)
fi
}
xdg_populate_os() {
if [[ "$OSTYPE" == "darwin"* ]]; then
xdg_populate macos/"$1" "$2"
else
xdg_populate linux/"$1" "$2"
fi
}
xdg_populate_host() {
xdg_populate "$1"/"$(hostname)"/"$2" "$3"
}
xdg_populate_dir() {
target="${FRESH_LOCAL}/$1"
if [ -d "$2" -a ! -L "$2" ]; then
echo "$2: exists as dir"
exit 1
elif [ -L "$2" ]; then
if [ "$(readlink "$2")" != "$target" ]; then
echo "$2: exists and is a bad link"
else
:
fi
else
mkdir -p "$(dirname "$2")"
ln -s "$target" "$2"
fi
}
mkdir -p ~/.cache/ ~/.config/ ~/.local/share/
xdg_populate config ~/.config
xdg_populate data ~/.local/share
xdg_populate_os config ~/.config
xdg_populate private/data ~/.local/share
xdg_populate private/config ~/.config
xdg_populate_dir nvim/plugins ~/.config/nvim/lua/plugins
xdg_populate_dir nvim/lib ~/.config/nvim/lua/lib
xdg_populate_host private/host config ~/.config
xdg_populate_host private/host data ~/.local/share
# NOTE: fake a kind of global biome config, without polluting home too much.
ln -sf ~/.config/biome.json ~/.local/biome.json
ln -sf ~/.config/biome.json ~/src/biome.json
# Tmux
fresh tmux-plugins/tpm . --file=~/.config/tmux/plugins/tpm/
# NVim
nvim_path="${XDG_CONFIG_HOME:-$HOME/.config}/nvim"
fresh-options --file="${nvim_path}/init.lua" --marker='--'
fresh 'nvim/init/*.lua'
fresh-options
fresh-options --file="${nvim_path}/preinit.vim" --marker='"'
fresh 'nvim/preinit/*.vim'
fresh-options
fresh-options --file="${nvim_path}/lua/vim/preinit.lua" --marker='--'
fresh 'nvim/preinit/*.lua'
fresh-options
fresh-options --file="${nvim_path}/config.vim" --marker='"'
fresh 'nvim/config/*.vim'
fresh jasoncodes/dotfiles vim/config/auto_mkdir.vim
fresh-options
fresh-options --file="${nvim_path}/lua/vim/config.lua" --marker='--'
fresh 'nvim/config/*.lua'
fresh-options
# More XCompose sequences
fresh kragen/xcompose dotXCompose --file=~/.config/X11/xcompose
# Other config
# NeoMutt
fresh-options --file=${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/neomuttrc --marker=#
fresh neomutt/*
fresh josephholsten/base16-mutt base16.muttrc
fresh private/config/neomutt/accounts --ignore-missing
fresh-options
# Gitignore
fresh-options --file=${XDG_CONFIG_HOME:-$HOME/.config}/git/ignore --marker=#
fresh github/gitignore Global/Vim.gitignore
fresh github/gitignore Global/macOS.gitignore
fresh github/gitignore Global/Tags.gitignore
fresh-options
# Git aliases
fresh-options --file=${XDG_CONFIG_HOME:-$HOME/.config}/git/config --marker=#
fresh git/alias_before.gitconfig
fresh 'git/aliases/*'
fresh 'git/config/*'
fresh-options
# fresh JonathonMA/idemfontent idemfontent --bin
# Manage fonts
command -v idemfontent >/dev/null && idemfontent --regenerate-fontconfig
# Private
if [ ! -d ~/.local/share/dotfiles/private ]; then
git clone git@github.com:JonathonMA/jma-dotfiles-private.git ~/.local/share/dotfiles/private
fi
config_git() {
local config_git_local=${XDG_CONFIG_HOME:-$HOME/.config}/git/local
mkdir -p "$(dirname "$config_git_local")"
if [ ! -e "$config_git_local" ]; then
echo "Configuring local Git settings:"
read -p " Enter Git Name: " username
git config -f "$config_git_local" user.name "$username"
read -p " Enter Git Email: " email
git config -f "$config_git_local" user.email $email
echo "Configured git settings in "$config_git_local". Not stored in local .dotfiles repo."
fi
}
config_git