Skip to content

Instantly share code, notes, and snippets.

@m99coder
Last active March 27, 2023 19:16
Show Gist options
  • Save m99coder/9a6c44c6e1dec5d0c71c0bf0e9617124 to your computer and use it in GitHub Desktop.
Save m99coder/9a6c44c6e1dec5d0c71c0bf0e9617124 to your computer and use it in GitHub Desktop.
Alacritty + tmux
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Full config: https://github.com/alacritty/alacritty/blob/master/alacritty.yml
env:
TERM: xterm-256color
window:
padding:
x: 8
y: 8
dynamic_padding: false
decorations: buttonless
#option_as_alt: Both
scrolling:
history: 10000
font:
normal:
#family: monospace
#family: MesloLGS NF
#family: Hack Nerd Font Mono
family: FiraCode Nerd Font
style: Regular
bold:
#family: monospace
#family: MesloLGS NF
#family: Hack Nerd Font Mono
family: FiraCode Nerd Font
style: Bold
italic:
#family: monospace
#family: MesloLGS NF
#family: Hack Nerd Font Mono
family: FiraCode Nerd Font
style: Italic
bold_italic:
#family: monospace
#family: MesloLGS NF
#family: Hack Nerd Font Mono
family: FiraCode Nerd Font
style: Bold Italic
size: 14.0
# See: https://github.com/alacritty/alacritty/issues/1635
#use_thin_strokes: true
# See: https://github.com/alacritty/alacritty/issues/4616#issuecomment-1236413444
# defaults write -g AppleFontSmoothing -int 0
# If `true`, bold text is drawn using the bright color variants.
draw_bold_text_with_bright_colors: true
# Live config reload (changes require restart)
live_config_reload: true
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: false
mouse:
# Clickable URLs
hints:
launcher:
program: open
modifiers: Command
# Colors
# Monokai Pro: https://github.com/rockiedo/monokai-pro-alacritty
# Gruvbox Dark: https://github.com/eendroroy/alacritty-theme/blob/master/themes/gruvbox_dark.yaml
# Gruvbox Material: https://github.com/eendroroy/alacritty-theme/blob/master/themes/gruvbox_material.yml
# Afterglow: https://github.com/eendroroy/alacritty-theme/blob/master/themes/afterglow.yaml
# Monokai Remastered: https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/alacritty/Monokai%20Remastered.yml
# Sonokai: https://gist.github.com/sainnhe/e5c4512d5bcfcb46afd493beb86223c6
#colors:
# primary:
# background: "0x2c2e34"
# foreground: "0xe2e2e3"
#
# normal:
# black: "0x181819"
# red: "0xfc5d7c"
# green: "0x9ed072"
# yellow: "0xe7c664"
# blue: "0x76cce0"
# magenta: "0xb39df3"
# cyan: "0xf39660"
# white: "0xe2e2e3"
#
# bright:
# black: "0x7f8490"
# red: "0xfc5d7c"
# green: "0x9ed072"
# yellow: "0xe7c664"
# blue: "0x76cce0"
# magenta: "0xb39df3"
# cyan: "0xf39660"
# white: "0xe2e2e3"
colors:
# Default colors
primary:
# hard contrast: background = '0x1d2021'
background: '0x282828'
# soft contrast: background = '0x32302f'
foreground: '0xebdbb2'
# Normal colors
normal:
black: '0x282828'
red: '0xcc241d'
green: '0x98971a'
yellow: '0xd79921'
blue: '0x458588'
magenta: '0xb16286'
cyan: '0x689d6a'
white: '0xa89984'
# Bright colors
bright:
black: '0x928374'
red: '0xfb4934'
green: '0xb8bb26'
yellow: '0xfabd2f'
blue: '0x83a598'
magenta: '0xd3869b'
cyan: '0x8ec07c'
white: '0xebdbb2'
# instantely start a tmux session
shell:
program: /usr/local/bin/tmux
args:
- new-session
- -A
- -D
# https://www.joshmedeski.com/posts/macos-keyboard-shortcuts-for-tmux/
# https://arslan.io/2018/02/05/gpu-accelerated-terminal-alacritty/
key_bindings:
# \x02 is CTRL+B
# \x22 is " split the current pane into two, top and bottom
# \x25 is % split the current pane into two, left and right
# \x26 is & kill the current window (see \x78)
# \x30 is 0 ... \x39 is 9 select window 0 to 9
# \x48 is <up> change to the pane above of the current pane
# \x4b is <left> change to the pane to the left of the current pane
# \x4d is <right> change to the pane to the right of the current pane
# \x50 is <down> change to the pane below of the current pane
# \x63 is c create a new window
# \x6e is n change to the next window
# \x6f is o select the next pane in the current window
# \x70 is p change to the previous window
# \x78 is x kill the current pane (and window if last pane)
# \x7a is z toggle zoom state of the current pane
- { key: N, mods: Command, chars: "\x02\x22" }
- { key: N, mods: Command|Shift, chars: "\x02\x25" }
- { key: Key0, mods: Command, chars: "\x02\x30" }
- { key: Key1, mods: Command, chars: "\x02\x31" }
- { key: Key2, mods: Command, chars: "\x02\x32" }
- { key: Key3, mods: Command, chars: "\x02\x33" }
- { key: Key4, mods: Command, chars: "\x02\x34" }
- { key: Key5, mods: Command, chars: "\x02\x35" }
- { key: Key6, mods: Command, chars: "\x02\x36" }
- { key: Key7, mods: Command, chars: "\x02\x37" }
- { key: Key8, mods: Command, chars: "\x02\x38" }
- { key: Key9, mods: Command, chars: "\x02\x39" }
#- { key: Up, mods: Command, chars: "\x02\x1b5b41" }
#- { key: Left, mods: Command, chars: "\x02\x1b5b44" }
#- { key: Right, mods: Command, chars: "\x02\x1b5b43" }
#- { key: Down, mods: Command, chars: "\x02\x1b5b42" }
- { key: T, mods: Command, chars: "\x02\x63" }
- { key: O, mods: Command, chars: "\x02\x6f" }
- { key: W, mods: Command, chars: "\x02\x78" }
- { key: Z, mods: Command, chars: "\x02\x7a" }
# set status bar to the top (default is bottom)
set-option -g status-position top
# disable confirm before killing
bind-key x kill-pane
# enable mouse scrolling
set -g mouse on
# sane scrolling
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e; send-keys -M'"
# for copying text with the mouse you need to hold the [Shift] key while marking
# see: https://appuals.com/stuck-in-tmux-scroll-up/
# [Ctrl-Space] to zoom current pane
# see: https://sgeb.io/posts/tmux-zoom-panes/
bind-key -n C-Space resize-pane -Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment