dotfiles/.config/wezterm/wezterm.lua.cgt

53 lines
2 KiB
Text
Raw Normal View History

2023-02-19 14:44:15 +01:00
;<! tmpl:setPostProcessor(opt.fennelCompile) !>
2023-04-16 18:12:38 +02:00
; vim: filetype=fennel
2023-02-19 14:44:15 +01:00
(local wt (require :wezterm))
(macro kmap [key mods act args]
(if args
`{:key ,key :mods ,mods :action ((. wt :action ,act) ,args)}
`{:key ,key :mods ,mods :action (. wt :action ,act)}))
2023-03-06 13:48:29 +01:00
(var keys [;; splitting
2023-04-15 00:14:56 +02:00
(kmap :s :LEADER :SplitVertical {})
2023-03-06 13:48:29 +01:00
(kmap :v :LEADER :SplitHorizontal {})
;; tabs
(kmap :t :CTRL|SHIFT :SpawnTab :CurrentPaneDomain)
(kmap :t :CTRL :ActivateTabRelative 1)
;; font size
(kmap "+" :CTRL :IncreaseFontSize)
(kmap "-" :CTRL :DecreaseFontSize)
;; moving panes
(kmap :r :LEADER :RotatePanes :Clockwise)
(kmap :m :LEADER :PaneSelect {:mode :SwapWithActive})
;; scrolling
(kmap :PageUp :ALT :ScrollByPage -1)
(kmap :PageDown :ALT :ScrollByPage 1)
;; copying
(kmap :C :CTRL|SHIFT :CopyTo :ClipboardAndPrimarySelection)
2023-04-21 16:43:34 +02:00
(kmap :V :CTRL|SHIFT :PasteFrom :Clipboard)
;; copy mode
2023-04-27 22:36:08 +02:00
(kmap :y :LEADER :ActivateCopyMode)
;; command palette
(kmap :p :LEADER :ActivateCommandPalette)])
2023-02-19 14:44:15 +01:00
(local directions [[:h :Left] [:j :Down] [:k :Up] [:l :Right]])
(each [_ dir (ipairs directions)]
(let [(dir-key dir-name) (table.unpack dir)]
;; switching panes
(table.insert keys (kmap dir-key :ALT :ActivatePaneDirection dir-name))
;; resize double in horizontal directions so the absolute amounts are constant
(local resize-amt (if (or (= dir-name :Up) (= dir-name :Down)) 2 4))
(table.insert keys (kmap dir-key :ALT|SHIFT :AdjustPaneSize
[dir-name resize-amt]))))
2023-04-16 18:12:38 +02:00
{:default_prog [:fish]
:color_scheme "Dracula (Official)"
2023-02-19 14:44:15 +01:00
:font (wt.font "<% opt.term_font %>")
2023-03-07 18:25:18 +01:00
:warn_about_missing_glyphs false
2023-02-19 14:44:15 +01:00
:window_background_opacity 0.8
:disable_default_key_bindings true
:leader {:key :a :mods :CTRL :timeout_milliseconds 2000}
: keys}