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 = [
|
||||
{
|
||||
key = "<leader>ua";
|
||||
|
||||
# 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
|
||||
'';
|
||||
action.__raw = "function() require('astrocore.toggles').autopairs() end";
|
||||
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
|
||||
copy_selector.__raw = ''
|
||||
function(state)
|
||||
local notify = require("astrocore").notify
|
||||
local node = state.tree:get_node()
|
||||
local filepath = node:get_id()
|
||||
local filename = node.name
|
||||
|
|
@ -68,6 +69,7 @@
|
|||
|
||||
local options = vim.tbl_filter(function(val) return vals[val] ~= "" end, vim.tbl_keys(vals))
|
||||
if vim.tbl_isempty(options) then
|
||||
notify("No values to copy", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
table.sort(options)
|
||||
|
|
@ -77,6 +79,7 @@
|
|||
}, function(choice)
|
||||
local result = vals[choice]
|
||||
if result then
|
||||
notify(("Copied: `%s`"):format(result))
|
||||
vim.fn.setreg("+", result)
|
||||
end
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue