mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 15:35:30 +00:00
Merge branch 'NotAShelf:main' into feature-language-tex
This commit is contained in:
commit
c9f1bdf167
10 changed files with 267 additions and 211 deletions
|
|
@ -14,7 +14,7 @@ indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[*.{js,json,nix,yml,yaml}]
|
[*.{js,json,nix,yml,yaml,toml}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
|
||||||
2
.github/README.md
vendored
2
.github/README.md
vendored
|
|
@ -237,7 +237,7 @@ customizability of plugin inputs, which is one of our primary features.
|
||||||
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
|
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
|
||||||
of a configuration generated from Nix?
|
of a configuration generated from Nix?
|
||||||
|
|
||||||
**A**: Yes! Add `"~/.config.nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
|
**A**: Yes! Add `"~/.config/nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
|
||||||
any plugins you want to load to `vim.startPlugins`. This will load your
|
any plugins you want to load to `vim.startPlugins`. This will load your
|
||||||
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
||||||
Neovim's behaviour with Nix.
|
Neovim's behaviour with Nix.
|
||||||
|
|
|
||||||
11
.github/typos.toml
vendored
11
.github/typos.toml
vendored
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"]
|
files.extend-exclude = ["npins/sources.json"]
|
||||||
files.extend-exclude = [
|
default.extend-ignore-words-re = [
|
||||||
"npins/sources.json"
|
"(?i)(noice)",
|
||||||
|
"befores",
|
||||||
|
"annote",
|
||||||
|
"viw",
|
||||||
|
"BA", # somehow "BANanaD3V" is valid, but BA is not...
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
|
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
|
||||||
with builtins.
|
with builtins.
|
||||||
|
|
||||||
|
- `alpha` is now configured with nix, default config removed.
|
||||||
|
|
||||||
[NotAShelf](https://github.com/notashelf):
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||||
|
|
@ -52,6 +54,14 @@
|
||||||
|
|
||||||
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.autocmds) and [](#opt-vim.augroups) to allow declaring
|
||||||
|
autocommands via Nix.
|
||||||
|
|
||||||
|
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
|
||||||
|
backend while shada is disabled in Neovim options.
|
||||||
|
|
||||||
|
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||||
|
|
||||||
[amadaluzia](https://github.com/amadaluzia):
|
[amadaluzia](https://github.com/amadaluzia):
|
||||||
|
|
||||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||||
|
|
@ -227,3 +237,7 @@
|
||||||
[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme
|
[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme
|
||||||
|
|
||||||
- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme].
|
- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme].
|
||||||
|
|
||||||
|
[BANanaD3V](https://github.com/BANanaD3V):
|
||||||
|
|
||||||
|
- `alpha` is now configured with nix.
|
||||||
|
|
|
||||||
185
modules/neovim/init/autocmds.nix
Normal file
185
modules/neovim/init/autocmds.nix
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.lists) filter;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.types) nullOr submodule listOf str bool;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
|
autocommandType = submodule {
|
||||||
|
options = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable this autocommand";
|
||||||
|
};
|
||||||
|
|
||||||
|
event = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
example = ["BufRead" "BufWritePre"];
|
||||||
|
description = "The event(s) that trigger the autocommand.";
|
||||||
|
};
|
||||||
|
|
||||||
|
pattern = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
example = ["*.lua" "*.vim"];
|
||||||
|
description = "The file pattern(s) that determine when the autocommand applies).";
|
||||||
|
};
|
||||||
|
|
||||||
|
callback = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
example = literalExpression ''
|
||||||
|
mkLuaInline '''
|
||||||
|
function()
|
||||||
|
print("Saving a Lua file...")
|
||||||
|
end
|
||||||
|
''''
|
||||||
|
'';
|
||||||
|
description = "The file pattern(s) that determine when the autocommand applies.";
|
||||||
|
};
|
||||||
|
|
||||||
|
command = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Vim command string instead of a Lua function.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
example = "MyAutoCmdGroup";
|
||||||
|
description = "An optional autocommand group to manage related autocommands.";
|
||||||
|
};
|
||||||
|
|
||||||
|
desc = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
example = "Notify when saving a Lua file";
|
||||||
|
description = "A description for the autocommand.";
|
||||||
|
};
|
||||||
|
|
||||||
|
once = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether autocommand run only once.";
|
||||||
|
};
|
||||||
|
|
||||||
|
nested = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to allow nested autocommands to trigger.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
autogroupType = submodule {
|
||||||
|
options = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable this autogroup";
|
||||||
|
};
|
||||||
|
|
||||||
|
name = mkOption {
|
||||||
|
type = str;
|
||||||
|
example = "MyAutoCmdGroup";
|
||||||
|
description = "The name of the autocommand group.";
|
||||||
|
};
|
||||||
|
|
||||||
|
clear = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to clear existing autocommands in this group before defining new ones.
|
||||||
|
This helps avoid duplicate autocommands.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.vim;
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
augroups = mkOption {
|
||||||
|
type = listOf autogroupType;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
A list of Neovim autogroups, which are used to organize and manage related
|
||||||
|
autocommands together. Groups allow multiple autocommands to be cleared
|
||||||
|
or redefined collectively, preventing duplicate definitions.
|
||||||
|
|
||||||
|
Each autogroup consists of a name, a boolean indicating whether to clear
|
||||||
|
existing autocommands, and a list of associated autocommands.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
autocmds = mkOption {
|
||||||
|
type = listOf autocommandType;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
A list of Neovim autocommands to be registered.
|
||||||
|
|
||||||
|
Each entry defines an autocommand, specifying events, patterns, optional
|
||||||
|
callbacks, commands, groups, and execution settings.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
vim = let
|
||||||
|
enabledAutocommands = filter (cmd: cmd.enable) cfg.autocmds;
|
||||||
|
enabledAutogroups = filter (au: au.enable) cfg.augroups;
|
||||||
|
in {
|
||||||
|
luaConfigRC = {
|
||||||
|
augroups = entryAfter ["pluginConfigs"] (optionalString (enabledAutogroups != []) ''
|
||||||
|
local nvf_autogroups = {}
|
||||||
|
for _, group in ipairs(${toLuaObject enabledAutogroups}) do
|
||||||
|
if group.name then
|
||||||
|
nvf_autogroups[group.name] = { clear = group.clear }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for group_name, options in pairs(nvf_autogroups) do
|
||||||
|
vim.api.nvim_create_augroup(group_name, options)
|
||||||
|
end
|
||||||
|
'');
|
||||||
|
|
||||||
|
autocmds = entryAfter ["pluginConfigs"] (optionalString (enabledAutocommands != []) ''
|
||||||
|
local nvf_autocommands = ${toLuaObject enabledAutocommands}
|
||||||
|
for _, autocmd in ipairs(nvf_autocommands) do
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
autocmd.event,
|
||||||
|
{
|
||||||
|
group = autocmd.group,
|
||||||
|
pattern = autocmd.pattern,
|
||||||
|
buffer = autocmd.buffer,
|
||||||
|
desc = autocmd.desc,
|
||||||
|
callback = autocmd.callback,
|
||||||
|
command = autocmd.command,
|
||||||
|
once = autocmd.once,
|
||||||
|
nested = autocmd.nested
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
'');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = builtins.all (cmd: (cmd.command == null || cmd.callback == null)) cfg.autocmds;
|
||||||
|
message = "An autocommand cannot have both 'command' and 'callback' defined at the same time.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./autocmds.nix
|
||||||
./basic.nix
|
./basic.nix
|
||||||
./debug.nix
|
./debug.nix
|
||||||
./highlight.nix
|
./highlight.nix
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,23 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) listOf attrsOf anything nullOr enum;
|
||||||
in {
|
in {
|
||||||
options.vim.dashboard.alpha = {
|
options.vim.dashboard.alpha = {
|
||||||
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.mvim]";
|
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.nvim]";
|
||||||
|
theme = mkOption {
|
||||||
|
type = nullOr (enum ["dashboard" "startify" "theta"]);
|
||||||
|
default = "dashboard";
|
||||||
|
description = "Alpha default theme to use";
|
||||||
|
};
|
||||||
|
layout = mkOption {
|
||||||
|
type = listOf (attrsOf anything);
|
||||||
|
default = [];
|
||||||
|
description = "Alpha dashboard layout";
|
||||||
|
};
|
||||||
|
opts = mkOption {
|
||||||
|
type = attrsOf anything;
|
||||||
|
default = {};
|
||||||
|
description = "Optional global options";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,11 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.dashboard.alpha;
|
cfg = config.vim.dashboard.alpha;
|
||||||
|
themeDefined = cfg.theme != null;
|
||||||
|
layoutDefined = cfg.layout != [];
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
|
|
@ -14,207 +17,30 @@ in {
|
||||||
"nvim-web-devicons"
|
"nvim-web-devicons"
|
||||||
];
|
];
|
||||||
|
|
||||||
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
|
vim.pluginRC.alpha = let
|
||||||
# honestly, excellent work
|
setupOpts =
|
||||||
vim.pluginRC.alpha = entryAnywhere ''
|
if themeDefined
|
||||||
local alpha = require("alpha")
|
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
||||||
local plenary_path = require("plenary.path")
|
else {
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
inherit (cfg) layout opts;
|
||||||
local cdir = vim.fn.getcwd()
|
};
|
||||||
local if_nil = vim.F.if_nil
|
in ''
|
||||||
|
require('alpha').setup(${toLuaObject setupOpts})
|
||||||
local nvim_web_devicons = {
|
|
||||||
enabled = true,
|
|
||||||
highlight = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function get_extension(fn)
|
|
||||||
local match = fn:match("^.+(%..+)$")
|
|
||||||
local ext = ""
|
|
||||||
if match ~= nil then
|
|
||||||
ext = match:sub(2)
|
|
||||||
end
|
|
||||||
return ext
|
|
||||||
end
|
|
||||||
|
|
||||||
local function icon(fn)
|
|
||||||
local nwd = require("nvim-web-devicons")
|
|
||||||
local ext = get_extension(fn)
|
|
||||||
return nwd.get_icon(fn, ext, { default = true })
|
|
||||||
end
|
|
||||||
|
|
||||||
local function file_button(fn, sc, short_fn)
|
|
||||||
short_fn = short_fn or fn
|
|
||||||
local ico_txt
|
|
||||||
local fb_hl = {}
|
|
||||||
|
|
||||||
if nvim_web_devicons.enabled then
|
|
||||||
local ico, hl = icon(fn)
|
|
||||||
local hl_option_type = type(nvim_web_devicons.highlight)
|
|
||||||
if hl_option_type == "boolean" then
|
|
||||||
if hl and nvim_web_devicons.highlight then
|
|
||||||
table.insert(fb_hl, { hl, 0, 3 })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if hl_option_type == "string" then
|
|
||||||
table.insert(fb_hl, { nvim_web_devicons.highlight, 0, 3 })
|
|
||||||
end
|
|
||||||
ico_txt = ico .. " "
|
|
||||||
else
|
|
||||||
ico_txt = ""
|
|
||||||
end
|
|
||||||
local file_button_el = dashboard.button(sc, ico_txt .. short_fn, "<cmd>e " .. fn .. " <CR>")
|
|
||||||
local fn_start = short_fn:match(".*[/\\]")
|
|
||||||
if fn_start ~= nil then
|
|
||||||
table.insert(fb_hl, { "Comment", #ico_txt - 2, #fn_start + #ico_txt })
|
|
||||||
end
|
|
||||||
file_button_el.opts.hl = fb_hl
|
|
||||||
return file_button_el
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_mru_ignore = { "gitcommit" }
|
|
||||||
|
|
||||||
local mru_opts = {
|
|
||||||
ignore = function(path, ext)
|
|
||||||
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
--- @param start number
|
|
||||||
--- @param cwd string optional
|
|
||||||
--- @param items_number number optional number of items to generate, default = 10
|
|
||||||
local function mru(start, cwd, items_number, opts)
|
|
||||||
opts = opts or mru_opts
|
|
||||||
items_number = if_nil(items_number, 15)
|
|
||||||
|
|
||||||
local oldfiles = {}
|
|
||||||
for _, v in pairs(vim.v.oldfiles) do
|
|
||||||
if #oldfiles == items_number then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
local cwd_cond
|
|
||||||
if not cwd then
|
|
||||||
cwd_cond = true
|
|
||||||
else
|
|
||||||
cwd_cond = vim.startswith(v, cwd)
|
|
||||||
end
|
|
||||||
local ignore = (opts.ignore and opts.ignore(v, get_extension(v))) or false
|
|
||||||
if (vim.fn.filereadable(v) == 1) and cwd_cond and not ignore then
|
|
||||||
oldfiles[#oldfiles + 1] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local target_width = 35
|
|
||||||
|
|
||||||
local tbl = {}
|
|
||||||
for i, fn in ipairs(oldfiles) do
|
|
||||||
local short_fn
|
|
||||||
if cwd then
|
|
||||||
short_fn = vim.fn.fnamemodify(fn, ":.")
|
|
||||||
else
|
|
||||||
short_fn = vim.fn.fnamemodify(fn, ":~")
|
|
||||||
end
|
|
||||||
|
|
||||||
if #short_fn > target_width then
|
|
||||||
short_fn = plenary_path.new(short_fn):shorten(1, { -2, -1 })
|
|
||||||
if #short_fn > target_width then
|
|
||||||
short_fn = plenary_path.new(short_fn):shorten(1, { -1 })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local shortcut = tostring(i + start - 1)
|
|
||||||
|
|
||||||
local file_button_el = file_button(fn, shortcut, short_fn)
|
|
||||||
tbl[i] = file_button_el
|
|
||||||
end
|
|
||||||
return {
|
|
||||||
type = "group",
|
|
||||||
val = tbl,
|
|
||||||
opts = {},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_header = {
|
|
||||||
type = "text",
|
|
||||||
val = {
|
|
||||||
|
|
||||||
[[███ ██ ███████ ██████ ██ ██ ██ ███ ███]],
|
|
||||||
[[████ ██ ██ ██ ██ ██ ██ ██ ████ ████]],
|
|
||||||
[[██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ████ ██]],
|
|
||||||
[[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██]],
|
|
||||||
[[██ ████ ███████ ██████ ████ ██ ██ ██]],
|
|
||||||
|
|
||||||
-- [[ __ ]],
|
|
||||||
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
|
||||||
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
|
|
||||||
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
|
|
||||||
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
|
|
||||||
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
position = "center",
|
|
||||||
hl = "Type",
|
|
||||||
-- wrap = "overflow";
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local section_mru = {
|
|
||||||
type = "group",
|
|
||||||
val = {
|
|
||||||
{
|
|
||||||
type = "text",
|
|
||||||
val = "Recent files",
|
|
||||||
opts = {
|
|
||||||
hl = "SpecialComment",
|
|
||||||
shrink_margin = false,
|
|
||||||
position = "center",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ type = "padding", val = 1 },
|
|
||||||
{
|
|
||||||
type = "group",
|
|
||||||
val = function()
|
|
||||||
return { mru(0, cdir) }
|
|
||||||
end,
|
|
||||||
opts = { shrink_margin = false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local buttons = {
|
|
||||||
type = "group",
|
|
||||||
val = {
|
|
||||||
{ type = "text", val = "Quick links", opts = { hl = "SpecialComment", position = "center" } },
|
|
||||||
{ type = "padding", val = 1 },
|
|
||||||
-- TODO: buttons should be added based on whether or not the relevant plugin is available
|
|
||||||
dashboard.button("e", " New file", "<cmd>ene<CR>"), -- available all the time
|
|
||||||
dashboard.button("SPC F", " Find file"), -- telescope
|
|
||||||
dashboard.button("SPC ff", " Live grep"), -- telescope
|
|
||||||
dashboard.button("SPC p", " Projects"), -- any project
|
|
||||||
dashboard.button("q", " Quit", "<cmd>qa<CR>"), -- available all the time
|
|
||||||
},
|
|
||||||
position = "center",
|
|
||||||
}
|
|
||||||
|
|
||||||
local config = {
|
|
||||||
layout = {
|
|
||||||
{ type = "padding", val = 2 },
|
|
||||||
default_header,
|
|
||||||
{ type = "padding", val = 2 },
|
|
||||||
section_mru,
|
|
||||||
{ type = "padding", val = 2 },
|
|
||||||
buttons,
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
margin = 5,
|
|
||||||
setup = function()
|
|
||||||
vim.cmd([[
|
|
||||||
autocmd alpha_temp DirChanged * lua require('alpha').redraw()
|
|
||||||
]])
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
alpha.setup(config)
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = themeDefined || layoutDefined;
|
||||||
|
message = ''
|
||||||
|
One of 'theme' or 'layout' should be defined in Alpha configuration.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = !(themeDefined && layoutDefined);
|
||||||
|
message = ''
|
||||||
|
'theme' and 'layout' cannot be defined at the same time.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,6 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs-fmt = null; # removed
|
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||||
|
|
@ -219,7 +217,6 @@ in {
|
||||||
${concatStringsSep ", " (attrNames formats)}
|
${concatStringsSep ", " (attrNames formats)}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
assertion = cfg.lsp.server != "rnix";
|
assertion = cfg.lsp.server != "rnix";
|
||||||
message = ''
|
message = ''
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,15 @@ in {
|
||||||
description = "Options to pass to rust analyzer";
|
description = "Options to pass to rust analyzer";
|
||||||
type = str;
|
type = str;
|
||||||
default = "";
|
default = "";
|
||||||
|
example = ''
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
cargo = {allFeature = true},
|
||||||
|
checkOnSave = true,
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -142,6 +151,9 @@ in {
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||||
},
|
},
|
||||||
|
default_settings = {
|
||||||
|
${cfg.lsp.opts}
|
||||||
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
default_on_attach(client, bufnr)
|
default_on_attach(client, bufnr)
|
||||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue