Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single change to tmux/tmux.conf file at the end to source #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ Network Trash Folder
Temporary Items
.apdisk


# Log files and swap
*.log
*.swp
30 changes: 20 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,42 @@ REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
cd "$REPODIR";

if ! is_app_installed tmux; then
printf "WARNING: \"tmux\" command is not found. \
Install it first\n"
printf "WARNING: \"tmux\" command is not found. Install it first\n"
exit 1
fi

if [ ! -e "$HOME/.tmux/plugins" ]; then
mkdir -p ~/.tmux/plugins
fi

if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
printf "WARNING: Cannot found TPM (Tmux Plugin Manager) \
at default location: \$HOME/.tmux/plugins/tpm.\n"
printf "WARNING: Cannot found TPM (Tmux Plugin Manager) at default location: \$HOME/.tmux/plugins/tpm.\n"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi

if [ -e "$HOME/.tmux.conf" ]; then
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
tmuxbak="$HOME/.tmux.conf.bak$(date +%Y%m%d_%H%M%S)"
printf "Found existing ~/.tmux.conf in your \$HOME directory. Creating a backup at $tmuxbak\n"
cp -f "$HOME/.tmux.conf" "$tmuxbak" 2>/dev/null || true
fi

if [ ! -e "$HOME/.tmux.conf.local" ]; then
touch $HOME/.tmux.conf.local
fi

cp -f "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak" 2>/dev/null || true
cp -a ./tmux/. "$HOME"/.tmux/
ln -sf .tmux/tmux.conf "$HOME"/.tmux.conf;
cp -a ./tmux/renew_env.sh ~/.tmux/
cp -a ./tmux/tmux.remote.conf ~/.tmux/
cp -a ./tmux/yank.sh ~/.tmux/
#ln -sf "${PWD}"/tmux/tmux.conf ~/.tmux.conf;
cp -a ./tmux/tmux.conf ~/.tmux.conf

# Install TPM plugins.
# TPM requires running tmux server, as soon as `tmux start-server` does not work
# create dump __noop session in detached mode, and kill it when plugins are installed
printf "Install TPM plugins\n"
printf "Installing TPM plugins\n"
tmux new -d -s __noop >/dev/null 2>&1 || true
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true
~/.tmux/plugins/tpm/bin/install_plugins || true
tmux kill-session -t __noop >/dev/null 2>&1 || true

printf "OK: Completed\n"
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Tmux configuration, that supercharges your [tmux](https://tmux.github.io/) and b

![intro](https://user-images.githubusercontent.com/768858/33152741-ec5f1270-cfe6-11e7-9570-6d17330a83aa.gif)

**Note:** Put local changes in `$HOME/.tmux.conf.local` to add or to override settings in `$HOME/.tmux.conf`

Table of contents
-----------------

Expand Down
3 changes: 3 additions & 0 deletions tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,8 @@ bind -T off F12 \
set -u window-status-current-format \;\
refresh-client -S

# Source local configuration
source-file ~/.tmux.conf.local

# Run all plugins' scripts
run '~/.tmux/plugins/tpm/tpm'
40 changes: 40 additions & 0 deletions tmux/tmux.conf.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Change prefix key back to C-b, I'm use to using that
unbind C-a
set -g prefix C-b

# split windows with a pipe and dash
bind - splitw
bind | splitw -h

# Jump to previous used tab (tmux-config sets this to Tab, which should be sufficient)
#bind-key C-l last-window

# Vi copypaste mode (tmux-config already sets this)
#set-window-option -g mode-keys vi

# Resize panes by repeatably tapping
bind-key -r J resize-pane -D 3
bind-key -r H resize-pane -L 3
bind-key -r K resize-pane -U 3
bind-key -r L resize-pane -R 3

# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# I never have any luck with mouse mode enabled
set -g mouse off

# Color
set -g default-terminal "screen-256color"

bind Escape copy-mode

# http://superuser.com/questions/600286/move-pane-to-a-new-window-in-tmux
# Move pane to new window (break-pane) or move window to pane (join-pane)
bind-key C-j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key C-s command-prompt -p "send pane to:" "join-pane -t '%%'"
bind-key b break-pane