Skip to content

Instantly share code, notes, and snippets.

@goldcoders
Last active March 31, 2022 12:39
Show Gist options
  • Save goldcoders/7bd89b5674457091efa2ed09ec66ae11 to your computer and use it in GitHub Desktop.
Save goldcoders/7bd89b5674457091efa2ed09ec66ae11 to your computer and use it in GitHub Desktop.
tmux alacritty combo
# INSTALL
# cp tmuxconf ~/.tmux.conf
#
# Set prefix key to c-a instead of default c-b
# Tmux Overried Keybinding on Alacritty
# Vim Workflow Goodness
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set-environment -g PATH "/usr/local/bin:/bin:/usr/bin:/opt/homebrew/bin"
set-option -g default-shell /bin/zsh
# if multiple clients are attached to the same window, maximize it to the
# bigger one
set-window-option -g aggressive-resize
# Start windows and pane numbering with index 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# re-number windows when one is closed
set -g renumber-windows on
# word separators for automatic word selection
setw -g word-separators ' @"=()[]_-:,.'
setw -ag word-separators "'"
# Show times longer than supposed
set -g display-panes-time 2000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# {n}vim compability
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "screen-256color"
# Split horiziontal and vertical splits, instead of % and ". We also open them
# in the same directory. Because we use widescreens nowadays, opening a
# vertical split that takes half of the screen is not worth. For vertical we
# only open 100 lines width, for horizontal it's 20 columns.
bind-key a split-window -h -c '#{pane_current_path}'
bind-key s split-window -v -c '#{pane_current_path}'
# Source file
unbind r
bind-key r command-prompt -I "#W" "rename-window '%%'"
bind t source-file ~/.tmux.conf \; display "Reloaded!"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Update default binding of `Enter` and `Space to also use copy-pipe
unbind -T copy-mode-vi Enter
unbind -T copy-mode-vi Space
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
# setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
# copy text with `y` in copy mode
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# copy text with mouse selection without pressing any key
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel
# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
set -g status-keys emacs
# focus events enabled for terminals that support them
set -g focus-events on
# Sync panes (Send input to all panes in the window). When enabled, pane
# borders become red as an indication.
bind C-s if -F '#{pane_synchronized}' \
'setw synchronize-panes off; \
setw pane-active-border-style fg=colour63,bg=default; \
setw pane-border-format " #P "' \
'setw synchronize-panes on; \
setw pane-active-border-style fg=red; \
setw pane-border-format " #P - Pane Synchronization ON "'
# Faster command sequence
set -s escape-time 0
# Have a very large history
set -g history-limit 1000000
# Mouse mode on
set -g mouse on
# Set title
set -g set-titles on
set -g set-titles-string "#T"
# Equally resize all panes
bind-key _ select-layout even-horizontal
bind-key + select-layout even-vertical
bind-key J resize-pane -D 1
bind-key K resize-pane -U 1
bind-key H resize-pane -L 1
bind-key L resize-pane -R 1
# Select panes
# NOTE(arslan): See to prevent cycling https://github.com/tmux/tmux/issues/1158
bind-key j select-pane -D
bind-key k select-pane -U
bind-key h select-pane -L
bind-key l select-pane -R
# Disable confirm before killing
bind-key x kill-pane
bind-key Q kill-window
bind-key Z kill-server
bind-key E choose-tree
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# Install the Following
# paru hack-nerd-font
# paru tmux
# paru oh-my-zsh
window:
dimensions:
columns: 500
lines: 30
position:
x: 0
y: 0
decorations: none
scrolling:
history: 10000
multiplier: 10
auto_scroll: true
tabspaces: 4
draw_bold_text_with_bright_colors: true
font:
normal:
family: "Hack Nerd Font Mono"
bold:
family: "Hack Nerd Font Mono"
style: Bold
italic:
family: "Hack Nerd Font Mono"
style: Italic
size: 5
offset:
x: 0
y: 1
use_thin_strokes: false
# Goldcoders Terminal Theme
colors:
# Default colors
primary:
background: "#2E3440"
foreground: "#D8DEE9"
# Normal colors
normal:
black: "#3B4252"
red: "#BF616A"
green: "#A3BE8C"
yellow: "#EBCB8B"
blue: "#81A1C1"
magenta: "#B48EAD"
cyan: "#88C0D0"
white: "#E5E9F0"
# Bright colors
bright:
black: "#4C566A"
red: "#BF616A"
green: "#A3BE8C"
yellow: "#EBCB8B"
blue: "#81A1C1"
magenta: "#B48EAD"
cyan: "#8FBCBB"
white: "#ECEFF4"
background_opacity: 0.95
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
selection:
semantic_escape_chars: ",?`|:\"' ()[]{}<>\t"
save_to_clipboard: true
dynamic_title: true
live_config_reload: true
# Uncomment this if we dont want tmux being activated Immediately
#shell:
# program: /bin/zsh
# args:
# - --login
# Yeah We want tmux Once we Start Alacritty
shell:
program: /bin/zsh
args:
- -l
- -c
- "tmux attach || tmux"
key_bindings:
# Command + Key Bindings
#- { key: B, mods: Alt, chars: "\x01\x06" } # Go back Last Window
#- { key: C, mods: Alt, action: Copy }
- { key: E, mods: Alt, chars: "\x01\x45" } # View Window Tree
- { key: V, mods: Alt|Shift, chars: "\x01\x5f" } # Layout Even Horizontal
- { key: H, mods: Alt, chars: "\x01\x68" } # Move Pane Left
- { key: J, mods: Alt, chars: "\x01\x6a" } # Move Pane Down
- { key: K, mods: Alt, chars: "\x01\x6b" } # Move Pane Up
- { key: L, mods: Alt, chars: "\x01\x6c" } # Move Pane Right
- { key: N, mods: Alt, chars: "\x01\x63" } # Create New Window
- { key: Q, mods: Alt, chars: "\x01\x51" } # Kill Workspace | Same as Close Tab
- { key: R, mods: Alt, chars: "\x01\x72" } # Rename Pane
- { key: T, mods: Alt, chars: "\x01\x63" } # Create New Window
- { key: W, mods: Alt, chars: "\x01\x78" } # Kill Window
- { key: Z, mods: Alt, chars: "\x01\x7a" } # Zoom Pane
## Remove since we already have super +f and hyper + f in linux and mac
#- { key: Return, mods: Alt, action: ToggleFullscreen }
## We Should remove this in all platform Since We Can Already Navigate with Alt + num
#- { key: LBracket, mods: Super, chars: "\x01\x70" } # Previous Window
#- { key: RBracket, mods: Super, chars: "\x01\x6e" } # Next Window
# Manage Tabbing
- { key: Key1, mods: Alt, chars: "\x01\x31" }
- { key: Key2, mods: Alt, chars: "\x01\x32" }
- { key: Key3, mods: Alt, chars: "\x01\x33" }
- { key: Key4, mods: Alt, chars: "\x01\x34" }
- { key: Key5, mods: Alt, chars: "\x01\x35" }
- { key: Key6, mods: Alt, chars: "\x01\x36" }
- { key: Key7, mods: Alt, chars: "\x01\x37" }
- { key: Key8, mods: Alt, chars: "\x01\x38" }
- { key: Key9, mods: Alt, chars: "\x01\x39" }
# We Should Remove this in All Platform We already have command q and super q in mac and linux
- { key: Escape, mods: Alt, action: Quit }
- { key: F4, mods: Alt, action: Quit }
# Command + Shift + Key Bindings
- { key: Return, mods: Alt, mode: ~Search, action: ToggleViMode }
# We Should modify MacOS to use CMD to sync with this
# This is much Easier to memorize and execute
- { key: S, mods: Alt, chars: "\x01\x73" } # Split Horizontal Pane
- { key: V, mods: Alt, chars: "\x01\x61" } # Split Vertical Pane
- { key: X, mods: Alt|Shift, chars: "\x01\x7b" } # Move Current Pane Left
- { key: X, mods: Alt, chars: "\x01\x7d" } # Move Current Pane Right
- { key: S, mods: Alt|Shift, chars: "\x01\x2b" } # Even Layout Horizontal
- { key: H, mods: Alt|Shift, chars: "\x01\x48" } # Decrease Pane Horizontal
- { key: J, mods: Alt|Shift, chars: "\x01\x4a" } # Decrease Pane Vertical
- { key: K, mods: Alt|Shift, chars: "\x01\x4b" } # Increase Pane Vertical
- { key: L, mods: Alt|Shift, chars: "\x01\x4c" } # Increase Pane Horizontal
- { key: R, mods: Alt|Shift, chars: "\x01\x74" } # Reload Tmux Config
- { key: W, mods: Alt|Shift, chars: "\x01\x5a" } # Tmux Kill Server
# END Keybindings
# Install the Following
# brew tap homebrew/cask-fonts
# brew cask install font-hack-nerd-font
# brew install tmux
# brew install oh-my-zsh
window:
dimensions:
columns: 500
lines: 30
position:
x: 0
y: 0
decorations: none
scrolling:
history: 10000
multiplier: 10
auto_scroll: true
tabspaces: 4
draw_bold_text_with_bright_colors: true
font:
normal:
family: "Hack Nerd Font Mono"
bold:
family: "Hack Nerd Font Mono"
style: Bold
italic:
family: "Hack Nerd Font Mono"
style: Italic
size: 12.0
use_thin_strokes: true
# Goldcoders Terminal Theme
colors:
# Default colors
primary:
background: "#2E3440"
foreground: "#D8DEE9"
# Normal colors
normal:
black: "#3B4252"
red: "#BF616A"
green: "#A3BE8C"
yellow: "#EBCB8B"
blue: "#81A1C1"
magenta: "#B48EAD"
cyan: "#88C0D0"
white: "#E5E9F0"
# Bright colors
bright:
black: "#4C566A"
red: "#BF616A"
green: "#A3BE8C"
yellow: "#EBCB8B"
blue: "#81A1C1"
magenta: "#B48EAD"
cyan: "#8FBCBB"
white: "#ECEFF4"
background_opacity: 0.95
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
selection:
semantic_escape_chars: ",?`|:\"' ()[]{}<>\t"
save_to_clipboard: true
dynamic_title: true
live_config_reload: true
# Uncomment this if we dont want tmux being activated Immediately
#shell:
# program: /bin/zsh
# args:
# - --login
# Yeah We want tmux Once we Start Alacritty
shell:
program: /bin/zsh
args:
- -l
- -c
- "tmux attach || tmux"
key_bindings:
# Command + Key Bindings
- { key: E, mods: Command, chars: "\x01\x45" } # View Window Tree
- { key: V, mods: Command|Shift, chars: "\x01\x5f" } # Layout Even Horizontal
- { key: H, mods: Command, chars: "\x01\x68" } # Move Pane Left
- { key: I, mods: Command, chars: "\x01\x49" } # Move Pane Left
- { key: J, mods: Command, chars: "\x01\x6a" } # Move Pane Down
- { key: K, mods: Command, chars: "\x01\x6b" } # Move Pane Up
- { key: L, mods: Command, chars: "\x01\x6c" } # Move Pane Right
- { key: N, mods: Command, chars: "\x01\x63" } # Create New Window
- { key: Q, mods: Command, chars: "\x01\x51" } # Kill Pane
- { key: R, mods: Command, chars: "\x01\x72" } # Rename Pane
- { key: T, mods: Command, chars: "\x01\x63" } # Create New Window
- { key: W, mods: Command, chars: "\x01\x78" } # Kill Window
- { key: Z, mods: Command, chars: "\x01\x7a" } # Zoom Pane
- { key: F12, mods: Shift, action: PasteSelection } # Shift Insert Paste Like in Linux
- { key: F, mods: Command, action: ToggleSimpleFullscreen }
#- { key: LBracket, mods: Command, chars: "\x01\x70" } # Previous Window
#- { key: RBracket, mods: Command, chars: "\x01\x6e" } # Next Window
# Manage Tabbing
- { key: Key1, mods: Command, chars: "\x01\x31" }
- { key: Key2, mods: Command, chars: "\x01\x32" }
- { key: Key3, mods: Command, chars: "\x01\x33" }
- { key: Key4, mods: Command, chars: "\x01\x34" }
- { key: Key5, mods: Command, chars: "\x01\x35" }
- { key: Key6, mods: Command, chars: "\x01\x36" }
- { key: Key7, mods: Command, chars: "\x01\x37" }
- { key: Key8, mods: Command, chars: "\x01\x38" }
- { key: Key9, mods: Command, chars: "\x01\x39" }
- { key: Escape, mods: Command, action: Quit }
# Command + Shift + Key Bindings
- { key: Return, mods: Command, chars: "\x01\x5b" } # Tmux Vi Mode
- { key: Return, mods: Command|Shift, mode: ~Search, action: ToggleViMode } # Alacritty Vi Mode
- { key: S, mods: Command, chars: "\x01\x73" } # Split Horizontal Pane
- { key: V, mods: Command, chars: "\x01\x61" } # Split Vertical Pane
- { key: X, mods: Command|Shift, chars: "\x01\x7b" } # Move Current Pane Left
- { key: X, mods: Command, chars: "\x01\x7d" } # Move Current Pane Right
- { key: S, mods: Command|Shift, chars: "\x01\x2b" } # Even Layout Horizontal
- { key: H, mods: Command|Shift, chars: "\x01\x48" } # Decrease Pane Horizontal
- { key: J, mods: Command|Shift, chars: "\x01\x4a" } # Decrease Pane Vertical
- { key: K, mods: Command|Shift, chars: "\x01\x4b" } # Increase Pane Vertical
- { key: L, mods: Command|Shift, chars: "\x01\x4c" } # Increase Pane Horizontal
- { key: R, mods: Command|Shift, chars: "\x01\x74" } # Reload Tmux Config
- { key: W, mods: Command|Shift, chars: "\x01\x5a" } # Tmux Kill Server
# END Keybindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment