diff options
Diffstat (limited to 'lua/plugins/dressing.lua')
| -rw-r--r-- | lua/plugins/dressing.lua | 228 |
1 files changed, 141 insertions, 87 deletions
diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua index 5cfb6cf..edf6806 100644 --- a/lua/plugins/dressing.lua +++ b/lua/plugins/dressing.lua @@ -2,159 +2,213 @@ return { "stevearc/dressing.nvim", event = "VeryLazy", opts = { + -- ===================================================== + -- Input Configuration - Enhanced vim.ui.input + -- ===================================================== input = { - -- Set to false to disable the vim.ui.input implementation enabled = true, - - -- Default prompt string - default_prompt = "Input:", - - -- Can be 'left', 'right', or 'center' + default_prompt = " Input:", prompt_align = "center", - - -- When true, <Esc> will close the modal insert_only = true, - - -- When true, input will start in insert mode. start_in_insert = true, - - -- These are passed to nvim_open_win - -- anchor = "SW", + + -- ========== Window Styling ========== border = "rounded", - -- 'editor' and 'win' will default to being centered relative = "editor", - - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - prefer_width = 40, + + -- ========== Size Configuration ========== + prefer_width = 50, width = nil, - -- min_width and max_width can be a list of mixed types. - -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" - max_width = { 140, 0.9 }, - min_width = { 20, 0.2 }, + max_width = { 140, 0.8 }, + min_width = { 30, 0.3 }, + + -- ========== Window Options ========== win_options = { - -- Window transparency (0-100) - winblend = 10, - -- Disable line wrapping + winblend = 0, -- No transparency for better readability wrap = false, + cursorline = true, + cursorlineopt = "both", + -- Better highlighting + winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel", }, - -- Set to `false` to disable + -- ========== 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", }, }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf + + -- ========== 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, - - -- see :help dressing_get_config - get_config = nil, }, + + -- ===================================================== + -- Select Configuration - Enhanced vim.ui.select + -- ===================================================== select = { - -- Set to false to disable the vim.ui.select implementation - enabled = false, - - -- Priority list of preferred vim.select implementations - backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, - - -- Trim trailing `:` from prompt + enabled = true, -- Enable for better selection UI + + -- ========== Backend Priority ========== + backend = { "telescope", "fzf_lua", "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 = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, + }, + }), - -- Options for telescope selector - -- These are passed into the telescope picker directly. Can be used like: - -- telescope = require('telescope.themes').get_ivy({...}) - telescope = nil, - - -- Options for fzf selector + -- ========== FZF Configuration ========== fzf = { window = { - width = 0.5, - height = 0.4, + width = 0.7, + height = 0.6, }, }, - - -- Options for fzf_lua selector + + -- ========== FZF Lua Configuration ========== fzf_lua = { winopts = { - width = 0.5, - height = 0.4, + width = 0.7, + height = 0.6, + border = "rounded", }, }, - - -- Options for nui Menu + + -- ========== 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 = 10, + winblend = 0, + winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel", }, - max_width = 80, - max_height = 40, - min_width = 40, - min_height = 10, + max_width = 100, + max_height = 50, + min_width = 50, + min_height = 15, }, - -- Options for built-in selector + -- ========== Built-in Selector Configuration ========== builtin = { - -- These are passed to nvim_open_win - -- anchor = "NW", border = "rounded", - -- 'editor' and 'win' will default to being centered relative = "editor", - + + -- ========== Enhanced Window Options ========== win_options = { - -- Window transparency (0-100) - winblend = 10, + winblend = 0, + cursorline = true, + winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel", }, - - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- the min_ and max_ options can be a list of mixed types. - -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" + + -- ========== Size Configuration ========== width = nil, - max_width = { 140, 0.8 }, - min_width = { 40, 0.2 }, + max_width = { 120, 0.8 }, + min_width = { 50, 0.4 }, height = nil, - max_height = 0.9, - min_height = { 10, 0.2 }, - - -- Set to `false` to disable + 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", }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf + }, + + -- ========== 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, }, - - -- Used to override format_item. See :help dressing-format - format_item_override = {}, - - -- see :help dressing_get_config - get_config = nil, + + -- ========== 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, }, }, } |