demo-live-server.mov
- Always find and run the index.html file regardless of where you are in the project root
- Run the currently opened file
- install the plugin with lazy.nvim as you would for any other:
require("lazy").setup({
{
"ngtuonghy/live-server-nvim",
event = "VeryLazy",
build = ":LiveServerInstall",
config = functions()
require("live-server-nvim").setup{}
},
})
- live-server-nvim will not run without setup
require('live-server-nvim').setup {
custom = {
"--port=8080",
"--no-css-inject",
},
serverPath = vim.fn.stdpath("data") .. "/live-server/", --default
open = "folder", -- folder|cwd --default
}
- Supported customized see live-server
LiveServerStart--Run server
LiveServerStart -f -- Serve the currently open file (Note: for this to work, `open` mode in setup must be set to "folder")
LiveServerStop --Stop server
LiveServerToggle --Toggle server
vim.keymap.set("n", "<leader>lt", function() require("live-server-nvim").toggle() end)
Many thanks to those who have contributed to the project!