aboutsummaryrefslogtreecommitdiff
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
parentf7e44ef5b68574a3803f27dc06143abecae430ca (diff)
Moving files, cleaning up bug with drawer close (closing drawer in 2 places)
-rw-r--r--Makefile2
-rw-r--r--README.md14
-rwxr-xr-xcheck_os.sh7
-rwxr-xr-xlinux.tmux.config3
-rwxr-xr-xscripts/check_os.sh34
-rwxr-xr-xscripts/color_palette.sh (renamed from color_palette.sh)0
-rwxr-xr-xscripts/powerline.sh (renamed from powerline.sh)0
-rwxr-xr-xscripts/tmux_open_filename_in_vim.sh38
-rw-r--r--templates/template.yaml7
-rw-r--r--tmux.config6
10 files changed, 51 insertions, 60 deletions
diff --git a/Makefile b/Makefile
index 4a52e48..bbb6608 100644
--- a/Makefile
+++ b/Makefile
@@ -4,5 +4,5 @@ help:
install: ## Install the symlink
ln -s $(CURDIR)/tmux.config ~/.tmux.conf
-uninstall: ## Remove the sumlink
+uninstall: ## Remove the symlink
[[ -L ~/.muttrc ]] && rm ~/.tmux.conf
diff --git a/README.md b/README.md
index d8df7d7..675ca19 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,10 @@
# Setup
-These are the settings that I use for tmux.
-I use the code from tmux-powerline to get some cool functionality out of the status line.
-I also added a few scripts in the scripts dir.
-One is for listing active sessions/giving you the ability to call tmuxomatic scripts and the other script is for tmux renumbering.
-All you need to do is pull this directory and symlink the tmux config to ~/.tmux.conf
-I also use reattach-to-user-namespace to fix some copy/pastying stuff.
-If you don't want it you can remove it from the config file.
+These are the settings that I use for tmux. I used the code from the now
+deprecated tmux-powerline to get some cool functionality out of the status line.
```
brew install reattach-to-user-namespace
git clone https://github.com/thornycrackers/.tmux.git
-ln -s .tmux/tmux.config .tmux.conf
+make install
```
-
-This will overwrite an existing .tmux.conf file if you have one.
+The makefile will create the symlink of .tmux.conf
diff --git a/check_os.sh b/check_os.sh
deleted file mode 100755
index efee8b0..0000000
--- a/check_os.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-
-if [ "$(uname)" == "Darwin" ]; then
- tmux source-file "$HOME/.tmux/mac.tmux.config"
-elif [ "$(uname)" == "Linux" ]; then
- tmux source-file "$HOME/.tmux/linux.tmux.config"
-fi
diff --git a/linux.tmux.config b/linux.tmux.config
deleted file mode 100755
index 091b4f0..0000000
--- a/linux.tmux.config
+++ /dev/null
@@ -1,3 +0,0 @@
-# vim: syntax=conf
-
-bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel "tmux save-buffer - | xp"
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
+
diff --git a/color_palette.sh b/scripts/color_palette.sh
index 3762fae..3762fae 100755
--- a/color_palette.sh
+++ b/scripts/color_palette.sh
diff --git a/powerline.sh b/scripts/powerline.sh
index 8baf3f2..8baf3f2 100755
--- a/powerline.sh
+++ b/scripts/powerline.sh
diff --git a/scripts/tmux_open_filename_in_vim.sh b/scripts/tmux_open_filename_in_vim.sh
index b82c867..55f0c48 100755
--- a/scripts/tmux_open_filename_in_vim.sh
+++ b/scripts/tmux_open_filename_in_vim.sh
@@ -17,48 +17,22 @@
# Immutable globals
readonly ARGS=( "$@" )
readonly PROGNAME=$(basename "$0")
-readonly USAGE=$(cat << EOF
-usage: $PROGNAME file_name
-
-Script that will search for a tmux pane running vim and will tell vim to open a
-file specified by the passed in arguement
-
-OPTIONS:
- -h Display help options
-EOF
-)
-
-# Function for processing arguments
-cmdline() {
- while getopts "h" FLAG; do
- case "$FLAG" in
- h)
- echo "$USAGE"
- exit 0
- ;;
- *)
- exit 0
- ;;
- esac
- done
-}
# Main loop of program
main() {
if [[ -z ${ARGS[0]} ]]; then
exit
fi
- cmdline "${ARGS[@]}"
- panes=($(tmux list-panes| awk -F: '{ print $1 }'))
- for pane in "${panes[@]}"; do
- pane_tty=$(tmux display -p -t "$pane" '#{pane_tty}')
- ps -o state= -o comm= -t "$pane_tty" \
+ CURRENT_PANE=$(tmux display-message -p "#{pane_index}")
+ PANES=($(tmux list-panes| awk -F: '{ print $1 }'))
+ for pane in "${PANES[@]}"; do
+ PANE_TTY=$(tmux display -p -t "$pane" '#{pane_tty}')
+ ps -o state= -o comm= -t "$PANE_TTY" \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$' &> /dev/null
if [[ "$?" == 0 ]]; then
filename="${ARGS[0]}"
tmux send-keys -t "$pane" ":e $filename" Enter
- tmux kill-pane
- # tmux select-pane -t "$pane"
+ tmux select-pane -t "$pane"
fi
done
}
diff --git a/templates/template.yaml b/templates/template.yaml
index 3218321..44a1c44 100644
--- a/templates/template.yaml
+++ b/templates/template.yaml
@@ -1,6 +1,5 @@
session_name: "${PROJECT}"
start_directory: "${DIR}"
-shell_command_before: make up
windows:
- window_name: code
layout: even-vertical
@@ -12,6 +11,6 @@ windows:
- window_name: docker
layout: even-vertical
panes:
- - make enter
- - make enter
- - make enter
+ - pane
+ - pane
+ - pane
diff --git a/tmux.config b/tmux.config
index 94dc931..ff910f0 100644
--- a/tmux.config
+++ b/tmux.config
@@ -75,11 +75,11 @@ set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 110
set-option -g status-right-length 80
-set-option -g status-left "#(~/.tmux/powerline.sh left)"
-set-option -g status-right "#(~/.tmux/powerline.sh right)"
+set-option -g status-left "#(~/.tmux/scripts/powerline.sh left)"
+set-option -g status-right "#(~/.tmux/scripts/powerline.sh right)"
# Load/Ignore Mac specific options
-run-shell "bash ~/.tmux/check_os.sh"
+# run-shell "bash ~/.tmux/sripts/check_os.sh"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'