-
-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Alpha.nvim's broken after refactor #944
Comments
Indeed, we have refactored this plugin and got rid of some opinionated code that we were shipping by default. To achieve the same config, you have to change the button definitions from {
command = "<COMMAND>";
desc = "<DESC>";
shortcut = "<SC>";
} to {
type = "button";
val = "<DESC>";
on_press.raw = "function() vim.api.nvim_feedkeys("<SC>", "t", false) end";
# OR
on_press.raw = "funcion() vim.cmd[[<COMMAND>]] end";
opts = {
keymap = ["n" "<SC>" "<COMMAND>" {noremap = true; silent = true; nowait = true;}];
shortcut = "<SC>";
# Feel free to customize (or omit) those
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
} For example, {
command = ":Telescope live_grep <CR>";
desc = " Find text";
shortcut = "g";
} would give {
type = "button";
val = " Find text";
on_press.raw = "require('telescope.builtin').live_grep";
opts = {
keymap = ["n" "g" ":Telescope live_grep <CR>" {noremap = true; silent = true; nowait = true;}];
shortcut = "g";
# Feel free to customize (or omit) those
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
} This is indeed more verbose, but the nixvim philosophy is to respect the options from the plugins and sometimes provide optional helpers. |
PS: You can also factorize this in nix using an approach similar as in https://github.com/hbjydev/hvim/blob/3bc249f9a4489ba7150ced08c1d448dbbf5a737a/config/ui/dashboard/default.nix. |
The test configuration seems the throw the same error. Using the latest revision (8104e24): plugins.alpha = {
enable = true;
iconsEnabled = true;
layout = [
{
type = "padding";
val = 2;
}
{
type = "text";
val = [
"███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
"████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
"██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
"██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
"██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
"╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
];
opts = {
position = "center";
hl = "Type";
};
}
{
type = "padding";
val = 2;
}
{
type = "group";
val = [
{
val = " New file";
on_press.__raw = "function() vim.cmd[[ene]] end";
}
{
val = " Quit Neovim";
on_press.__raw = "function() vim.cmd[[qa]] end";
}
];
}
{
type = "padding";
val = 2;
}
{
type = "text";
val = "Inspiring quote here.";
opts = {
position = "center";
hl = "Keyword";
};
}
];
opts = {
margin = 0;
noautocmd = true;
keymap = {
press = "<CR>";
press_queue = "<M-CR>";
};
};
};
|
Indeed, this is a "bug" from alpha itself. Thanks for pointing it out :) |
Plugin affected: Alpha.nvim
Nixpkgs channel: Unstable
Home-manager version: Master
Description
Alpha.nvim breaks when using type = "group" option for plugins.alpha.layout
When using that option I get the following error:
Config
The text was updated successfully, but these errors were encountered: