-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdefault.lua
85 lines (70 loc) · 1.56 KB
/
default.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
return {
{
name = "Format Buffer",
cmd = function()
local ok, conform = pcall(require, "conform")
if ok then
conform.format { lsp_fallback = true }
else
vim.lsp.buf.format()
end
end,
rtxt = "<leader>fm",
},
{
name = "Code Actions",
cmd = vim.lsp.buf.code_action,
rtxt = "<leader>ca",
},
{ name = "separator" },
{
name = " Lsp Actions",
hl = "Exblue",
items = "lsp",
},
{ name = "separator" },
{
name = "Edit Config",
cmd = function()
vim.cmd "tabnew"
local conf = vim.fn.stdpath "config"
vim.cmd("tcd " .. conf .. " | e init.lua")
end,
rtxt = "ed",
},
{
name = "Copy Content",
cmd = "%y+",
rtxt = "<C-c>",
},
{
name = "Delete Content",
cmd = "%d",
rtxt = "dc",
},
{ name = "separator" },
{
name = " Open in terminal",
hl = "ExRed",
cmd = function()
local old_buf = require("menu.state").old_data.buf
local old_bufname = vim.api.nvim_buf_get_name(old_buf)
local old_buf_dir = vim.fn.fnamemodify(old_bufname, ":h")
local cmd = "cd " .. old_buf_dir
-- base46_cache var is an indicator of nvui user!
if vim.g.base46_cache then
require("nvchad.term").new { cmd = cmd, pos = "sp" }
else
vim.cmd "enew"
vim.fn.termopen { vim.o.shell, "-c", cmd .. " ; " .. vim.o.shell }
end
end,
},
{ name = "separator" },
{
name = " Color Picker",
cmd = function()
require("minty.huefy").open()
end,
},
}