nvim/Q/Is there a quick way to use glow to preview the current markdown file while editing in nvim?
Is there a quick way to use glow to preview the current Markdown file while editing in nvim? card
My Answer
Haven't found a good answer to this yet
- I'm looking for something in vim that displays markdown as well as glow for flipping between reading mode and editing mode.
- I'm currently using LazyVim/plugins/extras/lang/markdown, which bundles nvim/Plugin/render-markdown.nvim for in-buffer rendering (toggle
<leader>um) and nvim/Plugin/markdown-preview.nvim for browser preview
Current Workaround - vim/split/v
vsplit:vsplit | terminal glow -p %opens a vertical split using nvim's built-in terminal buffer, which renders glow's ANSI output properly.terminalopens a proper PTY (pseudoterminal) buffer in nvim that renders ANSI escape codes;:!glow %runs in a non-PTY subprocess and strips ANSI sequences, showing garbled text- In vim's command-line mode,
%is a special filename modifier that expands to the current buffer's filename — soglow -p %becomesglow -p /path/to/file.md
Extra
- To map it to
<leader>mg, add toinit.lua: - Press
qto quit the glow pager, then<C-w>cto close the split.
- To map it to
AI Answer
- AI/Response
- Short answer:
:vsplit | terminal glow -p %— opens a vertical split and pipes the file through glow in nvim's terminal buffer, which renders ANSI output properly.:!glow %runs glow outside the nvim UI and produces no visible output inside the editor. Add a keybind for repeat use
tmux split (zero Lua)
Richer in-buffer rendering (no glow process)
- nvim/Plugin/render-markdown.nvim renders Markdown decorations inline using Neovim's virtual-text UI — no external CLI needed, and it updates as you type.
Sources
- Short answer:
- AI/Response