Fix tmux vim navigator movement

Fixes tmux xdg-compliance (and, more importantly, Tmux Plugin Manager's)
by setting the environment variable TMUX_PLUGIN_MANAGER_PATH to follow
xdg specifications. Tmux, due to not being xdg-compliant, needs to be
aliased to start with the `-f` option pointing into the configuration
directory.

Fixes tmux vim nagigator's controls being overwritten by other control
schemes in tmux.
This commit is contained in:
Marty Oehme 2020-02-06 20:30:35 +01:00
parent 87ad744e6a
commit 348a167390
4 changed files with 21 additions and 32 deletions

View file

@ -31,7 +31,6 @@ alias ..="cd .."
alias ...="cd ../.."
alias ~="cd ~"
# clear my screen
alias cl="clear"

View file

@ -30,4 +30,6 @@ test -d "$XDG_CONFIG_HOME" || mkdir -p -m 0700 "$XDG_CONFIG_HOME"
test -d "$XDG_DATA_HOME" || mkdir -p -m 0700 "$XDG_DATA_HOME"
## Applications that can be set through environment variables
export NVM_DIR="$XDG_DATA_HOME/nvm"
export TMUX_PLUGIN_MANAGER_PATH="$XDG_DATA_HOME/tmux"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"

View file

@ -2,6 +2,10 @@
exist() { type "$1" >/dev/null 2>&1; }
# alias tmux to follow xdg-specification
# shellcheck disable=2139
alias tmux="tmux -f ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"
# show a list of running tmux sessions
alias tl='tmux list-sessions -F "#{session_name}" 2>/dev/null'

View file

@ -48,20 +48,21 @@ set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
## 2. PLUGINS ##
####################
# Plugins -- TO INITALLY SET UP THE PLUGINS PRESS bind-key I (that is shift i)
# -- a message will appear after a second saying succes
#run-shell ~/.tmux-plugins/resurrect/resurrect.tmux
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
christoomey/vim-tmux-navigator \
Morantron/tmux-fingers \
'
if "test ! -z ${TMUX_PLUGIN_MANAGER_PATH} && test ! -d ${TMUX_PLUGIN_MANAGER_PATH}/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm {TMUX_PLUGIN_MANAGER_PATH}/tpm && {TMUX_PLUGIN_MANAGER_PATH}/tpm/bin/install_plugins'"
set -g @fingers-key F
run -b "${TMUX_PLUGIN_MANAGER_PATH}/tpm/tpm"
# make sure tpm is installed
if-shell "test ! -d $TMUX_PLUGIN_MANAGER_PATH/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm $TMUX_PLUGIN_MANAGER_PATH/tpm && $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins'" \
# optinally add this to install plugins on each start -- adds small lag to startup
# "run-shell $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins"
#####################
## 3. KEYBINDINGS ##
@ -76,12 +77,6 @@ set -g prefix C-a
unbind-key C-b
bind-key -r C-a send-prefix
# Pane Navigation - Vim Keys
bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R
# Window Navigation - Prefix + Vim Keys
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
@ -115,29 +110,16 @@ bind-key '-' split-window -v -c '#{pane_current_path}'
# Open a sessions chooser
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Quick-View Panes
bind-key h split-window -h 'glances'
bind-key t split-window -h 'vim ~/todo.md'
#####################
## 4. THEME ##
#####################
## theme from github.com/jimeh/tmux-themepack, the powerline/default/blue theme.
## It is integrated with prefix highlight for this tmux conf
# Status update interval
set -g status-interval 1
# Clock mode
set -g clock-mode-colour colour24
set -g clock-mode-style 24
# Sets both Prefix mode and Copy mode to be highlighted in the status bar.
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_prefix_prompt 'Command'
set -g @prefix_highlight_copy_prompt 'Copy'
# This tmux statusbar config was created by tmuxline.vim
# on Wed, 13 Mar 2019
@ -194,3 +176,5 @@ bind -T off F12 \
set -u window-status-current-style \;\
set -u window-status-current-format \;\
refresh-client -S
run -b "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"