dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.tmux.conf

202 lines
8.9 KiB
Plaintext

# TERM
set -g default-terminal tmux-256color
# set -ga terminal-overrides ",xterm-termite:Tc,xterm-256color:Tc"
# set -ga terminal-overrides ",*col*:Tc"
# set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
# Opciones basicas
setw -gq utf8 on
set -g set-clipboard on
set -g mouse on
set -gq status-utf8 on
set -g escape-time 0
set -g history-limit 102400
# Ventanas
setw -g automatic-rename on
set -g renumber-windows on
set -g allow-rename on
set -g base-index 1
# Panes
setw -g pane-base-index 1
setw -g aggressive-resize on
# Notificaciones
set -g monitor-activity on
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
set -g bell-action none
# Vi
set -g mode-keys vi
set -g status-keys vi
# Statusbar
setw -g pane-border-status bottom
setw -g pane-border-format '─'
setw -g automatic-rename-format "#{s/zsh//:pane_current_command}"
setw -g pane-border-style 'fg=#080808'
setw -g pane-active-border-style 'fg=#080808'
set -g set-titles on
set -g status-interval 10
set -g mode-style fg=black,bg=yellow
set -g message-command-style bg=colour0,fg=colour13
set -g message-style bg=default,fg=default
set -g status-style bg=default,fg=colour7
set -g set-titles-string "#T"
set -g status-left ''
set -g status-right '#(txbar) #[fg=colour134]%a %d #[fg=colour167]%R #[fg=colour10]#S:#[fg=colour14]#I.#P'
set -g window-status-separator ' '
set -g window-status-current-style fg=colour3
set -g window-status-activity-style fg=colour15,italics
set -g window-status-format "#{=-15:?window_name,#{window_name},#{s/deadguy/home/:?pane_current_path,#{b:pane_current_path},}}"
set -g window-status-current-format "#{=-15:?window_name,#{window_name},#{s/deadguy/home/:?pane_current_path,#{b:pane_current_path},}}"
# Limpiar atajos
unbind-key -a
unbind-key C-b
unbind-key space
unbind-key '"'
unbind-key %
# Prefijo
set -g prefix M-a
bind-key M-a send-prefix
# Varios
bind-key ? list-keys
bind-key D detach-client
bind-key : command-prompt
bind-key R respawn-window
bind-key T command-prompt 'rename-window %%'
bind-key S command-prompt 'rename-session %%'
bind-key r source-file $HOME/.tmux.conf \; display "Config Reloaded"
# Redimensionar usando shift+vimkeys con prefijo
bind-key -r H resize-pane -L 2
bind-key -r L resize-pane -R 2
bind-key -r K resize-pane -U 2
bind-key -r J resize-pane -D 2
bind-key * resize-pane -Z
# Trocar panes
bind-key < swap-pane -U
bind-key > swap-pane -D
# Dividir
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
bind-key / split-window -fh -c "#{pane_current_path}"
bind-key _ split-window -fv -c "#{pane_current_path}"
bind-key = select-layout even-vertical
# Cerrar
bind-key x kill-pane
bind-key X kill-window
bind-key Z kill-session
bind-key Q kill-server
# Ventanas
bind-key -r C-h prev
bind-key -r C-l next
bind-key -n M-< swap-window -t -1
bind-key -n M-> swap-window -t +1
bind-key Enter new-window
bind-key Tab choose-window
bind-key d display-panes
bind-key w choose-tree -Zw "swap-window -t '%%'"
bind-key s choose-tree -Zw "swap-pane -t '%%'"
bind-key m choose-tree -Zw "move-pane -t '%%'"
# Copy/paste. Seleccionar texto con el mouse lo copia automaticamente al clipboard
bind-key [ copy-mode
bind-key ] paste-buffer
bind-key b list-buffers
bind-key p paste-buffer
bind-key P choose-buffer
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i -p -b"
bind-key -n M-S-v run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# Prender y apagar statusbar
bind-key & set-option -g status
# Intelligently navigate tmux panes and Vim splits using the same keys.
# See https://sunaku.github.io/tmux-select-pane.html for documentation.
#
# +-------------+------------+-----------------------------+
# | inside Vim? | is Zoomed? | Action taken by key binding |
# +-------------+------------+-----------------------------+
# | No | No | Focus directional tmux pane |
# | No | Yes | Nothing: ignore key binding |
# | Yes | No | Seamlessly focus Vim / tmux |
# | Yes | Yes | Focus directional Vim split |
# +-------------+------------+-----------------------------+
# number of seconds we give Vim to navigate
vim_navigation_timeout=0.1
navigate=' \
pane_is_zoomed() { \
test #{window_zoomed_flag} -eq 1; \
}; \
pane_title_changed() { \
test "#{pane_title}" != "$(tmux display -p "##{pane_title}")"; \
}; \
command_is_vim() { \
case "${1%% *}" in \
(vi|?vi|vim*|?vim*|view|?view|vi??*) true ;; \
(*) false ;; \
esac; \
}; \
pane_contains_vim() { \
case "#{=3:pane_current_command}" in \
(ssh|sh) command_is_vim "#{=5:pane_title}" ;; \
(*) command_is_vim "#{=5:pane_current_command}" ;; \
esac; \
}; \
pane_contains_neovim_terminal() { \
test "#{=12:pane_title}" = "nvim term://"; \
}; \
navigate() { \
tmux_navigation_command=$1; \
vim_navigation_command=$2; \
vim_navigation_only_if=${3:-true}; \
if pane_contains_vim && eval "$vim_navigation_only_if"; then \
if pane_contains_neovim_terminal; then \
tmux send-keys C-\\ C-n; \
fi; \
eval "$vim_navigation_command"; \
if ! pane_is_zoomed; then \
sleep $vim_navigation_timeout; : wait for Vim to change title; \
if ! pane_title_changed; then \
eval "$tmux_navigation_command"; \
fi; \
fi; \
elif ! pane_is_zoomed; then \
eval "$tmux_navigation_command"; \
fi; \
}; \
navigate '
navigate_left=" $navigate 'tmux select-pane -L' 'tmux send-keys C-w h'"
navigate_down=" $navigate 'tmux select-pane -D' 'tmux send-keys C-w j'"
navigate_up=" $navigate 'tmux select-pane -U' 'tmux send-keys C-w k'"
navigate_right="$navigate 'tmux select-pane -R' 'tmux send-keys C-w l'"
navigate_back=" $navigate 'tmux select-pane -l || tmux select-pane -t1'\
'tmux send-keys C-w p' \
'pane_is_zoomed' "
bind-key -n M-h run-shell -b "$navigate_left"
bind-key -n M-j run-shell -b "$navigate_down"
bind-key -n M-k run-shell -b "$navigate_up"
bind-key -n M-l run-shell -b "$navigate_right"
bind-key -n M-\\ run-shell -b "$navigate_back"
# Mejor soporte para mouse
set -g @prevent-scroll-for-fullscreen-alternate-buffer 'on'
set -g @scroll-speed-num-lines-per-scroll '3'
run-shell ~/.local/bin/tmux-better-mouse-mode/scroll_copy_mode.tmux
# vim: set ft=tmux: