# Configuration for Alacritty, the GPU enhanced terminal emulator.
# https://github.com/alacritty/alacritty/raw/master/alacritty.yml

env:
  TERM: alacritty

window:
  padding:
    x: 2
    y: 2

  dynamic_padding: false

  decorations: none

  opacity: {{ terminal_opacity }}

  startup_mode: Windowed

  title: Alacritty

  dynamic_title: true

  class:
    instance: Alacritty
    general: Alacritty

  gtk_theme_variant: dark

scrolling:
  history: 50000

  multiplier: 5

font:
  normal:
    family: {{ term_font }}
    style: Regular

  bold:
    family: {{ term_font }}
    style: Bold

  italic:
    family: {{ term_font }}
    style: Italic

  bold_italic:
    family: {{ term_font }}
    style: Bold Italic

  size: {{ font_size }}

  offset:
    x: 0
    y: 0

  glyph_offset:
    x: 0
    y: 0

  use_thin_strokes: false

  builtin_box_drawing: true

draw_bold_text_with_bright_colors: false

colors:
  primary:
    background: '{{ background }}'
    foreground: '{{ foreground }}'

  cursor:
    text: CellBackground
    cursor: CellForeground

  vi_mode_cursor:
    text: CellBackground
    cursor: CellForeground

  search:
    matches:
      foreground: '{{ background }}'
      background: '{{ blue }}'
    focused_match:
      foreground: '{{ background }}'
      background: '{{ yellow }}'

    bar:
      background: '{{ foreground }}'
      foreground: '{{ background }}'

  # Keyboard regex hints
  hints:
    start:
      foreground: '{{ background }}'
      background: '{{ green }}'

    end:
      foreground: '{{ green }}'
      background: '{{ background }}'

  # By default, these will use the opposing primary color.
  #line_indicator:
  #  foreground: None
  #  background: None

  selection:
    text: CellBackground
    background: CellForeground

  normal:
    black:   '{{ color0 }}'
    red:     '{{ color1 }}'
    green:   '{{ color2 }}'
    yellow:  '{{ color3 }}'
    blue:    '{{ color4 }}'
    magenta: '{{ color5 }}'
    cyan:    '{{ color6 }}'
    white:   '{{ color7 }}'

  bright:
    black:   '{{ color8 }}'
    red:     '{{ color9 }}'
    green:   '{{ color10 }}'
    yellow:  '{{ color11 }}'
    blue:    '{{ color12 }}'
    magenta: '{{ color13 }}'
    cyan:    '{{ color14 }}'
    white:   '{{ color15 }}'

  transparent_background_colors: false

bell:
  animation: EaseOutExpo

  duration: 0

  color: '{{ foreground }}'

  command: None

selection:
  semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"

  save_to_clipboard: false

cursor:
  style:
    shape: Beam

    blinking: Off

  vi_mode_style: Block

  blink_interval: 750

  unfocused_hollow: true

  thickness: 0.15

live_config_reload: false

#shell:
#  program: /bin/bash
#  args:
#    - --login

working_directory: None

alt_send_esc: true

ipc_socket: true

mouse:
  double_click: { threshold: 300 }
  triple_click: { threshold: 300 }

  hide_when_typing: false

hints:
  alphabet: "jfkdls;ahgurieowpq"

  enabled:
   - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\
             [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
     command: /usr/bin/xdg-open
     post_processing: true
     mouse:
       enabled: true
       mods: None
     binding:
       key: U
       mods: Control|Shift

mouse_bindings:
  - { mouse: Right,                 action: ExpandSelection }
  - { mouse: Right,  mods: Control, action: ExpandSelection }
  - { mouse: Middle, mode: ~Vi,     action: PasteSelection  }

key_bindings:
  - { key: Paste,                                       action: Paste          }
  - { key: Copy,                                        action: Copy           }
  - { key: L,         mods: Control,                    action: ClearLogNotice }
  - { key: L,         mods: Control, mode: ~Vi|~Search, chars: "\x0c"          }
  - { key: PageUp,    mods: Shift,   mode: ~Alt,        action: ScrollPageUp,  }
  - { key: PageDown,  mods: Shift,   mode: ~Alt,        action: ScrollPageDown }
  - { key: Home,      mods: Shift,   mode: ~Alt,        action: ScrollToTop,   }
  - { key: End,       mods: Shift,   mode: ~Alt,        action: ScrollToBottom }

  # Vi Mode
  - { key: Space,  mods: Shift|Control, mode: ~Search,    action: ToggleViMode            }
  - { key: Space,  mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom          }
  - { key: Escape,                      mode: Vi|~Search, action: ClearSelection          }
  - { key: I,                           mode: Vi|~Search, action: ToggleViMode            }
  - { key: I,                           mode: Vi|~Search, action: ScrollToBottom          }
  - { key: C,      mods: Control,       mode: Vi|~Search, action: ToggleViMode            }
  - { key: Y,      mods: Control,       mode: Vi|~Search, action: ScrollLineUp            }
  - { key: E,      mods: Control,       mode: Vi|~Search, action: ScrollLineDown          }
  - { key: G,                           mode: Vi|~Search, action: ScrollToTop             }
  - { key: G,      mods: Shift,         mode: Vi|~Search, action: ScrollToBottom          }
  - { key: B,      mods: Control,       mode: Vi|~Search, action: ScrollPageUp            }
  - { key: F,      mods: Control,       mode: Vi|~Search, action: ScrollPageDown          }
  - { key: U,      mods: Control,       mode: Vi|~Search, action: ScrollHalfPageUp        }
  - { key: D,      mods: Control,       mode: Vi|~Search, action: ScrollHalfPageDown      }
  - { key: Y,                           mode: Vi|~Search, action: Copy                    }
  - { key: Y,                           mode: Vi|~Search, action: ClearSelection          }
  - { key: Copy,                        mode: Vi|~Search, action: ClearSelection          }
  - { key: V,                           mode: Vi|~Search, action: ToggleNormalSelection   }
  - { key: V,      mods: Shift,         mode: Vi|~Search, action: ToggleLineSelection     }
  - { key: V,      mods: Control,       mode: Vi|~Search, action: ToggleBlockSelection    }
  - { key: V,      mods: Alt,           mode: Vi|~Search, action: ToggleSemanticSelection }
  - { key: Return,                      mode: Vi|~Search, action: Open                    }
  - { key: K,                           mode: Vi|~Search, action: Up                      }
  - { key: J,                           mode: Vi|~Search, action: Down                    }
  - { key: H,                           mode: Vi|~Search, action: Left                    }
  - { key: L,                           mode: Vi|~Search, action: Right                   }
  - { key: Up,                          mode: Vi|~Search, action: Up                      }
  - { key: Down,                        mode: Vi|~Search, action: Down                    }
  - { key: Left,                        mode: Vi|~Search, action: Left                    }
  - { key: Right,                       mode: Vi|~Search, action: Right                   }
  - { key: Key0,                        mode: Vi|~Search, action: First                   }
  - { key: Key4,   mods: Shift,         mode: Vi|~Search, action: Last                    }
  - { key: Key6,   mods: Shift,         mode: Vi|~Search, action: FirstOccupied           }
  - { key: H,      mods: Shift,         mode: Vi|~Search, action: High                    }
  - { key: M,      mods: Shift,         mode: Vi|~Search, action: Middle                  }
  - { key: L,      mods: Shift,         mode: Vi|~Search, action: Low                     }
  - { key: B,                           mode: Vi|~Search, action: SemanticLeft            }
  - { key: W,                           mode: Vi|~Search, action: SemanticRight           }
  - { key: E,                           mode: Vi|~Search, action: SemanticRightEnd        }
  - { key: B,      mods: Shift,         mode: Vi|~Search, action: WordLeft                }
  - { key: W,      mods: Shift,         mode: Vi|~Search, action: WordRight               }
  - { key: E,      mods: Shift,         mode: Vi|~Search, action: WordRightEnd            }
  - { key: Key5,   mods: Shift,         mode: Vi|~Search, action: Bracket                 }
  - { key: Slash,                       mode: Vi|~Search, action: SearchForward           }
  - { key: Slash,  mods: Shift,         mode: Vi|~Search, action: SearchBackward          }
  - { key: N,                           mode: Vi|~Search, action: SearchNext              }
  - { key: N,      mods: Shift,         mode: Vi|~Search, action: SearchPrevious          }

  # Search Mode
  - { key: Return,                mode: Search|Vi,  action: SearchConfirm         }
  - { key: Escape,                mode: Search,     action: SearchCancel          }
  - { key: C,      mods: Control, mode: Search,     action: SearchCancel          }
  - { key: U,      mods: Control, mode: Search,     action: SearchClear           }
  - { key: W,      mods: Control, mode: Search,     action: SearchDeleteWord      }
  - { key: P,      mods: Control, mode: Search,     action: SearchHistoryPrevious }
  - { key: N,      mods: Control, mode: Search,     action: SearchHistoryNext     }
  - { key: Up,                    mode: Search,     action: SearchHistoryPrevious }
  - { key: Down,                  mode: Search,     action: SearchHistoryNext     }
  - { key: Return,                mode: Search|~Vi, action: SearchFocusNext       }
  - { key: Return, mods: Shift,   mode: Search|~Vi, action: SearchFocusPrevious   }

  # (Windows, Linux, and BSD only)
  - { key: V,              mods: Control|Shift, mode: ~Vi,        action: Paste            }
  - { key: C,              mods: Control|Shift,                   action: Copy             }
  - { key: F,              mods: Control|Shift, mode: ~Search,    action: SearchForward    }
  - { key: B,              mods: Control|Shift, mode: ~Search,    action: SearchBackward   }
  - { key: C,              mods: Control|Shift, mode: Vi|~Search, action: ClearSelection   }
  - { key: Insert,         mods: Shift,                           action: PasteSelection   }
  - { key: Key0,           mods: Control,                         action: ResetFontSize    }
  - { key: Equals,         mods: Control,                         action: IncreaseFontSize }
  - { key: Plus,           mods: Control,                         action: IncreaseFontSize }
  - { key: NumpadAdd,      mods: Control,                         action: IncreaseFontSize }
  - { key: Minus,          mods: Control,                         action: DecreaseFontSize }
  - { key: NumpadSubtract, mods: Control,                         action: DecreaseFontSize }

debug:
  render_timer: false

  persistent_logging: false

  log_level: Warn

  print_events: false

  highlight_damage: false
