feat: add <Plug> mappings (#27)

## Problem

Users who want keybindings must call Lua functions directly or wrap
commands in closures. There is no stable public API for key binding.

## Solution

Define <Plug> mappings in the plugin file and document them in a new
MAPPINGS section in the vimdoc.
This commit is contained in:
Barrett Ruth 2026-02-07 14:02:00 -05:00 committed by GitHub
parent a59bec1ae3
commit 26dafe2f08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 3 deletions

View file

@ -14,3 +14,13 @@ end, { nargs = '?' })
vim.api.nvim_create_user_command('LiveServerToggle', function(opts)
require('live-server').toggle(opts.args)
end, { nargs = '?' })
vim.keymap.set('n', '<Plug>(live-server-start)', function()
require('live-server').start()
end, { desc = 'Start live server' })
vim.keymap.set('n', '<Plug>(live-server-stop)', function()
require('live-server').stop()
end, { desc = 'Stop live server' })
vim.keymap.set('n', '<Plug>(live-server-toggle)', function()
require('live-server').toggle()
end, { desc = 'Toggle live server' })