-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeymaps.lua
More file actions
97 lines (88 loc) · 2.63 KB
/
Copy pathkeymaps.lua
File metadata and controls
97 lines (88 loc) · 2.63 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
-- Neovide keymaps
---@class NeovideKeymaps
local M = {}
------------------------------------------------------------------------------
-- Scale fonts up and down with <Command>= and <Command>-, respectively
local increment = 0.1
local decrement = -increment
local cmd_font_increase = ":lua require('neovide.util').neovide_scale("
.. increment
.. ")<CR>"
local cmd_font_decrease = ":lua require('neovide.util').neovide_scale("
.. decrement
.. ")<CR>"
M.scale = {
n = {
["<D-=>"] = {
cmd_font_increase,
{ desc = "Increase font size" },
},
["<D-->"] = {
cmd_font_decrease,
{ desc = "Decrease font size" },
},
},
i = {
["<D-=>"] = {
"<C-o>" .. cmd_font_increase,
{ desc = "Increase font size" },
},
["<D-->"] = {
"<C-o>" .. cmd_font_decrease,
{ desc = "Decrease font size" },
},
},
v = {
["<D-=>"] = {
"<ESC>" .. cmd_font_increase .. "gv",
{ desc = "Increase font size" },
},
["<D-->"] = {
"<ESC>" .. cmd_font_decrease .. "gv",
{ desc = "Decrease font size" },
},
},
}
M.background_transparency = {
n = {
["<leader>br"] = {
function()
local count = vim.v.count
-- Remember last count-derived opacity (default 50%)
vim.g._last_neovide_opacity_from_count = vim.g._last_neovide_opacity_from_count
or 0.5
-- NO COUNT -> toggle
if count == 0 then
if vim.g.neovide_opacity == 1 then
vim.g.neovide_opacity = vim.g._last_neovide_opacity_from_count
else
vim.g.neovide_opacity = 1
end
else
-- WITH COUNT -> set + remember
if count < 0 then
count = 0
end
if count > 100 then
count = 100
end
local opacity = 1 - (count / 100)
vim.g.neovide_opacity = opacity
vim.g._last_neovide_opacity_from_count = opacity
end
-- ---- MESSAGE ----
local opacity = vim.g.neovide_opacity or 1
local transparency_pct = math.floor((1 - opacity) * 100 + 0.5)
vim.notify(
("Transparent background: %d%%"):format(transparency_pct),
vim.log.levels.INFO,
{ title = "neovide.keymaps.background_transparency" }
)
end,
{
desc = "[B]ackground t[r]ansparency toggle or set via count (1-100)",
},
},
},
}
return M