Skip to content

Commit

Permalink
feat
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Nov 21, 2023
1 parent 0895628 commit 4f8ca54
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/conf/plugins/other/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export const plugins = [
octoNvim,
restNvim,
ghActionNvim,
];
] as const;
93 changes: 43 additions & 50 deletions src/conf/plugins/other/rest-nvim.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
import { RightClickIndexes } from "@conf/base";
import { Plugin } from "@core/model";
import {
ActionGroupBuilder,
Plugin,
PluginOptsBase,
andActions,
} from "@core/model";

export const plugin = new Plugin({
function generateActions() {
return ActionGroupBuilder.start()
.from("rest.nvim")
.category("Rest")
.condition((buf) => {
let [ret] = string.match(buf.fullFileName, ".*%.http");
return ret !== null;
})
.addOpts({
id: "rest-nvim.run-request",
title: "Run the request under cursor",
callback: () => {
luaRequire("rest-nvim").run();
},
})
.addOpts({
id: "rest-nvim.preview-curl-command",
title: "Preview the request cURL command",
callback: () => {
luaRequire("rest-nvim").run(true);
},
})
.addOpts({
id: "rest-nvim.rerun-last-command",
title: "Re-run the last command",
callback: () => {
luaRequire("rest-nvim").last();
},
})
.build();
}

const spec: PluginOptsBase = {
shortUrl: "rest-nvim/rest.nvim",
lazy: {
opts: {
Expand All @@ -14,51 +51,7 @@ export const plugin = new Plugin({
luaRequire("rest-nvim").setup(opts);
},
},
allowInVscode: true,
extends: {
commands: {
enabled: (buf) => {
let [ret] = string.match(buf.fullFileName, ".*%.http");
return ret !== null;
},
rightClick: {
path: [{ title: "Http", keys: ["h"], index: RightClickIndexes.http }],
},
commands: [
{
name: "Run the request under cursor",
callback: () => {
luaRequire("rest-nvim").run();
},
rightClick: {
title: "Exec request",
keys: ["r"],
index: 1,
},
},
{
name: "Preview the request cURL command",
callback: () => {
luaRequire("rest-nvim").run(true);
},
rightClick: {
title: "Preview cURL",
keys: ["c"],
index: 2,
},
},
{
name: "Re-run the last command",
callback: () => {
luaRequire("rest-nvim").last();
},
rightClick: {
title: "Re-run last",
keys: ["l"],
index: 3,
},
},
],
},
},
});
allowInVscode: true,
};

export const plugin = new Plugin(andActions(spec, generateActions));
32 changes: 20 additions & 12 deletions src/conf/plugins/other/tmuxline.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
import { Plugin, PluginOpts } from "@core/model";
import {
ActionGroupBuilder,
Plugin,
PluginOpts,
andActions,
} from "@core/model";

const spec: PluginOpts = {
shortUrl: "edkolev/tmuxline.vim",
lazy: {
lazy: true,
cmd: ["Tmuxline"],
},
extends: {
commands: [
{
name: "Update current tmux theme",
callback: () => {
vim.api.nvim_command("Tmuxline");
},
},
],
},
};

export const plugin = new Plugin(spec);
function generateActions() {
return ActionGroupBuilder.start()
.category("Tmuxline")
.addOpts({
id: "tmuxline.update",
title: "Update current tmux theme",
callback: () => {
vim.api.nvim_command("Tmuxline");
},
})
.build();
}

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

0 comments on commit 4f8ca54

Please sign in to comment.