Adds os detection for bootstrapping configs

This commit is contained in:
William Carroll 2017-06-23 13:01:16 -04:00
parent e51d11e4bc
commit f344f2e370
10 changed files with 50 additions and 53 deletions

View file

@ -1,62 +1,47 @@
#!/usr/bin/env bash
pc_settings_path="${HOME}/pc_settings"
configs_dir="${pc_settings_path}/configs"
shared_configs="${configs_dir}/shared"
if [[ $(uname) == 'Darwin' ]]; then
os_specific_configs="${configs_dir}/os_x"
elif [[ $(uname) == 'Linux' ]]; then
os_specific_configs="${configs_dir}/linux"
fi
config_files=( \
".zsh_profile" \
".tmux.conf" \
".ctags" \
".vimrc" \
".emacs" \
)
function symlink_configs () {
configs_dir=$1
for cf in $(find $configs_dir -type f -name ".*"); do
filename=$(grep -o "[^\/]+$" <<<$cf)
echo "$filename: "
for i in {1..5}; do
cf="${config_files[i]}"
echo "\"${cf}\": "
if [ -f "${HOME}/${cf}" ] && [ ! -L "${HOME}/${cf}" ]; then
echo -n "Backing up ${cf} ... " && \
mv "${HOME}/${cf}" "${HOME}/${cf}.bak" && \
if [ -f "${HOME}/${filename}" ] && [ ! -L "${HOME}/${filename}" ]; then
echo -n "Backing up ${filename} ... " && \
mv "${HOME}/${filename}" "${HOME}/${filename}.bak" && \
echo "Done."
fi
if [ -L "${HOME}/${cf}" ]; then
if [ $(readlink "${HOME}/${cf}") = "${pc_settings_path}/configs/${cf}" ]; then
echo "Already properly symlinked to \"${pc_settings_path}/configs\"."
if [ -L "${HOME}/${filename}" ]; then
if [ $(readlink "${HOME}/${filename}") = $cf ]; then
echo "Already properly symlinked to ${configs_dir}."
else
echo "Already symlinked but NOT to the proper location. Aborting..."
fi
else
echo -n "Symlinking to ${pc_settings_path}/configs/${cf} ... " && \
ln -s "${pc_settings_path}/configs/${cf}" "${HOME}/${cf}" && \
echo -n "Symlinking to ${filename} ... " && \
ln -s $cf "${HOME}/${filename}" && \
echo "Done."
fi
echo ""
done
}
# Fish Shell is a special case
# cf_dir="${HOME}/.configs/fish"
# cf="config.fish"
# handle shared configs
symlink_configs $shared_configs
# if [ -f "${cf_dir}/${cf}" ] && [ ! -L "${cf_dir}/${cf}" ]; then
# echo -n "Backing up ${cf} ... " && \
# mv "${cf_dir}/${cf}" "${HOME}/${cf}.bak" && \
# echo "Done."
# fi
# if [ -L "${cf_dir}/${cf}" ]; then
# if [ $(readlink "${cf_dir}/${cf}") = "${pc_settings_path}/configs/${cf}" ]; then
# echo "Already properly symlinked to \"${pc_settings_path}/configs\"."
# else
# echo "Already symlinked but NOT to the proper location. Aborting..."
# fi
# else
# echo -n "Symlinking to ${pc_settings_path}/configs/${cf} ... " && \
# ln -s "${pc_settings_path}/configs/${cf}" "${cf_dir}/${cf}" && \
# echo "Done."
# fi
# echo ""
# handle os-specific configs
symlink_configs $os_specific_configs

View file

@ -246,6 +246,7 @@
:init
(load "~/.emacs.d/wc-dired-functions.el")
:bind (:map dired-mode-map
("C-p" . helm-ag-neotree-node)
("e" . wdired-change-to-wdired-mode)
("c" . find-file)
("RET" . dired-find-alternate-file)
@ -337,11 +338,11 @@
;; center search results
(defadvice evil-search-next
(after center-evil-search-next)
(after center-evil-search-next activate)
(call-interactively 'evil-scroll-line-to-center))
(defadvice evil-search-previous
(after center-evil-search-previous)
(after center-evil-search-previous activate)
(call-interactively 'evil-scroll-line-to-center))
(add-hook 'org-mode-hook 'evil-local-mode))

View file

@ -0,0 +1,11 @@
;; if in a project
;; if ansi-term is an existing process for the current project
;; ok
;; create an ansi-term buffer for the current project
;; if ansi-term is an open window
;; if number of open windows == 1, visit MRU source code buffer
;; if number of open windows > 1, (delete-window ansi-term-window)
;; if ansi-term is not an open window
;; open ansi-term other-window
;; else
;; (message "You are not currently in a project.")