feat: modernize the plugin
This commit is contained in:
parent
03807e46e0
commit
94f5828a0a
4 changed files with 227 additions and 48 deletions
|
|
@ -3,4 +3,20 @@ if vim.g.loaded_cp then
|
|||
end
|
||||
vim.g.loaded_cp = 1
|
||||
|
||||
require("cp").setup()
|
||||
local competition_types = { "atcoder", "codeforces", "cses" }
|
||||
|
||||
vim.api.nvim_create_user_command("CP", function(opts)
|
||||
local cp = require("cp")
|
||||
if not cp.is_initialized() then
|
||||
cp.setup()
|
||||
end
|
||||
cp.handle_command(opts)
|
||||
end, {
|
||||
nargs = "*",
|
||||
complete = function(ArgLead, _, _)
|
||||
local commands = vim.list_extend(vim.deepcopy(competition_types), { "run", "debug", "diff" })
|
||||
return vim.tbl_filter(function(cmd)
|
||||
return cmd:find(ArgLead, 1, true) == 1
|
||||
end, commands)
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue