-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.lua
More file actions
120 lines (102 loc) · 3.95 KB
/
local.lua
File metadata and controls
120 lines (102 loc) · 3.95 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
local local_plugins = {
{
"floating",
dir = "~/Code/nvim/floating",
config = function()
---@alias style_name
--- | "clock_tr"
---@alias special_abrv
--- | "clock_tr"
---@type Setup_Opts
local opts = {
dev = true,
positions = {
function()
---@type config_and_position
local R = {}
R.pos = "clock_tr"
R.name_location = "footer"
R.config = {
width = 5,
height = 1,
col = vim.o.col - 5,
row = 0,
title = "",
title_pos = "center",
relative = "editor",
style = "minimal", -- No extra UI elements, e.g. status bar.
border = { "", "", "", "║", "╝", "═", "", "" },
}
return R
end,
},
styles = {
name = "clock_tr",
positions = { "clock_tr" },
dont_focus = true,
INIT = function(FLOAT)
FLOAT.state.style_data.clock = {}
end,
setup = function(STATE)
local time_offset = 0
local time_table = os.date("*t", os.time() + time_offset * 3600)
local M = tonumber(time_table.min)
local H = tonumber(time_table.hour)
local digits = {
["0"] = "🯰",
["1"] = "🯱",
["2"] = "🯲",
["3"] = "🯳",
["4"] = "🯴",
["5"] = "🯵",
["6"] = "🯶",
["7"] = "🯷",
["8"] = "🯸",
["9"] = "🯹",
}
local min = string.format("%02d", M)
local min_array = {
digits[string.sub(min, 1, 1)],
digits[string.sub(min, 2, 2)],
}
local hour = string.format("%02d", H)
local hour_array = {
digits[string.sub(hour, 1, 1)],
digits[string.sub(hour, 2, 2)],
}
local time = hour_array[1] .. hour_array[2] .. ":" .. min_array[1] .. min_array[2]
STATE.style_data.clock = {
time = time,
}
end,
-- `style` is run after the new window is opened.
style = function(opts)
local buf = opts.bufwin.buf
vim.api.nvim_buf_set_lines( --
buf,
0,
-1,
false,
{ opts.state.style_data.clock.time }
)
end,
},
dont_load_default_user_commands = false,
dont_use_default_keymaps = false,
}
---@type FLOAT
local FLOAT = require("floating").setup(opts)
print("HAHAHAHAH")
vim.keymap.set( --
"n",
"<leader>fi",
function()
print("tr")
FLOAT.toggle("clock_tr")
end,
{}
)
end,
},
}
return local_plugins