diff --git a/lua/preview/commands.lua b/lua/preview/commands.lua index 2c52c5a..c91f4de 100644 --- a/lua/preview/commands.lua +++ b/lua/preview/commands.lua @@ -1,8 +1,8 @@ local M = {} local handlers = { - compile = function() - require('preview').compile() + build = function() + require('preview').build() end, stop = function() require('preview').stop() @@ -10,8 +10,8 @@ local handlers = { clean = function() require('preview').clean() end, - toggle = function() - require('preview').toggle() + watch = function() + require('preview').watch() end, open = function() require('preview').open() @@ -33,7 +33,7 @@ local handlers = { ---@param args string local function dispatch(args) - local subcmd = args ~= '' and args or 'compile' + local subcmd = args ~= '' and args or 'build' local handler = handlers[subcmd] if handler then handler() @@ -58,7 +58,7 @@ function M.setup() complete = function(lead) return complete(lead) end, - desc = 'Compile, stop, clean, toggle, open, or check status of document preview', + desc = 'Build, stop, clean, watch, open, or check status of document preview', }) end diff --git a/lua/preview/init.lua b/lua/preview/init.lua index 7a380ba..bbf70f1 100644 --- a/lua/preview/init.lua +++ b/lua/preview/init.lua @@ -39,10 +39,10 @@ ---@class preview ---@field setup fun(opts?: table) ----@field compile fun(bufnr?: integer) +---@field build fun(bufnr?: integer) ---@field stop fun(bufnr?: integer) ---@field clean fun(bufnr?: integer) ----@field toggle fun(bufnr?: integer) +---@field watch fun(bufnr?: integer) ---@field open fun(bufnr?: integer) ---@field status fun(bufnr?: integer): preview.Status ---@field statusline fun(bufnr?: integer): string @@ -144,7 +144,7 @@ function M.build_context(bufnr) end ---@param bufnr? integer -function M.compile(bufnr) +function M.build(bufnr) bufnr = bufnr or vim.api.nvim_get_current_buf() local name = M.resolve_provider(bufnr) if not name then @@ -176,7 +176,7 @@ function M.clean(bufnr) end ---@param bufnr? integer -function M.toggle(bufnr) +function M.watch(bufnr) bufnr = bufnr or vim.api.nvim_get_current_buf() local name = M.resolve_provider(bufnr) if not name then diff --git a/spec/commands_spec.lua b/spec/commands_spec.lua index 931174f..32da224 100644 --- a/spec/commands_spec.lua +++ b/spec/commands_spec.lua @@ -17,7 +17,7 @@ describe('commands', function() it('does not error on :Preview with no provider', function() require('preview.commands').setup() assert.has_no.errors(function() - vim.cmd('Preview compile') + vim.cmd('Preview build') end) end) @@ -42,10 +42,10 @@ describe('commands', function() end) end) - it('does not error on :Preview toggle with no provider', function() + it('does not error on :Preview watch with no provider', function() require('preview.commands').setup() assert.has_no.errors(function() - vim.cmd('Preview toggle') + vim.cmd('Preview watch') end) end) end)