Add borders and background to floating windows
This commit is contained in:
parent
96fcac9aa0
commit
80d6db97cf
1
LOG.md
1
LOG.md
|
|
@ -9,6 +9,7 @@ Authoritative notes for the Neovim migration. Use this alongside `MIGRATION_PLAN
|
|||
|
||||
Record every decision here with a short rationale. Append new entries; do not rewrite history.
|
||||
|
||||
- 2025-01-13: **Popup borders for visibility**: Added rounded borders to all floating windows to prevent them from blending into the background. Changed `NormalFloat` and `FloatBorder` backgrounds from transparent (`c.NONE`) to `c.bg_ui` (slightly off-white) in colorscheme. Configured LSP handlers for hover and signature help to use `border = "rounded"`. Diagnostics already had borders configured. This provides clear visual separation between popups and main editor content.
|
||||
- 2025-01-13: **Git files to quickfix**: Added `<leader>gg` keymap to send all modified, deleted, and untracked Git files to quickfix list with status indicators. Uses `git status --porcelain` to parse file status (Modified, Deleted, Added, Untracked, etc.) and displays it in the quickfix text column. Implementation in `utils.git_changed_files()`. Complements existing `<leader>hq` (Gitsigns hunks to quickfix) with file-level Git status workflow.
|
||||
- 2025-01-12: **Custom Tabline Function**: Implemented configurable custom tabline to replace Neovim's hardcoded path shortening (e.g., `a/p/file.txt`). Function in `lua/utils.lua` allows controlling: (1) number of full parent directories via `utils.tabline_full_parents` (default: 1), and (2) shortening length via `utils.tabline_shorten_length` (default: 3 characters). Example: with defaults, `/path/to/my/project/src/file.txt` becomes `pat/to/my/project/src/file.txt`. User preference for seeing enough context in shortened paths while keeping tab width manageable.
|
||||
- 2025-12-06: PHP LSP = `intelephense` (good PHP ecosystem support; integrates includePaths).
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ return {
|
|||
-- ============================================================================
|
||||
|
||||
Normal = { fg = c.fg, bg = c.bg },
|
||||
NormalFloat = { fg = c.fg, bg = c.NONE },
|
||||
FloatBorder = { fg = c.fg_stronger, bg = c.NONE },
|
||||
NormalFloat = { fg = c.fg, bg = c.bg_ui },
|
||||
FloatBorder = { fg = c.fg_weaker, bg = c.bg_ui },
|
||||
|
||||
-- ============================================================================
|
||||
-- Cursor & Line Highlighting
|
||||
|
|
|
|||
|
|
@ -95,9 +95,55 @@ vim.diagnostic.config({
|
|||
update_in_insert = false, -- Don't update diagnostics while typing
|
||||
severity_sort = true, -- Sort by severity (errors first)
|
||||
float = {
|
||||
border = "rounded",
|
||||
border = "single",
|
||||
source = "always", -- Show diagnostic source
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
|
||||
-- Configure LSP floating windows with borders and padding
|
||||
-- Custom border with box-drawing characters flush to window edges
|
||||
-- Using heavy/light box-drawing characters positioned at cell edges
|
||||
local border = {
|
||||
{ "🭽", "FloatBorder" }, -- top-left corner
|
||||
{ "▔", "FloatBorder" }, -- top horizontal line (at top edge)
|
||||
{ "🭾", "FloatBorder" }, -- top-right corner
|
||||
{ "▕", "FloatBorder" }, -- right vertical line (at right edge)
|
||||
{ "🭿", "FloatBorder" }, -- bottom-right corner
|
||||
{ "▁", "FloatBorder" }, -- bottom horizontal line (at bottom edge)
|
||||
{ "🭼", "FloatBorder" }, -- bottom-left corner
|
||||
{ "▏", "FloatBorder" }, -- left vertical line (at left edge)
|
||||
}
|
||||
|
||||
-- Override the default open_floating_preview to add padding by modifying content
|
||||
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
|
||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = opts.border or border
|
||||
|
||||
-- Add padding by wrapping content with empty lines and spacing
|
||||
if type(contents) == "table" and #contents > 0 then
|
||||
-- Add empty lines at top and bottom
|
||||
table.insert(contents, 1, "")
|
||||
table.insert(contents, 1, "")
|
||||
table.insert(contents, "")
|
||||
table.insert(contents, "")
|
||||
|
||||
-- Add horizontal padding (spaces) to each content line
|
||||
for i = 3, #contents - 2 do
|
||||
if type(contents[i]) == "string" then
|
||||
contents[i] = " " .. contents[i] .. " "
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return orig_util_open_floating_preview(contents, syntax, opts, ...)
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = border,
|
||||
})
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = border,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue