Did you read the documentation and check existing issues?
Neovim version (nvim -v)
0.12.3
Operating system/version
macos 26.6
Browser/version
149.0.7827.200
Describe the bug
live-preview.nvim currently accepts a configured port, but port = 0 does not work as expected.
On systems where binding to port 0 should let the OS choose an ephemeral port, the plugin still keeps using the configured value 0 afterward when it:
- checks whether the port is already in use
- builds the preview URL
- opens the browser
- reports health/runtime state
As a result, users cannot use port = 0 to request a random available port, and the final assigned port is not exposed anywhere.
Using port = 0 is a standard way to avoid fixed-port conflicts, especially in:
- remote development
- SSH sessions
- multiple concurrent Neovim instances
- environments where a static preview port is frequently occupied
Steps To Reproduce
- Clone the plugin
git clone https://github.com/brianhuster/live-preview.nvim
- Open Nvim with minimal repro file
nvim -u minimal_init.lua
- ...
Expected Behavior
- The server should bind successfully on an OS-assigned ephemeral port.
- The plugin should discover the effective port after bind/listen.
- The browser should open the real URL, for example http://127.0.0.1:54321/....
- The effective port should be available to users, for example through plugin state or a public API.
Health
livepreview: 1 ❌
- ❌ ERROR No healthcheck found for "livepreview" plugin.
Minimal config to reproduce
vim.cmd.set "rtp+=/path/to/live-preview.nvim"
require("livepreview.config").set({
address = "127.0.0.1",
port = 0,
})
Did you read the documentation and check existing issues?
:h livepreview, Wiki)Neovim version (nvim -v)
0.12.3
Operating system/version
macos 26.6
Browser/version
149.0.7827.200
Describe the bug
live-preview.nvimcurrently accepts a configuredport, butport = 0does not work as expected.On systems where binding to port
0should let the OS choose an ephemeral port, the plugin still keeps using the configured value0afterward when it:As a result, users cannot use
port = 0to request a random available port, and the final assigned port is not exposed anywhere.Using port = 0 is a standard way to avoid fixed-port conflicts, especially in:
Steps To Reproduce
git clone https://github.com/brianhuster/live-preview.nvimnvim -u minimal_init.luaExpected Behavior
Health
Minimal config to reproduce