mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-21 17:59:41 +01:00
treewide: remove internal use of helpers module arg
This commit is contained in:
parent
7add68e918
commit
dad19c1238
68 changed files with 687 additions and 758 deletions
|
|
@ -1,9 +1,4 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
commandAttributes = lib.types.submodule {
|
||||
options = {
|
||||
|
|
@ -13,7 +8,7 @@ let
|
|||
};
|
||||
|
||||
nargs =
|
||||
helpers.mkNullOrOption
|
||||
lib.nixvim.mkNullOrOption
|
||||
(lib.types.enum [
|
||||
0
|
||||
1
|
||||
|
|
@ -24,11 +19,11 @@ let
|
|||
''
|
||||
The number of arguments to expect, see :h command-nargs.
|
||||
'';
|
||||
complete = helpers.mkNullOrOption (with lib.types; either str rawLua) ''
|
||||
complete = lib.nixvim.mkNullOrOption (with lib.types; either str rawLua) ''
|
||||
Tab-completion behaviour, see :h command-complete.
|
||||
'';
|
||||
range =
|
||||
helpers.mkNullOrOption
|
||||
lib.nixvim.mkNullOrOption
|
||||
(
|
||||
with lib.types;
|
||||
oneOf [
|
||||
|
|
@ -40,18 +35,18 @@ let
|
|||
''
|
||||
Whether the command accepts a range, see :h command-range.
|
||||
'';
|
||||
count = helpers.mkNullOrOption (with lib.types; either bool int) ''
|
||||
count = lib.nixvim.mkNullOrOption (with lib.types; either bool int) ''
|
||||
Whether the command accepts a count, see :h command-range.
|
||||
'';
|
||||
addr = helpers.mkNullOrOption lib.types.str ''
|
||||
addr = lib.nixvim.mkNullOrOption lib.types.str ''
|
||||
Whether special characters relate to other things, see :h command-addr.
|
||||
'';
|
||||
bang = helpers.defaultNullOpts.mkBool false "Whether this command can take a bang (!).";
|
||||
bar = helpers.defaultNullOpts.mkBool false "Whether this command can be followed by a \"|\" and another command.";
|
||||
register = helpers.defaultNullOpts.mkBool false "The first argument to the command can be an optional register.";
|
||||
keepscript = helpers.defaultNullOpts.mkBool false "Do not use the location of where the user command was defined for verbose messages, use the location of where the command was invoked.";
|
||||
force = helpers.defaultNullOpts.mkBool false "Overwrite an existing user command.";
|
||||
desc = helpers.defaultNullOpts.mkStr "" "A description of the command.";
|
||||
bang = lib.nixvim.defaultNullOpts.mkBool false "Whether this command can take a bang (!).";
|
||||
bar = lib.nixvim.defaultNullOpts.mkBool false "Whether this command can be followed by a \"|\" and another command.";
|
||||
register = lib.nixvim.defaultNullOpts.mkBool false "The first argument to the command can be an optional register.";
|
||||
keepscript = lib.nixvim.defaultNullOpts.mkBool false "Do not use the location of where the user command was defined for verbose messages, use the location of where the command was invoked.";
|
||||
force = lib.nixvim.defaultNullOpts.mkBool false "Overwrite an existing user command.";
|
||||
desc = lib.nixvim.defaultNullOpts.mkStr "" "A description of the command.";
|
||||
|
||||
# TODO: command-preview, need to grab a function here.
|
||||
};
|
||||
|
|
@ -72,7 +67,7 @@ in
|
|||
};
|
||||
in
|
||||
lib.mkIf (config.userCommands != { }) {
|
||||
extraConfigLua = helpers.wrapDo ''
|
||||
extraConfigLua = lib.nixvim.wrapDo ''
|
||||
local cmds = ${lib.nixvim.toLuaObject (lib.mapAttrs cleanupCommand config.userCommands)};
|
||||
for name,cmd in pairs(cmds) do
|
||||
vim.api.nvim_create_user_command(name, cmd.command, cmd.options or {})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
|
|
@ -92,7 +91,7 @@ let
|
|||
|
||||
# TODO: Added 2024-07-07, remove after 24.11
|
||||
# Before we had a fileType, we used types.str.
|
||||
coercedFileType = helpers.transitionType lib.types.str (text: { inherit text; }) fileType;
|
||||
coercedFileType = lib.nixvim.transitionType lib.types.str (text: { inherit text; }) fileType;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
|
||||
cfg = config.filetype;
|
||||
|
||||
filetypeDefinition = helpers.mkNullOrOption (
|
||||
filetypeDefinition = lib.nixvim.mkNullOrOption (
|
||||
with types;
|
||||
attrsOf (oneOf [
|
||||
# Raw filetype
|
||||
|
|
@ -42,7 +37,7 @@ let
|
|||
in
|
||||
{
|
||||
options.filetype =
|
||||
helpers.mkCompositeOption
|
||||
lib.nixvim.mkCompositeOption
|
||||
''
|
||||
Define additional filetypes. The values can either be a literal filetype or a function
|
||||
taking the filepath and the buffer number.
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) toLuaObject;
|
||||
inherit (lib.nixvim.keymaps)
|
||||
removeDeprecatedMapAttrs
|
||||
deprecatedMapOptionSubmodule
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
keymaps = lib.mkOption {
|
||||
type = lib.types.listOf helpers.keymaps.deprecatedMapOptionSubmodule;
|
||||
type = lib.types.listOf deprecatedMapOptionSubmodule;
|
||||
default = [ ];
|
||||
description = "Nixvim keymaps.";
|
||||
example = [
|
||||
|
|
@ -21,7 +27,7 @@
|
|||
};
|
||||
|
||||
keymapsOnEvents = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.listOf helpers.keymaps.deprecatedMapOptionSubmodule);
|
||||
type = lib.types.attrsOf (lib.types.listOf deprecatedMapOptionSubmodule);
|
||||
default = { };
|
||||
example = {
|
||||
"InsertEnter" = [
|
||||
|
|
@ -69,7 +75,7 @@
|
|||
The `${lib.showOption opt.loc}' option is deprecated and will be removed in 24.11.
|
||||
|
||||
You should use a "raw" `action` instead;
|
||||
e.g. `action.__raw = "<lua code>"` or `action = helpers.mkRaw "<lua code>"`.
|
||||
e.g. `action.__raw = "<lua code>"` or `action = lib.nixvim.mkRaw "<lua code>"`.
|
||||
|
||||
${lib.options.showDefs opt.definitionsWithLocations}
|
||||
''))
|
||||
|
|
@ -78,7 +84,7 @@
|
|||
extraConfigLua = lib.mkIf (config.keymaps != [ ]) ''
|
||||
-- Set up keybinds {{{
|
||||
do
|
||||
local __nixvim_binds = ${lib.nixvim.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs config.keymaps)}
|
||||
local __nixvim_binds = ${toLuaObject (map removeDeprecatedMapAttrs config.keymaps)}
|
||||
for i, map in ipairs(__nixvim_binds) do
|
||||
vim.keymap.set(map.mode, map.key, map.action, map.options)
|
||||
end
|
||||
|
|
@ -93,10 +99,10 @@
|
|||
autoCmd = lib.mapAttrsToList (event: mappings: {
|
||||
inherit event;
|
||||
group = "nixvim_binds_${event}";
|
||||
callback = helpers.mkRaw ''
|
||||
callback = lib.nixvim.mkRaw ''
|
||||
function(args)
|
||||
do
|
||||
local __nixvim_binds = ${lib.nixvim.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs mappings)}
|
||||
local __nixvim_binds = ${toLuaObject (map removeDeprecatedMapAttrs mappings)}
|
||||
|
||||
for i, map in ipairs(__nixvim_binds) do
|
||||
local options = vim.tbl_extend("keep", map.options or {}, { buffer = args.buf })
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
optionsAttrs = {
|
||||
opts = {
|
||||
|
|
@ -56,7 +51,7 @@ in
|
|||
config = {
|
||||
extraConfigLuaPre =
|
||||
let
|
||||
content = helpers.concatNonEmptyLines (
|
||||
content = lib.nixvim.concatNonEmptyLines (
|
||||
lib.mapAttrsToList (
|
||||
optionName:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
|
||||
|
|
@ -140,19 +135,19 @@ in
|
|||
content =
|
||||
if config.type == "lua" then
|
||||
# Lua
|
||||
helpers.concatNonEmptyLines [
|
||||
lib.nixvim.concatNonEmptyLines [
|
||||
config.extraConfigLuaPre
|
||||
(helpers.wrapVimscriptForLua config.extraConfigVim)
|
||||
(lib.nixvim.wrapVimscriptForLua config.extraConfigVim)
|
||||
config.extraConfigLua
|
||||
config.extraConfigLuaPost
|
||||
]
|
||||
else
|
||||
# Vimscript
|
||||
helpers.concatNonEmptyLines [
|
||||
(helpers.wrapLuaForVimscript config.extraConfigLuaPre)
|
||||
lib.nixvim.concatNonEmptyLines [
|
||||
(lib.nixvim.wrapLuaForVimscript config.extraConfigLuaPre)
|
||||
config.extraConfigVim
|
||||
(helpers.wrapLuaForVimscript (
|
||||
helpers.concatNonEmptyLines [
|
||||
(lib.nixvim.wrapLuaForVimscript (
|
||||
lib.nixvim.concatNonEmptyLines [
|
||||
config.extraConfigLua
|
||||
config.extraConfigLuaPost
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
@ -236,8 +235,8 @@ in
|
|||
dontFixup = true;
|
||||
};
|
||||
|
||||
customRC = helpers.concatNonEmptyLines [
|
||||
(helpers.wrapVimscriptForLua wrappedNeovim.initRc)
|
||||
customRC = lib.nixvim.concatNonEmptyLines [
|
||||
(lib.nixvim.wrapVimscriptForLua wrappedNeovim.initRc)
|
||||
config.content
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue