Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Nov 21, 2023
1 parent 4a37e4e commit cd445f8
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 16 deletions.
26 changes: 26 additions & 0 deletions src/conf/base/right-click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,34 @@ const FormatFileItem: RightClickMenuActionItem = {
keys: "c",
};

const CopilotGroup: RightClickMenuGroup = {
items: [
{
title: "Copilot",
children: [
{
title: "Copilot status",
actionId: "copilot.status",
keys: "s",
},
{
title: "Copilot auth",
actionId: "copilot.auth",
keys: "a",
},
{
title: "Copilot panel",
actionId: "copilot.show-panel",
keys: "p",
},
],
},
],
};

export const RightClickMenu: RightClickMenuItem[] = [
FormatFileItem,
CppToolkitGroup,
RustToolkitGroup,
CopilotGroup,
];
40 changes: 37 additions & 3 deletions src/conf/plugins/edit/copilot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Plugin, PluginOpts } from "@core/model";
import {
ActionGroupBuilder,
Plugin,
PluginOptsBase,
andActions,
} from "@core/model";

const spec: PluginOpts<[]> = {
const spec: PluginOptsBase = {
shortUrl: "zbirenbaum/copilot.lua",
lazy: {
event: ["InsertEnter"],
Expand Down Expand Up @@ -56,4 +61,33 @@ const spec: PluginOpts<[]> = {
},
};

export const plugin = new Plugin(spec);
function actions() {
return new ActionGroupBuilder()
.from("copilot.lua")
.category("Copilot")
.addOpts({
id: "copilot.status",
title: "Copilot status",
description: "Show the status of Copilot",
callback: () => {
vim.api.nvim_command("Copilot status");
},
})
.addOpts({
id: "copilot.auth",
title: "Copilot auth",
callback: () => {
vim.api.nvim_command("Copilot auth");
},
})
.addOpts({
id: "copilot.show-panel",
title: "Copilot panel",
callback: () => {
vim.api.nvim_command("Copilot panel");
},
})
.build();
}

export const plugin = new Plugin(andActions(spec, actions));
52 changes: 39 additions & 13 deletions src/conf/plugins/edit/markdown-preview-nivm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Plugin, PluginOpts, buildSimpleCommand } from "@core/model";
import {
ActionGroupBuilder,
Plugin,
PluginOptsBase,
andActions,
} from "@core/model";

const spec: PluginOpts<[]> = {
const spec: PluginOptsBase = {
shortUrl: "iamcco/markdown-preview.nvim",
lazy: {
ft: ["markdown"],
Expand All @@ -12,16 +17,37 @@ const spec: PluginOpts<[]> = {
vim.g.mkdp_echo_preview_url = true;
},
},
extends: {
commands: {
category: "MdPreview",
commands: [
buildSimpleCommand("Start md preview", "MarkdownPreview"),
buildSimpleCommand("Stop md preview", "MarkdownPreviewStop"),
buildSimpleCommand("Toggle md preview", "MarkdownPreviewToggle"),
],
},
},
};

export const plugin = new Plugin(spec);
function actions() {
return new ActionGroupBuilder()
.from("markdown-preview.nvim")
.category("MdPreview")
.condition((buf) => {
return buf.filetype === "markdown";
})
.addOpts({
id: "markdown-preview.start",
title: "Start md preview",
callback: () => {
vim.api.nvim_command("MarkdownPreview");
},
})
.addOpts({
id: "markdown-preview.stop",
title: "Stop md preview",
callback: () => {
vim.api.nvim_command("MarkdownPreviewStop");
},
})
.addOpts({
id: "markdown-preview.toggle",
title: "Toggle md preview",
callback: () => {
vim.api.nvim_command("MarkdownPreviewToggle");
},
})
.build();
}

export const plugin = new Plugin(andActions(spec, actions));

0 comments on commit cd445f8

Please sign in to comment.