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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
return {
"stevearc/dressing.nvim",
event = "VeryLazy",
opts = {
-- =====================================================
-- Input Configuration - Enhanced vim.ui.input
-- =====================================================
input = {
enabled = true,
default_prompt = " Input:",
prompt_align = "center",
insert_only = true,
start_in_insert = true,
-- ========== Window Styling ==========
border = "rounded",
relative = "editor",
-- ========== Size Configuration ==========
prefer_width = 50,
width = nil,
max_width = { 140, 0.8 },
min_width = { 30, 0.3 },
-- ========== Window Options ==========
win_options = {
winblend = 0, -- No transparency for better readability
wrap = false,
cursorline = true,
cursorlineopt = "both",
-- Better highlighting
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel",
},
-- ========== Enhanced Key Mappings ==========
mappings = {
n = {
["<Esc>"] = "Close",
["<CR>"] = "Confirm",
["q"] = "Close",
["<C-c>"] = "Close",
},
i = {
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["<Up>"] = "HistoryPrev",
["<Down>"] = "HistoryNext",
["<C-p>"] = "HistoryPrev",
["<C-n>"] = "HistoryNext",
["<C-u>"] = function() vim.api.nvim_del_current_line() end,
["<Esc>"] = "Close",
},
},
-- ========== Custom Configuration Function ==========
get_config = function(opts)
-- Customize based on prompt type
if opts.prompt and opts.prompt:find("rename", 1, true) then
return {
relative = "cursor",
row = 1,
col = 0,
}
end
-- For file operations, make window larger
if opts.prompt and (opts.prompt:find("file", 1, true) or opts.prompt:find("path", 1, true)) then
return {
prefer_width = 80,
}
end
end,
},
-- =====================================================
-- Select Configuration - Enhanced vim.ui.select
-- =====================================================
select = {
enabled = true, -- Enable for better selection UI
-- ========== Backend Priority ==========
backend = { "telescope", "builtin", "nui" },
trim_prompt = true,
-- ========== Telescope Integration ==========
telescope = require('telescope.themes').get_dropdown({
layout_config = {
width = 0.6,
height = 0.6,
},
borderchars = {
prompt = { "─", "│", " ", "│", "┌", "┐", "│", "│" },
results = { "─", "│", "─", "│", "├", "┤", "┘", "└" },
preview = { "─", "│", "─", "│", "┌", "┐", "┘", "└" },
},
}),
-- ========== FZF Configuration ==========
fzf = {
window = {
width = 0.7,
height = 0.6,
},
},
-- ========== NUI Configuration ==========
nui = {
position = "50%",
size = nil,
relative = "editor",
border = {
style = "rounded",
text = {
top = " Select ",
top_align = "center",
},
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 0,
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel",
},
max_width = 100,
max_height = 50,
min_width = 50,
min_height = 15,
},
-- ========== Built-in Selector Configuration ==========
builtin = {
border = "rounded",
relative = "editor",
-- ========== Enhanced Window Options ==========
win_options = {
winblend = 0,
cursorline = true,
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel",
},
-- ========== Size Configuration ==========
width = nil,
max_width = { 120, 0.8 },
min_width = { 50, 0.4 },
height = nil,
max_height = 0.8,
min_height = { 15, 0.3 },
-- ========== Enhanced Key Mappings ==========
mappings = {
["<Esc>"] = "Close",
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["q"] = "Close",
["j"] = "Next",
["k"] = "Prev",
["<Down>"] = "Next",
["<Up>"] = "Prev",
["<C-j>"] = "Next",
["<C-k>"] = "Prev",
},
},
-- ========== Format Item Override ==========
format_item_override = {
-- Add icons for common items
codeaction = function(action_tuple)
local title = action_tuple[2].title:gsub("\r\n", "\\r\\n")
local client = action_tuple[1]
return string.format(" %s - %s", title, client)
end,
},
-- ========== Dynamic Configuration ==========
get_config = function(opts)
-- For code actions, use telescope if available
if opts.kind == "codeaction" then
return {
backend = { "telescope", "builtin" },
telescope = require('telescope.themes').get_cursor({
layout_config = {
width = 0.6,
height = 0.4,
},
}),
}
end
-- For LSP references/definitions, prefer telescope
if opts.kind == "references" or opts.kind == "definitions" then
return {
backend = { "telescope" },
}
end
-- For simple selections, use builtin
return {
backend = { "builtin", "telescope" },
}
end,
},
},
}
|