Skip to content

[feat] Configurable preview window position: float, split, vsplit #121

Description

@adriancmiranda

Summary

Allow users to control where float-based previewers open (markdown, archive, cert, binary, font, key, sqlite) via a window config key and an optional :GlimpsePreview command argument.

Tasks

  • Extend :GlimpsePreview to accept optional [window] and [path] arguments, passing window directly to the previewer (no config involved yet)
  • Add window to global config with precedence resolution: command argument > global config > float (hard default)
  • Inline previewers (image, video) respect window for initial split direction (left/right); existing preview windows are always reused on their current side regardless of window value
  • Per-extension pipeline config override (pipelines[".md"] = { window = ... }), aligned with [v3] Pipeline-first architecture: delegate all conversion to external CLIs #92
  • size key (columns for right/left, lines for bottom/top)
  • bottom/top support for inline previewers

API

Command

:GlimpsePreview [window] [path]

[window] and [path] are both optional. When [path] is omitted, the current buffer is used. When [window] is omitted, config is consulted; if config is also absent, defaults to float.

Examples:

:GlimpsePreview                    " current buffer, float (default)
:GlimpsePreview right              " current buffer, split to the right
:GlimpsePreview float README.md
:GlimpsePreview right README.md
:GlimpsePreview bottom README.md

Config

require("glimpse").setup({
  window = 'right', -- global default: 'float' | 'right' | 'left' | 'bottom' | 'top'

  -- number: applies to all positions
  size = 80,

  -- table: per-position granularity (unset positions use Neovim's default split size)
  size = { left = 60, right = 80, bottom = 15, top = 10 },

  pipelines = {
    [".md"] = { window = 'right', size = 80 }, -- per-extension override (aligned with #92)
  },
})

Precedence

Command argument > per-extension config > global config > float (hard default, preserves current behavior)

Accepted values

Value Behavior
float floating window (default)
right vertical split to the right
left vertical split to the left
bottom horizontal split below
top horizontal split above

Notes

  • nil is a valid global config value - it means "no preference, let the command decide"
  • size accepts either a number (applies to all positions) or a table with per-position keys (left, right, bottom, top); when absent or unset for a position, Neovim's default split size applies
  • auto_open always uses the global/per-extension config (no command argument in that flow)
  • Aligns with the extension-first model proposed in [v3] Pipeline-first architecture: delegate all conversion to external CLIs #92

Known limitations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions