Last active
August 8, 2023 03:14
-
-
Save naranyala/d8f7baddd08e45addf02825a939a6cb5 to your computer and use it in GitHub Desktop.
focus-mode-tmux-config, the only one tmux config you need
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# focus-mode tmux-config (github.com/naranyala) | |
## remote work first, desktop and mobile (termux) | |
## seamless neovim integration | |
## best possible keymap productivity | |
set -gq status-utf8 on | |
set -g escape-time 0 | |
set -g default-terminal "screen-256color" | |
set -ga terminal-overrides "xterm-256color" | |
unbind r | |
unbind s | |
unbind p | |
bind r source-file ~/.tmux.conf \; display-message "[TMUX] config reloaded ..."; | |
bind s choose-session | |
bind p paste-buffer | |
setw -g mode-keys vi | |
set -g set-clipboard on | |
set-option -g mouse on | |
set-option -s set-clipboard off | |
set-option -g allow-rename off | |
set-option -g renumber-windows on | |
set-option -g display-time 3000 | |
set-option -s extended-keys always | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
# make window/pane index start with 1 | |
set -g base-index 1 | |
setw -g pane-base-index 1 | |
setw -g aggressive-resize on | |
set -g focus-events on | |
# status bar | |
set -g status-interval 60 | |
setw -g history-limit 10000 | |
set -g repeat-time 1000 | |
set-option -g status-interval 1 | |
set-option -g automatic-rename-format '#{b:pane_current_command}' | |
# set-window-option -g automatic-rename | |
# silent mode | |
set-option -g visual-activity off | |
set-option -g visual-bell off | |
set-option -g visual-silence off | |
set-window-option -g monitor-activity off | |
set-option -g bell-action none | |
# Mouse | |
# set-option -g mode-mouse on | |
# set-option -g mouse-resize-pane on | |
# set-option -g mouse-select-pane on | |
# set-option -g mouse-select-window on | |
unbind -T copy-mode-vi Enter | |
bind-key -T copy-mode-vi v send-keys -X begin-selection | |
bind-key -T copy-mode-vi y send-keys -X rectangle-toggle | |
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i' | |
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i' | |
# Copy & Paste | |
# bind-key -T copy-mode-vi v send -X begin-selection | |
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" | |
# bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" | |
# bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy" | |
# Enable mouse & Copy/Paste - Requirements: xclip | |
# set -g mouse on | |
# bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
# bind -n WheelDownPane select-pane -t= \; send-keys -M | |
# bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M | |
# bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up | |
# bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down | |
# bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up | |
# bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down | |
# # # Use vim keybindings in copy mode | |
# setw -g mode-keys vi | |
# # Update default binding of `Enter` to also use copy-pipe | |
# unbind -T copy-mode-vi Enter | |
# bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c" | |
# bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" | |
# # v in copy mode starts making selection | |
# bind-key -T copy-mode-vi v send-keys -X begin-selection | |
# bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle | |
# bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel | |
# # Escape turns on copy mode | |
# bind Escape copy-mode | |
# set -g prefix C-s | |
set -g prefix C-Space | |
# copy/paste buffer | |
bind c run "tmux save-buffer - | xclip -i -sel clipboard" | |
bind v run "tmux set-buffer 'xclip -o -sel clipboard'; tmux paste-buffer" | |
# new window in session | |
unbind c | |
bind n new-window -c "#{pane_current_path}" | |
# window-split horizontal/vertical (one-keystroke only) | |
unbind '"' | |
unbind '%' | |
bind-key "-" split-window -v -c "#{pane_current_path}" | |
bind-key "|" split-window -h -c "#{pane_current_path}" | |
# active-window swap order | |
bind-key "[" swap-window -t -1\; select-window -t -1 | |
bind-key "]" swap-window -t +1\; select-window -t +1 | |
# Alt + Arrow to switch session/window | |
bind -n M-Left previous-window | |
bind -n M-Right next-window | |
bind -n M-Up switch-client -p | |
bind -n M-Down switch-client -n | |
unbind p | |
bind p paste-buffer | |
# switch windows alt+number | |
bind-key -n M-1 select-window -t 1 | |
bind-key -n M-2 select-window -t 2 | |
bind-key -n M-3 select-window -t 3 | |
bind-key -n M-4 select-window -t 4 | |
bind-key -n M-5 select-window -t 5 | |
bind-key -n M-6 select-window -t 6 | |
bind-key -n M-7 select-window -t 7 | |
bind-key -n M-8 select-window -t 8 | |
bind-key -n M-9 select-window -t 9 | |
# Use Alt-arrow keys without prefix key to switch panes | |
bind -n C-Left select-pane -L | |
bind -n C-Right select-pane -R | |
bind -n C-Up select-pane -U | |
bind -n C-Down select-pane -D | |
# navigate between panes inside window | |
bind-key h select-pane -L | |
bind-key j select-pane -D | |
bind-key k select-pane -U | |
bind-key l select-pane -R | |
# resize active pane in window | |
bind-key -r Left resize-pane -L | |
bind-key -r Down resize-pane -D | |
bind-key -r Up resize-pane -U | |
bind-key -r Right resize-pane -R | |
# just type what you need | |
unbind w | |
unbind x | |
unbind u | |
# bind-key N command-prompt -p "[TMUX] Create new session with name: " "run-shell 'new-session -A -s %%'" | |
bind-key N command-prompt -p "[TMUX] Create new session with name: " "new-session -A -s %%" | |
bind-key R command-prompt -p "[TMUX] Rename session X into Y: " "run-shell 'tmux rename-session -t %%'" | |
bind-key K command-prompt -p "[TMUX] Kill session with session-name: " "run-shell 'tmux kill-session -t %%'" | |
bind-key X command-prompt -p "[TMUX] Kill window with window-id: " "run-shell 'tmux kill-window -t %%'" | |
bind-key x command-prompt -p "[TMUX] Kill pane with pane-id: " "run-shell 'tmux kill-pane -t %%'" | |
# bind-key w command-prompt -p "[TMUX] Switch this window into index: " "run-shell 'tmux move-window -t %%'" | |
# view session alphabetically | |
bind s choose-tree -s -O name | |
# Set a larger scroll back | |
set-option -g history-limit 100000 | |
# bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt | |
set -g detach-on-destroy off # don't exit from tmux when closing a session | |
# statusbar style | |
set -g status on | |
set -g status-position top | |
# set -g status-position bottom | |
set -g status-justify right | |
# set -g status-justify centre | |
set -g pane-border-style fg=green | |
set -g pane-active-border-style fg=green | |
set -g status-left-length 100 | |
set -g status-left-style default | |
set -g status-right-length 100 | |
set -g status-right-style default | |
set-option -g status-bg default | |
set-option -g display-panes-active-colour green | |
set-option -g display-panes-colour lightgreen | |
set -g status-style fg=white,bold,bg=colour235 | |
set -g message-style fg=black,bold,bg=lightgreen | |
setw -g window-status-style fg=lightgreen,bg=colour235 | |
setw -g window-status-current-style fg=black,bold,bg=lightgreen | |
set -g window-status-last-style fg=lightgreen,bold | |
# set-window-option -g status-left " <#S> " | |
set-window-option -g status-right "" | |
set-window-option -g status-left " #S " | |
set-window-option -g window-status-format " (#I) #W " | |
set-window-option -g window-status-current-format " (#I) #W " | |
set -g status-interval 60 | |
set -g status-left-length 30 | |
set -g status-left '#[fg=lightgreen]#(whoami) @ #S' | |
# set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]' | |
# others | |
set-option -g clock-mode-style 24 | |
set-window-option -g clock-mode-colour lightgreen #green | |
set -g lock-after-time 300 | |
set -g lock-command 'cmatrix -abs' | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-yank' | |
set -g @plugin 'aserowy/tmux.nvim' | |
set -g @plugin 'nhdaly/tmux-better-mouse-mode' | |
set -g @plugin 'joshmedeski/t-smart-tmux-session-manager' | |
# set -g @plugin 'ofirgall/tmux-window-name' | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
set -g @plugin 'tmux-plugins/tmux-continuum' | |
# set -g @plugin 'ofirgall/tmux-browser' | |
set -g @plugin 'laktak/extrakto' | |
# set -g @plugin 'erikw/tmux-powerline' | |
set -g @plugin 'christoomey/vim-tmux-navigator' | |
# set -g @plugin 'jaclu/tmux-menus' | |
# alternative themes (choose one) | |
# set -g @plugin 'dracula/tmux' | |
# set -g @plugin 'catppuccin/tmux' | |
# set -g @catppuccin_flavour 'latte' # or frappe, macchiato, mocha | |
# set -g @plugin 'dreamsofcode-io/catppuccin-tmux' | |
# run -b '~/.tmux/plugins/tpm/tpm' | |
# plugins config | |
# set -g @browser_close_on_deattach '1' | |
# set -g @browser_launch_on_attach '1' | |
## Restore Vim sessions | |
set -g @resurrect-strategy-vim 'session' | |
## Restore Neovim sessions | |
set -g @resurrect-strategy-nvim 'session' | |
## Restore Panes | |
set -g @resurrect-capture-pane-contents 'on' | |
## Restore last saved environment (automatically) | |
# set -g @continuum-restore 'on' | |
# set -g @continuum-boot 'on' | |
# Last saved environment is automatically restored when tmux is started. | |
set -g @continuum-boot 'on' | |
# terminal window will go fullscreen | |
set -g @continuum-boot-options 'fullscreen' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
# run-shell "mkdir -p ~/.tmux/plugins/" | |
# run-shell "git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm" | |
run '~/.tmux/plugins/tpm/tpm' | |
# Hit prefix + I to install plugins for the first time. | |
# It takes few seconds. So, wait before panic. | |
# | |
# resurrect key bindings: | |
# prefix + Ctrl-s - save | |
# prefix + Ctrl-r - restore | |
# to reload: <prefix> + r | |
# to install plugins: <prefix> + I | |
# to select pane: <prefix> + q ; and choose number | |
# to zoom in/out pane in window: <prefix> + z | |
# to show session list: <prefix> + s | |
# to show session tree: <prefix> + w | |
# to create new pane inside window: "<prefix> + -" or "<prefix> + \" | |
# to create new window inside session: <prefix> + n | |
# to create new session: <prefix> + N | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment