Trying out Alacritty; adjust tmux key bindings

Third time's the charm -- finally got Alacritty configured to a minimal
usable state. Font is displayed differently which will take some getting
used to.

Also adjusted the tmux keybindings, added in descriptions, and generally
just made things clearer. Apparently I was still using the default
bindings for switching panes and just mapping the iTerm2 shortcut to
it, so I brought those more in line with the cmd-<key> bindings for
easier translation.
This commit is contained in:
punkfairie 2024-02-05 22:00:46 -08:00
parent e244dc4bb0
commit b217f4051d
No known key found for this signature in database
GPG key ID: 0858B0F48128A755
4 changed files with 171 additions and 19 deletions

View file

@ -0,0 +1,56 @@
# vim:set ft=toml :
import = [
'~/dotfiles/alacritty/catppuccin-mocha.toml'
]
[env]
TERM = 'alacritty'
[window]
dynamic_padding = true
decorations_theme_variant = 'Dark'
option_as_alt = 'OnlyLeft'
[font]
normal = { family = 'FiraCode Nerd Font', style = 'Regular' }
size = 14
[cursor]
style = { shape = 'Underline', blinking = 'Off' }
[keyboard]
bindings = [
## TMUX BINDINGS ##
# Split panes.
{ key = '-', mods = 'Command', chars = "\u0001\u002D" },
{ key = '\', mods = 'Command|Shift', chars = "\u0001\u007C" },
{ key = '\', mods = 'Command', chars = "\u0001\u005C" },
# Switch panes.
{ key = 'h', mods = 'Command', chars = "\u0001\u0068" },
{ key = 'j', mods = 'Command', chars = "\u0001\u006A" },
{ key = 'k', mods = 'Command', chars = "\u0001\u006B" },
{ key = 'l', mods = 'Command', chars = "\u0001\u006C" },
# Resize panes.
{ key = 'h', mods = 'Command|Alt', chars = "\u0001\u001B\u0068" },
{ key = 'j', mods = 'Command|Alt', chars = "\u0001\u001B\u006A" },
{ key = 'k', mods = 'Command|Alt', chars = "\u0001\u001B\u006B" },
{ key = 'l', mods = 'Command|Alt', chars = "\u0001\u001B\u006C" },
# Close panes.
{ key = 'x', mods = 'Command', chars = "\u0001\u0078" },
# Switch windows.
{ key = 'h', mods = 'Command|Control', chars = "\u0001\u001B\u005B\u0043" },
{ key = 'l', mods = 'Command|Control', chars = "\u0001\u001B\u005B\u0044" },
# Install plugins.
{ key = 'i', mods = 'Command|Shift', chars = "\u0001\u0049" },
# Reload config.
{ key = 'r', mods = 'Command', chars = "\u0001\u0072"},
]

View file

@ -0,0 +1,75 @@
[colors.primary]
background = "#1E1E2E"
foreground = "#CDD6F4"
dim_foreground = "#CDD6F4"
bright_foreground = "#CDD6F4"
[colors.cursor]
text = "#1E1E2E"
cursor = "#F5E0DC"
[colors.vi_mode_cursor]
text = "#1E1E2E"
cursor = "#B4BEFE"
[colors.search.matches]
foreground = "#1E1E2E"
background = "#A6ADC8"
[colors.search.focused_match]
foreground = "#1E1E2E"
background = "#A6E3A1"
[colors.footer_bar]
foreground = "#1E1E2E"
background = "#A6ADC8"
[colors.hints.start]
foreground = "#1E1E2E"
background = "#F9E2AF"
[colors.hints.end]
foreground = "#1E1E2E"
background = "#A6ADC8"
[colors.selection]
text = "#1E1E2E"
background = "#F5E0DC"
[colors.normal]
black = "#45475A"
red = "#F38BA8"
green = "#A6E3A1"
yellow = "#F9E2AF"
blue = "#89B4FA"
magenta = "#F5C2E7"
cyan = "#94E2D5"
white = "#BAC2DE"
[colors.bright]
black = "#585B70"
red = "#F38BA8"
green = "#A6E3A1"
yellow = "#F9E2AF"
blue = "#89B4FA"
magenta = "#F5C2E7"
cyan = "#94E2D5"
white = "#A6ADC8"
[colors.dim]
black = "#45475A"
red = "#F38BA8"
green = "#A6E3A1"
yellow = "#F9E2AF"
blue = "#89B4FA"
magenta = "#F5C2E7"
cyan = "#94E2D5"
white = "#BAC2DE"
[[colors.indexed_colors]]
index = 16
color = "#FAB387"
[[colors.indexed_colors]]
index = 17
color = "#F5E0DC"

View file

@ -2984,6 +2984,17 @@
<key>Version</key>
<integer>1</integer>
</dict>
<key>0x5c-0x100000-0x2a</key>
<dict>
<key>Action</key>
<integer>11</integer>
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x5C</string>
<key>Version</key>
<integer>1</integer>
</dict>
<key>0x68-0x100000-0x4</key>
<dict>
<key>Action</key>
@ -2991,7 +3002,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x1B 0x5B 0x44</string>
<string>0x01 0x68</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3002,7 +3013,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x70</string>
<string>0x01 0x1B 0x5B 0x43</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3013,7 +3024,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x68</string>
<string>0x01 0x1B 0x68</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3035,7 +3046,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x1B 0x5B 0x42</string>
<string>0x01 0x6A</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3046,7 +3057,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x6A</string>
<string>0x01 0x1B 0x6A</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3057,7 +3068,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x1B 0x5B 0x41</string>
<string>0x01 0x6B</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3068,7 +3079,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x6B</string>
<string>0x01 0x1B 0x6B</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3079,7 +3090,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x1B 0x5B 0x43</string>
<string>0x01 0x6C</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3090,7 +3101,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x6E</string>
<string>0x01 0x1B 0x5B 0x44</string>
<key>Version</key>
<integer>1</integer>
</dict>
@ -3101,7 +3112,7 @@
<key>Label</key>
<string></string>
<key>Text</key>
<string>0x01 0x6C</string>
<string>0x01 0x1B 0x6C</string>
<key>Version</key>
<integer>1</integer>
</dict>

View file

@ -34,30 +34,40 @@ bind C-a send-prefix
# Vi copy mode.
setw -g mode-keys vi
unbind [
bind Escape copy-mode
bind -N 'Enter normal (copy) mode' Escape copy-mode # cmd-esc on macOS
unbind p
bind p paste-buffer
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Better split commands.
bind | split-window -h -c "#{pane_current_path}" # cmd-| in iTerm2
bind - split-window -v -c "#{pane_current_path}" # cmd-- in iTerm2
bind -N 'vsplit' | split-window -h -c "#{pane_current_path}" # cmd-| on macOS
bind -N 'vsplit' \\ split-window -h -c "#{pane_current_path}" # cmd-\ on macOS
bind -N 'hsplit' - split-window -v -c "#{pane_current_path}" # cmd-- on macOS
unbind '"'
unbind %
# Vi-like pane switching.
bind -N 'Switch to pane (left)' h select-pane -L # cmd-h on macOS
bind -N 'Switch to pane (down)' j select-pane -D # cmd-j on macOS
bind -N 'Switch to pane (up)' k select-pane -U # cmd-k on macOS
bind -N 'Switch to pane (right)' l select-pane -R # cmd-l on macOS
# Vi-like resizing.
bind j resize-pane -D # cmd-j in iTerm2
bind k resize-pane -U # cmd-k in iTerm2
bind h resize-pane -L # cmd-h in iTerm2
bind l resize-pane -R # cmd-l in iTerm2
bind -N 'Resize pane (left)' M-h resize-pane -L # cmd-opt-h on macOS
bind -N 'Resize pane (down)' M-j resize-pane -D # cmd-opt-j on macOS
bind -N 'Resize pane (up)' M-k resize-pane -U # cmd-opt-k on macOS
bind -N 'Resize pane (right)' M-l resize-pane -R # cmd-opt-l on macOS
bind -N 'Previous window' Left previous-window # cmd-left on macOS
bind -N 'Next window' Right next-window # cmd-right on macOS
# Easy reload config.
bind r source-file ~/.tmux.conf
bind r source-file ~/.tmux.conf # cmd-r on macOS
# Popup.
unbind i
bind i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i in iTerm2
bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i on macOS
detach-client
} {
if-shell "tmux has-session -t scratch" {