Skip to content

Instantly share code, notes, and snippets.

@mhausenblas
Last active February 19, 2021 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhausenblas/0fae2e0d4cffe18ae65859d00e037d5b to your computer and use it in GitHub Desktop.
Save mhausenblas/0fae2e0d4cffe18ae65859d00e037d5b to your computer and use it in GitHub Desktop.
My tAF setup
# Use `tmux` to launch or `tmux attach` if already running
# First install https://github.com/tmux-plugins/tpm and then
# TRIGGER + I for the plugins. Below works for tmux 2.3.
# Change TRIGGER
unbind C-b
set -g prefix F11
bind F11 send-prefix
# Reload the file with TRIGGER+r
bind r source-file ~/.tmux.conf \; display "tmux config reloaded :)"
# Redefine pane splitting; retain current directory of existing pane
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Add shortcuts for new and kill sessions
bind X confirm-before kill-session
# No delays
set -s escape-time 1
# Enable mouse selections
set-option -g mouse on
# bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
# Set base index for windows and panes to 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# Theme
set-option -g status-position top
set -g status-bg colour103
set -g status-fg colour215
set -g status-right-length 120
set -g status-left-length 50
set -g window-status-style fg=colour215
# setw -g window-style fg=colour240
# setw -g window-active-style fg=white
# set -g pane-border-style fg=colour240
set -g pane-active-border-style fg=colour215
# Center the window list in the status line
set -g status-justify centre
# left status: session | battery | date and time
set -g status-left " #S"
# right status: Kubernetes context, see https://github.com/jonmosco/kube-tmux
# and AWS context, see https://github.com/mhausenblas/aws-tmux
set -g status-right "#(bash ~/.tmux/aws-tmux/aws.tmux)"
# Resurrect, see https://github.com/tmux-plugins/tmux-resurrect
# Restore sessions TRIGGER + Ctrl-s (safe) / Ctrl-r (restore)
set -g @plugin 'tmux-plugins/tmux-resurrect'
# tmux-continuum, see https://github.com/tmux-plugins/tmux-continuum
# saves/restores automatically (15min interval)
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
# battery, see https://github.com/tmux-plugins/tmux-battery
set -g @plugin 'tmux-plugins/tmux-battery'
# The tmux plugin manager, see https://github.com/tmux-plugins/tpm:
run '~/.tmux/plugins/tpm/tpm'
set -g default-shell /bin/sh
set -g default-command $SHELL
# Configuration for Alacritty, the GPU enhanced terminal emulator.
window:
# Window dimensions (changes require restart)
#
# Specified in number of columns/lines, not pixels.
# If both are `0`, this setting is ignored.
dimensions:
columns: 80
lines: 24
# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
position:
x: 0
y: 0
# Window padding (changes require restart)
#
# Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides.
padding:
x: 0
y: 24
# Spread additional padding evenly around the terminal content.
dynamic_padding: false
# Window decorations
#
# Values for `decorations`:
# - full: Borders and title bar
# - none: Neither borders nor title bar
#
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background, but no title bar buttons
# decorations: buttonless
decorations: none
# Startup Mode (changes require restart)
#
# Values for `startup_mode`:
# - Windowed
# - Maximized
# - Fullscreen
#
# Values for `startup_mode` (macOS only):
# - SimpleFullscreen
startup_mode: Maximized
# startup_mode: Windowed
# Window title
#title: Alacritty
scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
history: 10000
# Scrolling distance multiplier.
multiplier: 10
# Font configuration
font:
# Normal (roman) font face
normal:
# Font family
family: "FiraCode Nerd Font"
# The `style` can be specified to pick a specific face.
style: Regular
bold:
family: "FiraCode Nerd Font"
style: Medium
# Point size
size: 17.0
offset:
x: 0
y: 2
draw_bold_text_with_bright_colors: false
# Base16 Atelier Dune - alacritty color config
colors:
primary:
background: '0x20201d'
foreground: '0xa6a28c'
cursor:
text: '0x20201d'
cursor: '0xa6a28c'
normal:
black: '0x20201d'
red: '0xd73737'
green: '0x60ac39'
yellow: '0xae9513'
blue: '0x6684e1'
magenta: '0xb854d4'
cyan: '0x1fad83'
white: '0xa6a28c'
bright:
black: '0x7d7a68'
red: '0xb65611'
green: '0x292824'
yellow: '0x6e6b5e'
blue: '0x999580'
magenta: '0xe8e4cf'
cyan: '0xd43552'
white: '0xfefbec'
# Bell
bell:
# Visual Bell Animation
animation: EaseOutExpo
# Background opacity
background_opacity: 0.80
selection:
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard: true
cursor:
# Cursor style
#
# Values for `style`:
# - ▇ Block
# - _ Underline
# - | Beam
style: Underline
# Vi mode cursor style
#
# If the vi mode cursor style is `None` or not specified, it will fall back to
# the style of the active value of the normal cursor.
#
# See `cursor.style` for available options.
vi_mode_style: None
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
unfocused_hollow: true
# Thickness of the cursor relative to the cell width as floating point number
# from `0.0` to `0.70`.
thickness: 0.15
# Live config reload (changes require restart)
live_config_reload: true
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`.
# Entries in `shell.args` are passed unmodified as arguments to the shell.
#
# Default:
# - (macOS) /bin/bash --login
# - (Linux/BSD) user login shell
# - (Windows) powershell
shell:
program: /usr/local/bin/fish
args:
- -l
- -i
- -c
- "tmux new-session -A -s zzz"
# Startup directory
#
# Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used.
working_directory: None
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true
mouse:
# If this is `true`, the cursor is temporarily hidden when typing.
hide_when_typing: true
url:
launcher:
program: "/Applications/Firefox.app/Contents/MacOS/firefox"
# args:
# - --new-window
# URL modifiers
# modifiers: Command
# Key bindings
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
key_bindings:
- { key: L, mods: Control|Shift, action: ClearHistory }
- { key: Key0, mods: Command, action: ResetFontSize }
- { key: Equals, mods: Command, action: IncreaseFontSize }
- { key: Add, mods: Command, action: IncreaseFontSize }
- { key: Minus, mods: Command, action: DecreaseFontSize }
- { key: V, mods: Command, action: Paste }
- { key: C, mods: Command, action: Copy }
- { key: Q, mods: Command, action: Quit }
- { key: W, mods: Command, action: Quit }
- { key: N, mods: Command, action: SpawnNewInstance }
- { key: Slash, mods: Command, chars: "++" }
- { key: Backslash, mods: Command, chars: "+=" }
- { key: Key3, mods: Alt, chars: "\x23" }
# set environment variables
set -x FZF_DEFAULT_OPTS "-m --bind='ctrl-o:execute(nvim {})+abort'"
set -x FZF_DEFAULT_COMMAND 'rg --files'
set -g FZF_CTRL_T_COMMAND "command find -L \$dir -type f 2> /dev/null | sed '1d; s#^\./##'"
set -x EDITOR nvim
set -x KUBE_EDITOR nvim
set -x GOPATH /Users/hausenbl/go
function fish_prompt
set -l retc red
test $status = 0; and set retc blue
set -q __fish_git_prompt_showupstream
or set -g __fish_git_prompt_showupstream auto
function _nim_prompt_wrapper
set retc $argv[1]
set field_name $argv[2]
set field_value $argv[3]
set_color normal
set_color $retc
echo -n '─'
set_color -o blue
echo -n '['
set_color normal
test -n $field_name
and echo -n $field_name:
set_color $retc
echo -n $field_value
set_color -o blue
echo -n ']'
end
set_color $retc
echo -n '┬─'
set_color -o blue
echo -n [
set_color normal
set_color c07933
echo -n (prompt_pwd)
set_color -o blue
echo -n ']'
# Virtual Environment
set -q VIRTUAL_ENV_DISABLE_PROMPT
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
set -q VIRTUAL_ENV
and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV")
# git
set prompt_git (fish_git_prompt | string trim -c ' ()')
test -n "$prompt_git"
and _nim_prompt_wrapper $retc G $prompt_git
# New line
echo
# Background jobs
set_color normal
for job in (jobs)
set_color $retc
echo -n '│ '
set_color brown
echo $job
end
set_color blue
echo -n '╰─> '
set_color -o blue
echo -n '$ '
set_color normal
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment