Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
column_width = 120
line_endings = "Unix"
# Neovim runs LuaJIT; pin the dialect so goto/label syntax (::continue::,
# ::finalize::) parses unambiguously instead of clashing with Luau labels.
syntax = "LuaJIT"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
no_call_parentheses = true
collapse_simple_statement = "ConditionalOnly"
13 changes: 5 additions & 8 deletions lua/md-render/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function M.dispatch(args)
elseif sub == "toggle" then
p.toggle()
elseif sub == "split" then
p.split({ mods = args.smods })
p.split { mods = args.smods }
elseif sub == "demo" then
p.show_demo()
elseif sub == "auto" then
Expand All @@ -38,10 +38,7 @@ function M.dispatch(args)
elseif a == "toggle" then
p.auto_toggle()
else
vim.notify(
"MdRender auto: unknown argument '" .. a .. "' (expected on|off|toggle)",
vim.log.levels.WARN
)
vim.notify("MdRender auto: unknown argument '" .. a .. "' (expected on|off|toggle)", vim.log.levels.WARN)
end
else
vim.notify(
Expand All @@ -57,16 +54,16 @@ end
---@param cmdline string The full command line so far.
---@return string[]
function M.complete(arglead, cmdline, _cursorpos)
local tail = cmdline:match("MdRender%s+(.*)$") or ""
local tail = cmdline:match "MdRender%s+(.*)$" or ""
local before = tail:sub(1, #tail - #arglead)
local n = 0
for _ in before:gmatch("%S+") do
for _ in before:gmatch "%S+" do
n = n + 1
end
local list
if n == 0 then
list = SUBCOMMANDS
elseif n == 1 and before:match("^%s*auto%s+$") then
elseif n == 1 and before:match "^%s*auto%s+$" then
list = AUTO_ARGS
else
return {}
Expand Down
Loading
Loading