Merge pull request #25 from barrettruth/docs/modernize
docs: modernize readme and vimdoc
This commit is contained in:
commit
771d8d7b38
2 changed files with 46 additions and 63 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
*live-server* *live-server.txt*
|
live-server *live-server.txt*
|
||||||
|
|
||||||
Author: Barrett Ruth <https://barrettruth.com>
|
Author: Barrett Ruth <https://barrettruth.com>
|
||||||
Homepage: <https://github.com/barrett-ruth/live-server.nvim>
|
Homepage: <https://github.com/barrettruth/live-server.nvim>
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
INTRODUCTION *live-server.nvim*
|
INTRODUCTION *live-server.nvim*
|
||||||
|
|
@ -9,45 +9,35 @@ INTRODUCTION *live-server.nvim*
|
||||||
live-server.nvim automatically reloads HTML, CSS, and JavaScript files in the
|
live-server.nvim automatically reloads HTML, CSS, and JavaScript files in the
|
||||||
browser via a local development server.
|
browser via a local development server.
|
||||||
|
|
||||||
Author: Barrett Ruth <https://barrett-ruth.github.io>
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
SETUP *live-server.setup()*
|
CONFIGURATION *live-server.config*
|
||||||
>lua
|
|
||||||
require('live-server').setup(config)
|
|
||||||
<
|
|
||||||
Parameters: ~
|
|
||||||
|
|
||||||
{config} `(table | nil)`: (Optional) table containing configuration for
|
Configure via `vim.g.live_server` before the plugin loads:
|
||||||
live-server. Defaults shown below.
|
|
||||||
|
|
||||||
Usage: ~
|
|
||||||
>lua
|
>lua
|
||||||
require('live-server').setup {
|
vim.g.live_server = {
|
||||||
-- Arguments passed to live-server via `vim.fn.jobstart()`
|
args = { '--port=5555' },
|
||||||
-- Run `live-server --help` to see list of available options
|
|
||||||
-- For example, to use port 7000 and browser firefox:
|
|
||||||
-- args = { '--port=7000', '--browser=firefox' }
|
|
||||||
args = {}
|
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
Options: ~
|
||||||
|
|
||||||
|
{args} `(string[])`: Arguments passed to live-server via `vim.fn.jobstart()`.
|
||||||
|
Run `live-server --help` to see available options.
|
||||||
|
Default: { '--port=5555' }
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
COMMANDS *live-server.commands*
|
COMMANDS *live-server.commands*
|
||||||
|
|
||||||
*LiveServerStart*
|
*LiveServerStart*
|
||||||
:LiveServerStart [dir] Start the live server. If an optional argument `dir`
|
:LiveServerStart [dir] Start the live server. If `dir` is provided, the
|
||||||
is provided, the server will start in the specified
|
server starts in the specified directory.
|
||||||
directory.
|
|
||||||
|
|
||||||
*LiveServerStop*
|
*LiveServerStop*
|
||||||
:LiveServerStop [dir] Stop the live server. If an optional argument `dir`
|
:LiveServerStop [dir] Stop the live server. If `dir` is provided, stops
|
||||||
is provided, the server will stop the server running
|
the server running in the specified directory.
|
||||||
in the specified directory.
|
|
||||||
|
|
||||||
*LiveServerToggle*
|
*LiveServerToggle*
|
||||||
:LiveServerToggle [dir] Toggle the live server on or off. If an optional
|
:LiveServerToggle [dir] Toggle the live server on or off. If `dir` is
|
||||||
argument `dir` is provided, the server will be
|
provided, toggles the server in that directory.
|
||||||
toggled in the specified directory.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
vim:tw=80:ft=help:
|
vim:tw=80:ft=help:
|
||||||
|
|
|
||||||
57
readme.md
57
readme.md
|
|
@ -1,53 +1,46 @@
|
||||||
# live-server.nvim
|
# live-server.nvim
|
||||||
|
|
||||||
Live reload HTML, CSS, and JavaScript files inside neovim with the power of
|
Live reload HTML, CSS, and JavaScript files inside Neovim with the power of
|
||||||
[live-server](https://www.npmjs.com/package/live-server).
|
[live-server](https://www.npmjs.com/package/live-server).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Install [live-server](https://www.npmjs.com/package/live-server) globally
|
Install using your package manager of choice or via
|
||||||
with your node.js package manager of choice.
|
[luarocks](https://luarocks.org/modules/barrettruth/live-server.nvim):
|
||||||
|
|
||||||
2. Install regularly with your neovim package manager
|
|
||||||
|
|
||||||
For example, a config with [pnpm](https://pnpm.io) and
|
|
||||||
[lazy.nvim](https://github.com/folke/lazy.nvim) may look like the following:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
require('lazy').setup {
|
|
||||||
{
|
|
||||||
'barrettruth/live-server.nvim',
|
|
||||||
build = 'pnpm add -g live-server',
|
|
||||||
cmd = { 'LiveServerStart', 'LiveServerStop' },
|
|
||||||
config = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
luarocks install live-server.nvim
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- [live-server](https://www.npmjs.com/package/live-server) (install globally via
|
||||||
|
npm/pnpm/yarn)
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Configure via the setup function (or use the defaults with no arguments):
|
Configure via `vim.g.live_server` before the plugin loads:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('live-server').setup(opts)
|
vim.g.live_server = {
|
||||||
|
args = { '--port=5555' },
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See `:h live-server` for more information
|
See `:help live-server` for available options.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
`:LiveServerStart`: start the live server
|
```vim
|
||||||
|
:LiveServerStart [dir] " Start the server
|
||||||
|
:LiveServerStop [dir] " Stop the server
|
||||||
|
:LiveServerToggle [dir] " Toggle the server
|
||||||
|
```
|
||||||
|
|
||||||
`:LiveServerStop`: stop the live server
|
The server runs by default on `http://localhost:5555`.
|
||||||
|
|
||||||
## Development Server
|
## Documentation
|
||||||
|
|
||||||
The server runs by default on `http://localhost:5555`. You can access your project by opening this URL in your web browser.
|
```vim
|
||||||
|
:help live-server.nvim
|
||||||
## Acknowledgements
|
```
|
||||||
|
|
||||||
1. [mazeloth/live-server](https://github.com/manzeloth/live-server/blob/main/plugin/live-server.vim):
|
|
||||||
the first ever live-server port to vim
|
|
||||||
2. [aurum77/live-server.nvim](https://github.com/aurum77/live-server.nvim): the
|
|
||||||
first live-server port to neovim (however, it unecessarily depends on `npm`
|
|
||||||
and didn't quite cut it for me)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue