refactor(plugins): use astrocore
This commit is contained in:
parent
8a438a9449
commit
a36a9c8de0
2 changed files with 4 additions and 14 deletions
|
|
@ -34,20 +34,7 @@
|
||||||
rootOpts.keymaps = [
|
rootOpts.keymaps = [
|
||||||
{
|
{
|
||||||
key = "<leader>ua";
|
key = "<leader>ua";
|
||||||
|
action.__raw = "function() require('astrocore.toggles').autopairs() end";
|
||||||
# https://github.com/AstroNvim/astrocore/blob/v1.4.0/lua/astrocore/toggles.lua#L37-L50
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
local ok, autopairs = pcall(require, "nvim-autopairs")
|
|
||||||
if ok then
|
|
||||||
if autopairs.state.disabled then
|
|
||||||
autopairs.enable()
|
|
||||||
else
|
|
||||||
autopairs.disable()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
options.desc = "Toggle autopairs";
|
options.desc = "Toggle autopairs";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L136-L168
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L136-L168
|
||||||
copy_selector.__raw = ''
|
copy_selector.__raw = ''
|
||||||
function(state)
|
function(state)
|
||||||
|
local notify = require("astrocore").notify
|
||||||
local node = state.tree:get_node()
|
local node = state.tree:get_node()
|
||||||
local filepath = node:get_id()
|
local filepath = node:get_id()
|
||||||
local filename = node.name
|
local filename = node.name
|
||||||
|
|
@ -68,6 +69,7 @@
|
||||||
|
|
||||||
local options = vim.tbl_filter(function(val) return vals[val] ~= "" end, vim.tbl_keys(vals))
|
local options = vim.tbl_filter(function(val) return vals[val] ~= "" end, vim.tbl_keys(vals))
|
||||||
if vim.tbl_isempty(options) then
|
if vim.tbl_isempty(options) then
|
||||||
|
notify("No values to copy", vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
table.sort(options)
|
table.sort(options)
|
||||||
|
|
@ -77,6 +79,7 @@
|
||||||
}, function(choice)
|
}, function(choice)
|
||||||
local result = vals[choice]
|
local result = vals[choice]
|
||||||
if result then
|
if result then
|
||||||
|
notify(("Copied: `%s`"):format(result))
|
||||||
vim.fn.setreg("+", result)
|
vim.fn.setreg("+", result)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue