| English | 日本語 |
serve.nvim
is a Neovim plugin that allows you to start and stop a simple HTTP server directly from Neovim. By default, it uses Python's built-in HTTP server.
- Start and stop an HTTP server easily from Neovim
- Automatically stop the server process when exiting Neovim
- Uses port
8000
by default (configurable)
- Neovim 0.5+
- plenary.nvim
- Python 3 (for HTTP server functionality)
Specify wsl=true if you're using WSL2, or wsl=false if you don't currently have it.
use {
'Kokecoco/serve.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require("serve").setup({wsl = true})
end
}
return {
"Kokecoco/serve.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("serve").setup({wsl = true})
end,
}
:Serve [port]
- Starts the HTTP server.
- If no
port
is provided, the default port8000
is used. - If you set wsl to true, the browser will automatically open using the wslview command.
Examples:
:Serve
:Serve 8080
:ServeStop
- Stops the running HTTP server.
Examples:
:ServeStop
- The server process will be automatically stopped when Neovim exits (e.g., via
:q
or:qa
).
This error occurs if the specified port is already in use. You can resolve the issue by following these steps:
-
Check if the server process is properly stopped:
lsof -i :<port>
-
Terminate the process if necessary:
kill -9 <PID>
For bug reports or feature requests, please visit the GitHub Issues page.
This plugin is licensed under the MIT License.