Skip to content

feat: inline preview respects window side (left/right)#126

Draft
adriancmiranda wants to merge 1 commit into
mainfrom
feat/inline-preview-side
Draft

feat: inline preview respects window side (left/right)#126
adriancmiranda wants to merge 1 commit into
mainfrom
feat/inline-preview-side

Conversation

@adriancmiranda

@adriancmiranda adriancmiranda commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Closes #121

Note

Float-based previewers (markdown, archive, cert, binary, font, key, sqlite) do not yet respect window. Full support, including per-extension override and size, is deferred to after #92 and the size key are implemented.

Summary

  • Propagates window config through the full call chain: init.lua -> image.lua -> preview_route.lua -> inline.lua
  • Inline preview() now accepts opts.window ('left'/'right') and uses it to decide the split direction on first open
  • Existing marked preview windows are always reused on their current side, regardless of window value -- preserves the Oil.nvim workflow where the preview stays in the same split
  • Adds window = nil to the default config schema so cfg.window is always a valid field
  • When Oil calls M.preview() without opts, cfg.window is now consulted as fallback
  • Video preview (video.lua) now respects window for both thumbnail and animated paths; Oil passes cfg.window explicitly when calling video.preview()
  • Fixes model.lua unwrap guard: source_win.window is only used as a window ID when it is actually a number; string position values ('left', 'right') are ignored, preventing E5108 regression introduced by this branch

Test plan

  • Set window = 'left' in setup: first <leader>p in Oil opens image preview to the left of Oil
  • Set window = 'left' in setup: first <leader>p in Oil opens video preview to the left of Oil
  • Subsequent <leader>p presses reuse the same split, regardless of which file is previewed
  • :GlimpsePreview left and :GlimpsePreview right still work from any buffer
  • No window in config: behavior unchanged (preview opens to the right)
  • Navigate to a 3D model file in Oil and trigger preview: no E5108 error

@adriancmiranda adriancmiranda self-assigned this Jun 27, 2026
@adriancmiranda adriancmiranda added the enhancement New feature or request label Jun 27, 2026
@adriancmiranda
adriancmiranda force-pushed the feat/inline-preview-side branch from 168be55 to 9803ae9 Compare June 27, 2026 14:08
@adriancmiranda
adriancmiranda marked this pull request as draft June 27, 2026 14:11
@adriancmiranda
adriancmiranda force-pushed the feat/inline-preview-side branch 2 times, most recently from 8b5ff9a to f83bcd8 Compare June 27, 2026 20:09
@adriancmiranda
adriancmiranda force-pushed the feat/inline-preview-side branch from f83bcd8 to b43dcc6 Compare June 27, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant