Adds os detection for bootstrapping configs
This commit is contained in:
parent
e51d11e4bc
commit
f344f2e370
10 changed files with 50 additions and 53 deletions
|
@ -1,62 +1,47 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
pc_settings_path="${HOME}/pc_settings"
|
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=( \
|
function symlink_configs () {
|
||||||
".zsh_profile" \
|
configs_dir=$1
|
||||||
".tmux.conf" \
|
|
||||||
".ctags" \
|
|
||||||
".vimrc" \
|
|
||||||
".emacs" \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
for cf in $(find $configs_dir -type f -name ".*"); do
|
||||||
|
filename=$(grep -o "[^\/]+$" <<<$cf)
|
||||||
|
echo "$filename: "
|
||||||
|
|
||||||
for i in {1..5}; do
|
if [ -f "${HOME}/${filename}" ] && [ ! -L "${HOME}/${filename}" ]; then
|
||||||
cf="${config_files[i]}"
|
echo -n "Backing up ${filename} ... " && \
|
||||||
echo "\"${cf}\": "
|
mv "${HOME}/${filename}" "${HOME}/${filename}.bak" && \
|
||||||
|
echo "Done."
|
||||||
if [ -f "${HOME}/${cf}" ] && [ ! -L "${HOME}/${cf}" ]; then
|
|
||||||
echo -n "Backing up ${cf} ... " && \
|
|
||||||
mv "${HOME}/${cf}" "${HOME}/${cf}.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\"."
|
|
||||||
else
|
|
||||||
echo "Already symlinked but NOT to the proper location. Aborting..."
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo -n "Symlinking to ${pc_settings_path}/configs/${cf} ... " && \
|
if [ -L "${HOME}/${filename}" ]; then
|
||||||
ln -s "${pc_settings_path}/configs/${cf}" "${HOME}/${cf}" && \
|
if [ $(readlink "${HOME}/${filename}") = $cf ]; then
|
||||||
echo "Done."
|
echo "Already properly symlinked to ${configs_dir}."
|
||||||
fi
|
else
|
||||||
echo ""
|
echo "Already symlinked but NOT to the proper location. Aborting..."
|
||||||
done
|
fi
|
||||||
|
else
|
||||||
|
echo -n "Symlinking to ${filename} ... " && \
|
||||||
|
ln -s $cf "${HOME}/${filename}" && \
|
||||||
|
echo "Done."
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Fish Shell is a special case
|
# handle shared configs
|
||||||
# cf_dir="${HOME}/.configs/fish"
|
symlink_configs $shared_configs
|
||||||
# cf="config.fish"
|
|
||||||
|
|
||||||
# if [ -f "${cf_dir}/${cf}" ] && [ ! -L "${cf_dir}/${cf}" ]; then
|
# handle os-specific configs
|
||||||
# echo -n "Backing up ${cf} ... " && \
|
symlink_configs $os_specific_configs
|
||||||
# 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 ""
|
|
||||||
|
|
|
@ -246,6 +246,7 @@
|
||||||
:init
|
:init
|
||||||
(load "~/.emacs.d/wc-dired-functions.el")
|
(load "~/.emacs.d/wc-dired-functions.el")
|
||||||
:bind (:map dired-mode-map
|
:bind (:map dired-mode-map
|
||||||
|
("C-p" . helm-ag-neotree-node)
|
||||||
("e" . wdired-change-to-wdired-mode)
|
("e" . wdired-change-to-wdired-mode)
|
||||||
("c" . find-file)
|
("c" . find-file)
|
||||||
("RET" . dired-find-alternate-file)
|
("RET" . dired-find-alternate-file)
|
||||||
|
@ -337,11 +338,11 @@
|
||||||
|
|
||||||
;; center search results
|
;; center search results
|
||||||
(defadvice evil-search-next
|
(defadvice evil-search-next
|
||||||
(after center-evil-search-next)
|
(after center-evil-search-next activate)
|
||||||
(call-interactively 'evil-scroll-line-to-center))
|
(call-interactively 'evil-scroll-line-to-center))
|
||||||
|
|
||||||
(defadvice evil-search-previous
|
(defadvice evil-search-previous
|
||||||
(after center-evil-search-previous)
|
(after center-evil-search-previous activate)
|
||||||
(call-interactively 'evil-scroll-line-to-center))
|
(call-interactively 'evil-scroll-line-to-center))
|
||||||
|
|
||||||
(add-hook 'org-mode-hook 'evil-local-mode))
|
(add-hook 'org-mode-hook 'evil-local-mode))
|
11
emacs/wc-ansi-term-functions.el
Normal file
11
emacs/wc-ansi-term-functions.el
Normal 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.")
|
Loading…
Reference in a new issue