blob: 063e87e03eb75070e58f8193cbf7d841b6209114 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
local MAX_ZOOM = 3
local MIN_ZOOM = 1
local ZOOM_TOGGLE_FACTOR = 1.5
---@param offset number
---@return nil
local function zoom(offset)
local current = hl.get_config("cursor.zoom_factor")
if offset ~= nil then
current = current + offset
elseif current ~= MIN_ZOOM then
current = MIN_ZOOM
else
current = ZOOM_TOGGLE_FACTOR
end
current = math.max(MIN_ZOOM, math.min(MAX_ZOOM, current))
hl.config({ cursor = { zoom_factor = current } })
end
hl.bind("SUPER + Z", zoom)
hl.bind("SUPER + plus", function()
zoom(0.5)
end)
hl.bind("SUPER + minus", function()
zoom(-0.5)
end)
|