liveserver.nvim lets you run and manage live-server directly in Neovim. Start, stop, and switch servers with commands or a clickable lualine toggle. Lightweight, fast, and multi-server ready, perfect for web dev workflows.
key=val format) LiveServerSelect) require('lazy').setup {
{
'ankushbhagats/liveserver.nvim',
build = 'npm i -g live-server',
opts = {
colortype = "hex", -- hex | hl
args = { -- accepts live-server cli arguments.
port = 8080,
["no-browser"] = true,
-- filetypes = "*", -- show lualine component for all files.
-- ... add more ...
},
},
config = true
}
}
require("liveserver").setup({
filetypes = { -- specify files to show lualine toggle button. set: "*" to allow all files.
html = true,
css = true,
javascript = true,
typescript = true,
},
args = { -- this table hold actual ARGS of liveserver program.
port = 5555,
host = "127.0.0.1",
["no-browser"] = false, -- set true to prevent auto opening the browser.
watch = "*.html,*.css,*.js", -- automatically reload browser for specified files.
},
colortype = "hl", -- "hl" | "hex"
states = { -- default state config
idle = {
icon = "",
color = { -- hex colors only.
fg = "#aaddff",
bg = nil,
},
hl = { -- fg/bg: 1st value is the highlight group name, 2nd is hl value field to use.
fg = { "lualine_a_normal", "bg" },
bg = { "lualine_c_normal", "bg" },
},
text = "serve",
gui = "bold",
},
start = {
icon = "",
color = {
fg = "#ffee55",
bg = nil,
},
hl = {
fg = { "lualine_a_command", "bg" },
bg = { "lualine_c_normal", "bg" },
},
text = "starting…",
gui = "bold",
},
stop = {
icon = "",
color = {
fg = "#fc5600",
bg = nil,
},
hl = {
fg = { "lualine_a_replace", "bg" },
bg = { "lualine_c_normal", "bg" },
},
text = "stopping…",
gui = "bold",
},
running = {
icon = "",
color = {
fg = "#fc5600",
bg = nil,
},
hl = {
fg = { "lualine_a_replace", "bg" },
bg = { "lualine_c_normal", "bg" },
},
text = "port:",
gui = "bold",
},
},
})
:LiveServerStart [port] [dir] [key=val ...]Start a live-server instance.
:LiveServerStart 3000 ./public host=127.0.0.1 no-browser=true
Stop a running server. Stops current directory running port by default. Can stop any port:
:LiveServerStop 4001
Interactive selector for running servers. Workflow:
Shows a liveserver toggle button in your statusline.
| State | Meaning |
|---|---|
| Idle | Server not running |
| Starting | Server launching |
| Running | Server active (shows port) |
| Stopping | Server shutting down |
Feel free to open issues or submit PRs to improve themes, add integrations, or enhance features.
GNU General Public License v3