1
0
Fork 0

wezterm/nvim: only enable ligatures in nvim pane

This commit is contained in:
Daniel Kempkens 2023-10-10 18:08:23 +02:00
parent 9a91ebe6a9
commit d2466f74cd
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 43 additions and 6 deletions

View file

@ -12,5 +12,9 @@
"")] "")]
(wezterm.set_tab_title title))) (wezterm.set_tab_title title)))
:group augroup}) :group augroup})
(aucmd :VimLeavePre {:callback #(wezterm.set_tab_title "") :group augroup}))) (aucmd :VimEnter {:callback #(wezterm.set_user_var :enable-ligatures :t)
:group augroup})
(aucmd :VimLeavePre {:callback (fn []
(wezterm.set_user_var :enable-ligatures :f)
(wezterm.set_tab_title ""))
:group augroup})))

View file

@ -12,7 +12,11 @@
:elixir "#A074C4" :elixir "#A074C4"
:nix "#7EBAE4" :nix "#7EBAE4"
:reddit "#FA4400" :reddit "#FA4400"
:ssh "#F4C82D"}] :ssh "#F4C82D"}
enable-ligatures-flags [:calt=1 :clig=1 :liga=1]
disable-ligatures-flags [:calt=0 :clig=0 :liga=0]]
(var ligature-panes [])
(var latest-pane-update nil)
;; Event: Tab format ;; Event: Tab format
(fn extract-tab-title [tab] (fn extract-tab-title [tab]
@ -87,6 +91,36 @@
{:Text title} {:Text title}
; Right ; Right
{:Text " "}])))) {:Text " "}]))))
(wezterm.on :update-status
(fn [window pane]
(local pane-id (pane:pane_id))
(when (not= latest-pane-update pane-id)
(let [overrides (or (window:get_config_overrides) {})]
(set latest-pane-update pane-id)
(if (. ligature-panes pane-id)
(do
(set overrides.harfbuzz_features
enable-ligatures-flags)
(window:set_config_overrides overrides))
(do
(set overrides.harfbuzz_features
disable-ligatures-flags)
(window:set_config_overrides overrides)))))))
(wezterm.on :user-var-changed
(fn [window pane name value]
(let [overrides (or (window:get_config_overrides) {})
pane-id (pane:pane_id)]
(case [name value]
[:enable-ligatures :t] (do
(set overrides.harfbuzz_features
enable-ligatures-flags)
(tset ligature-panes pane-id true)
(window:set_config_overrides overrides))
[:enable-ligatures :f] (do
(set overrides.harfbuzz_features
disable-ligatures-flags)
(tset ligature-panes pane-id nil)
(window:set_config_overrides overrides))))))
;; Configuration ;; Configuration
{:default_prog [_G.shells.fish :--interactive] {:default_prog [_G.shells.fish :--interactive]
;; Appearance ;; Appearance
@ -106,9 +140,7 @@
:inactive_titlebar_bg colors.frame-background :inactive_titlebar_bg colors.frame-background
:font (wezterm.font {:family "Berkeley Mono" :font (wezterm.font {:family "Berkeley Mono"
:weight :Regular :weight :Regular
:harfbuzz_features [:calt=0 :harfbuzz_features disable-ligatures-flags})
:clig=0
:liga=0]})
:font_size 11} :font_size 11}
:colors {:tab_bar {:background colors.frame-background :colors {:tab_bar {:background colors.frame-background
:inactive_tab_edge colors.frame-background :inactive_tab_edge colors.frame-background
@ -129,6 +161,7 @@
:line_height 0.95 :line_height 0.95
:freetype_load_target :Light :freetype_load_target :Light
;:freetype_render_target :HorizontalLcd ;:freetype_render_target :HorizontalLcd
:harfbuzz_features disable-ligatures-flags
:allow_square_glyphs_to_overflow_width :WhenFollowedBySpace :allow_square_glyphs_to_overflow_width :WhenFollowedBySpace
;; Keys ;; Keys
:keys [{:key :UpArrow :keys [{:key :UpArrow