1
0
Fork 0
dotfiles/home/config/wezterm/config.fnl

149 lines
6.7 KiB
Plaintext
Raw Normal View History

2022-12-21 18:02:41 +00:00
(let [wezterm (require :wezterm)
2023-01-18 19:18:12 +00:00
window-padding 15
colors {:active-background "#282A36"
:active-foreground "#ABB2BF"
:active-indicator "#BD93F9"
:inactive-background "#191A21"
2023-03-30 19:58:38 +00:00
:inactive-foreground "#6272A4"
:hover-background "#BD93F9"
:hover-foreground "#191A21"
; Icons
:elixir "#A074C4"
:nix "#7EBAE4"
:ssh "#F4C82D"}]
2023-01-18 19:18:12 +00:00
;; Event: Tab format
(fn extract-tab-info [title]
(match title
(where t (t:find "^nvim%s"))
2023-01-22 12:47:36 +00:00
{:title (t:gsub "^nvim%s(.*)" "%1") :icon " " :color "#019833"}
(where t (t:find "^git%s"))
{:title (t:gsub "^git%s(.*)" "%1") :icon " " :color "#41535B"}
(where t (t:find "^mix%s"))
2023-03-30 19:58:38 +00:00
{:title (t:gsub "^mix%s(.*)" "%1") :icon " " :color colors.elixir}
(where t (t:find "^iex%s")) {: title :icon " " :color colors.elixir}
(where t (t:find "^upa%s")) {: title :icon " " :color colors.nix}
(where t (t:find "^upp%s")) {: title :icon " " :color colors.nix}
(where t (t:find "^nrsw%s")) {: title :icon " " :color colors.nix}
(where t (t:find "^ngc%s")) {: title :icon " " :color colors.nix}
(where t (t:find "^ssh%s")) {: title :icon " " :color colors.ssh}
(where t (t:find "^scp%s")) {: title :icon " " :color colors.ssh}
2023-01-27 09:34:24 +00:00
(where t (t:find :^ytdl)) {: title :icon " " :color "#FF0000"}
2023-01-18 19:18:12 +00:00
(where t (t:find :^instagram-)) {: title :icon " " :color "#FB2179"}
2023-03-30 19:58:38 +00:00
(where t (t:find "^gallery-dl%s"))
{:title (t:gsub "^gallery-dl%s(.*)" "%1") :icon " " :color "#009900"}
2023-01-18 19:18:12 +00:00
_ {: title :icon " " :color "#F8F8F2"}))
(wezterm.on :format-tab-title
(fn [tab tabs panes config hover max-width]
(let [tab-info (extract-tab-info tab.active_pane.title)
title (wezterm.truncate_right tab-info.title
(- max-width 5))]
(if tab.is_active
[; Left
{:Background {:Color colors.active-background}}
{:Foreground {:Color colors.active-indicator}}
{:Text "┃ "}
; Center
{:Foreground {:Color tab-info.color}}
{:Text tab-info.icon}
{:Foreground {:Color colors.active-foreground}}
{:Attribute {:Intensity :Bold}}
{:Attribute {:Italic true}}
{:Text title}
; Right
{:Attribute {:Intensity :Normal}}
{:Attribute {:Italic false}}
{:Text " "}]
[; Left
{:Background {:Color colors.inactive-background}}
{:Foreground {:Color colors.inactive-foreground}}
{:Text " "}
; Center
{:Foreground {:Color tab-info.color}}
{:Text tab-info.icon}
{:Foreground {:Color colors.inactive-foreground}}
{:Text title}
; Right
{:Text " "}]))))
;; Configuration
2022-12-20 16:46:51 +00:00
{:default_prog [_G.shells.fish :--interactive]
2022-12-19 21:02:48 +00:00
;; Appearance
:color_scheme "Dracula (Official)"
2022-12-21 18:02:41 +00:00
:window_decorations :RESIZE
:window_padding {:left window-padding
:right window-padding
:top window-padding
:bottom window-padding}
2023-01-18 19:18:12 +00:00
;; Tabs
2022-12-19 21:02:48 +00:00
:enable_tab_bar true
2023-01-18 19:18:12 +00:00
:use_fancy_tab_bar false
2022-12-19 21:02:48 +00:00
:hide_tab_bar_if_only_one_tab true
2022-12-21 18:02:41 +00:00
:tab_bar_at_bottom true
2023-01-22 12:47:36 +00:00
:tab_max_width 32
2023-01-18 19:18:12 +00:00
:colors {:tab_bar {:background colors.inactive-background
:new_tab {:bg_color colors.inactive-background
2023-03-30 19:58:38 +00:00
:fg_color colors.inactive-foreground
:italic false
:intensity :Bold}
:new_tab_hover {:bg_color colors.hover-background
:fg_color colors.hover-foreground
:italic false
:intensity :Bold}
2023-03-29 18:30:12 +00:00
:inactive_tab_hover {:bg_color colors.inactive-background
:fg_color colors.inactive-foreground
:italic false}}}
2022-12-19 21:02:48 +00:00
;; Fonts
:font (wezterm.font_with_fallback [{:family "JetBrains Mono"
:weight :Medium}
"Symbols Nerd Font"
"Apple Symbols"
"Apple Color Emoji"
"Noto Sans Symbols"
"Noto Sans Symbols2"
:Unifont])
:font_size 13
:line_height 0.9
:freetype_load_target :Light
;:freetype_render_target :HorizontalLcd
2022-12-20 16:46:51 +00:00
:allow_square_glyphs_to_overflow_width :WhenFollowedBySpace
;; Keys
:keys [{:key :UpArrow
:mods :SHIFT
:action (wezterm.action.ScrollToPrompt -1)}
{:key :DownArrow
:mods :SHIFT
2023-01-22 12:47:36 +00:00
:action (wezterm.action.ScrollToPrompt 1)}
{:key :LeftArrow
:mods :CMD
:action (wezterm.action.ActivateTabRelative -1)}
{:key :RightArrow
:mods :CMD
:action (wezterm.action.ActivateTabRelative 1)}]
2023-02-06 10:47:54 +00:00
:send_composed_key_when_left_alt_is_pressed true
:send_composed_key_when_right_alt_is_pressed true
2022-12-19 21:02:48 +00:00
;; Mouse
:mouse_bindings [; Only select text and don't open hyperlinks
{:event {:Up {:streak 1 :button :Left}}
:mods :NONE
:action (wezterm.action {:ExtendSelectionToMouseCursor :Cell})}
2022-12-20 16:46:51 +00:00
; Only select word on double click
2022-12-19 21:02:48 +00:00
{:event {:Up {:streak 2 :button :Left}}
:mods :NONE
2022-12-20 16:46:51 +00:00
:action (wezterm.action.SelectTextAtMouseCursor :Word)}
; Select entire output of command
{:event {:Down {:streak 3 :button :Left}}
:mods :NONE
:action (wezterm.action.SelectTextAtMouseCursor :SemanticZone)}
2022-12-19 21:02:48 +00:00
; CMD-click to open a hyperlink
{:event {:Up {:streak 1 :button :Left}}
2022-12-20 16:46:51 +00:00
:mods :SUPER
2022-12-19 21:02:48 +00:00
:action :OpenLinkAtMouseCursor}]
;; Scrollback
2022-12-20 16:46:51 +00:00
:scrollback_lines 5000
;; Launch Menu
:launch_menu [{:label :Btop++ :args [_G.programs.btop]}]
;; Other
:check_for_updates false})
2022-12-19 21:02:48 +00:00