aboutsummaryrefslogtreecommitdiff
path: root/scripts/check_os.sh
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2017-06-09 08:03:15 -0600
committerCody Hiar <codyfh@gmail.com>2017-06-10 16:00:35 -0600
commit12825d5147f5c0b1636dbda5ba34790d7c7bb236 (patch)
tree4e19cf279bd5aaed07209b21dbb2203d9f211a25 /scripts/check_os.sh
parentf7e44ef5b68574a3803f27dc06143abecae430ca (diff)
Moving files, cleaning up bug with drawer close (closing drawer in 2 places)
Diffstat (limited to 'scripts/check_os.sh')
-rwxr-xr-xscripts/check_os.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/check_os.sh b/scripts/check_os.sh
new file mode 100755
index 0000000..e4abf85
--- /dev/null
+++ b/scripts/check_os.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# vim: set filetype=sh :
+#
+# Author: Cody Hiar
+# Date: 2017-06-09
+#
+# Description:: Check the operatig system of the host and load the os specific
+# options
+#
+# Set options:
+# e: Stop script if command fails
+# u: Stop script if unset variable is referenced
+# x: Debug, print commands as they are executed
+# o pipeline: If any command in a pipeline fails it all fails
+#
+set -euo pipefail
+
+# Main loop of program
+main() {
+ if [ "$(uname)" == "Darwin" ]; then
+ # Setup 'v' to begin selection as in Vim
+ bind -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
+ # Update default binding of `Enter` to also use copy-pipe
+ unbind -T copy-mode-vi Enter
+ bind-key -T copy-mode-vi Enter copy-pipe "reattach-to-user-namespace pbcopy"
+ # Allow pbcopy inside of session
+ set-option -g default-command "reattach-to-user-namespace -l zsh"
+ elif [ "$(uname)" == "Linux" ]; then
+ bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel "tmux save-buffer - | xp"
+ tmux source-file "$HOME/.tmux/linux.tmux.config"
+ fi
+}
+main
+