Skip to content

Commit b63e2b2

Browse files
committed
feat: make window border configurable
Add `border` option to picker config, allowing users to customize window border style instead of hardcoded 'rounded' border.
1 parent 1326b22 commit b63e2b2

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ require('plug').add({
138138
height = 0.8,
139139
col = 0.1,
140140
row = 0.1,
141+
border = 'rounded',
141142
current_icon = '>',
142143
current_icon_hl = 'CursorLine',
143144
enable_preview = false,

lua/picker/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local default = { ---@type PickerConfig
1212
height = 0.8,
1313
col = 0.1,
1414
row = 0.1,
15+
border = 'rounded',
1516
current_icon = '>',
1617
current_icon_hl = 'CursorLine',
1718
enable_preview = false,

lua/picker/layout/default.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function M.render_windows(source, config)
6161
col = start_col,
6262
row = start_row,
6363
focusable = false,
64-
border = 'rounded',
64+
border = config.window.border,
6565
})
6666
vim.api.nvim_set_option_value(
6767
'winhighlight',
@@ -96,7 +96,7 @@ function M.render_windows(source, config)
9696
col = start_col,
9797
row = start_row,
9898
focusable = false,
99-
border = 'rounded',
99+
border = config.window.border,
100100
})
101101
end
102102
if not vim.api.nvim_win_is_valid(layout.list_win) then
@@ -110,7 +110,7 @@ function M.render_windows(source, config)
110110
col = start_col,
111111
row = start_row + math.floor((screen_height - 5) / 2) + 2,
112112
focusable = false,
113-
border = 'rounded',
113+
border = config.window.border,
114114
-- title = 'Result',
115115
-- title_pos = 'center',
116116
-- noautocmd = true,
@@ -126,7 +126,7 @@ function M.render_windows(source, config)
126126
col = start_col,
127127
row = start_row + math.floor((screen_height - 5) / 2) + 2,
128128
focusable = false,
129-
border = 'rounded',
129+
border = config.window.border,
130130
-- title = 'Result',
131131
-- title_pos = 'center',
132132
-- noautocmd = true,
@@ -145,7 +145,7 @@ function M.render_windows(source, config)
145145
col = start_col,
146146
row = start_row,
147147
focusable = false,
148-
border = 'rounded',
148+
border = config.window.border,
149149
-- title = 'Result',
150150
-- title_pos = 'center',
151151
-- noautocmd = true,
@@ -158,7 +158,7 @@ function M.render_windows(source, config)
158158
col = start_col,
159159
row = start_row,
160160
focusable = false,
161-
border = 'rounded',
161+
border = config.window.border,
162162
-- title = 'Result',
163163
-- title_pos = 'center',
164164
-- noautocmd = true,
@@ -173,7 +173,7 @@ function M.render_windows(source, config)
173173
col = start_col,
174174
row = start_row + screen_height - 3,
175175
focusable = true,
176-
border = 'rounded',
176+
border = config.window.border,
177177
title = config.prompt.title and string.format(' %s ', source.name),
178178
title_pos = 'center',
179179
-- noautocmd = true,
@@ -200,7 +200,7 @@ function M.render_windows(source, config)
200200
col = start_col,
201201
row = start_row + math.floor((screen_height - 5) / 2) + 4,
202202
focusable = false,
203-
border = 'rounded',
203+
border = config.window.border,
204204
})
205205
vim.api.nvim_set_option_value(
206206
'winhighlight',
@@ -240,7 +240,7 @@ function M.render_windows(source, config)
240240
col = start_col,
241241
row = start_row + math.floor((screen_height - 5) / 2) + 4,
242242
focusable = false,
243-
border = 'rounded',
243+
border = config.window.border,
244244
})
245245
end
246246
if not vim.api.nvim_win_is_valid(layout.list_win) then
@@ -253,7 +253,7 @@ function M.render_windows(source, config)
253253
col = start_col,
254254
row = start_row + 3,
255255
focusable = false,
256-
border = 'rounded',
256+
border = config.window.border,
257257
})
258258
else
259259
vim.api.nvim_win_set_config(layout.list_win, {
@@ -265,7 +265,7 @@ function M.render_windows(source, config)
265265
col = start_col,
266266
row = start_row + 3,
267267
focusable = false,
268-
border = 'rounded',
268+
border = config.window.border,
269269
})
270270
end
271271
else
@@ -280,7 +280,7 @@ function M.render_windows(source, config)
280280
col = start_col,
281281
row = start_row + 3,
282282
focusable = false,
283-
border = 'rounded',
283+
border = config.window.border,
284284
})
285285
else
286286
vim.api.nvim_win_set_config(layout.list_win, {
@@ -290,7 +290,7 @@ function M.render_windows(source, config)
290290
col = start_col,
291291
row = start_row + 3,
292292
focusable = false,
293-
border = 'rounded',
293+
border = config.window.border,
294294
})
295295
end
296296
end
@@ -302,7 +302,7 @@ function M.render_windows(source, config)
302302
col = start_col,
303303
row = start_row,
304304
focusable = true,
305-
border = 'rounded',
305+
border = config.window.border,
306306
title = config.prompt.title and string.format(' %s ', source.name),
307307
title_pos = 'center',
308308
-- noautocmd = true,

0 commit comments

Comments
 (0)