Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
feat(command): create DoMatchParen and NoMatchParen user commands
Browse files Browse the repository at this point in the history
  • Loading branch information
utilyre committed Mar 7, 2023
1 parent dc58643 commit a3753a0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lua/sentiment.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
local manager = require("sentiment.config.manager")
local autocmds = require("sentiment.autocmds")
local ui = require("sentiment.ui")

local M = {}

---Create matchparen.vim style user commands.
local function create_user_commands()
vim.api.nvim_create_user_command("NoMatchParen", function()
if not autocmds.renderer:exists() then return end

autocmds.renderer:remove()
ui.clear()
end, {})

vim.api.nvim_create_user_command("DoMatchParen", function()
if autocmds.renderer:exists() then return end

ui.render()
autocmds.renderer:create()
end, {})
end

---Load and setup the plugin with an optional config table.
---
---NOTE: Calling this disables the builtin matchparen plugin.
Expand All @@ -13,6 +31,7 @@ function M.setup(cfg)
manager.apply(cfg or {})

autocmds.renderer:create()
create_user_commands()
end

return M

0 comments on commit a3753a0

Please sign in to comment.