mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
plugins/lastplace: migrate to mkNeovimPlugin
This commit is contained in:
parent
a3eed84e1e
commit
10ea28fff4
3 changed files with 74 additions and 43 deletions
|
@ -1,54 +1,55 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.plugins.lastplace;
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
in
|
in
|
||||||
with lib;
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
{
|
name = "lastplace";
|
||||||
options.plugins.lastplace = lib.nixvim.plugins.neovim.extraOptionsOptions // {
|
moduleName = "nvim-lastplace";
|
||||||
enable = mkEnableOption "lastplace";
|
packPathName = "nvim-lastplace";
|
||||||
|
package = "nvim-lastplace";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "lastplace" {
|
maintainers = [ lib.maintainers.khaneliman ];
|
||||||
default = [
|
|
||||||
"vimPlugins"
|
|
||||||
"nvim-lastplace"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
ignoreBuftype = helpers.defaultNullOpts.mkListOf types.str [
|
description = ''
|
||||||
|
A Neovim plugin that automatically opens files at your last edit position.
|
||||||
|
'';
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
lastplace_ignore_buftype = defaultNullOpts.mkListOf types.str [
|
||||||
"quickfix"
|
"quickfix"
|
||||||
"nofix"
|
"nofix"
|
||||||
"help"
|
"help"
|
||||||
] "The list of buffer types to ignore by lastplace.";
|
] "The list of buffer types to ignore by lastplace.";
|
||||||
|
|
||||||
ignoreFiletype = helpers.defaultNullOpts.mkListOf types.str [
|
lastplace_ignore_filetype = defaultNullOpts.mkListOf types.str [
|
||||||
"gitcommit"
|
"gitcommit"
|
||||||
"gitrebase"
|
"gitrebase"
|
||||||
"svn"
|
"svn"
|
||||||
"hgcommit"
|
"hgcommit"
|
||||||
] "The list of file types to ignore by lastplace.";
|
] "The list of file types to ignore by lastplace.";
|
||||||
|
|
||||||
openFolds = helpers.defaultNullOpts.mkBool true "Whether closed folds are automatically opened when jumping to the last edit position.";
|
lastplace_open_folds = defaultNullOpts.mkBool true "Whether closed folds are automatically opened when jumping to the last edit position.";
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
settingsExample = {
|
||||||
let
|
settings = {
|
||||||
options = {
|
lastplace_ignore_buftype = [
|
||||||
lastplace_ignore_buftype = cfg.ignoreBuftype;
|
"help"
|
||||||
lastplace_ignore_filetype = cfg.ignoreFiletype;
|
];
|
||||||
lastplace_open_folds = cfg.openFolds;
|
lastplace_ignore_filetype = [
|
||||||
} // cfg.extraOptions;
|
"svn"
|
||||||
in
|
];
|
||||||
mkIf cfg.enable {
|
lastplace_open_folds = false;
|
||||||
extraPlugins = [ cfg.package ];
|
|
||||||
|
|
||||||
extraConfigLua = ''
|
|
||||||
require('nvim-lastplace').setup(${lib.nixvim.toLuaObject options})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Deprecated 2025-02-01
|
||||||
|
inherit (import ./deprecations.nix { inherit lib; })
|
||||||
|
imports
|
||||||
|
deprecateExtraOptions
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
28
plugins/by-name/lastplace/deprecations.nix
Normal file
28
plugins/by-name/lastplace/deprecations.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{ lib }:
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
let
|
||||||
|
basePath = [
|
||||||
|
"plugins"
|
||||||
|
"lastplace"
|
||||||
|
];
|
||||||
|
|
||||||
|
settingsPath = basePath ++ [ "settings" ];
|
||||||
|
in
|
||||||
|
lib.nixvim.mkSettingsRenamedOptionModules basePath settingsPath [
|
||||||
|
{
|
||||||
|
old = "ignoreBuftype";
|
||||||
|
new = "lastplace_ignore_buftype";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
old = "ignoreFiletype";
|
||||||
|
new = "lastplace_ignore_filetype";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
old = "openFolds";
|
||||||
|
new = "lastplace_open_folds";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
}
|
|
@ -7,18 +7,20 @@
|
||||||
plugins.lastplace = {
|
plugins.lastplace = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
ignoreBuftype = [
|
settings = {
|
||||||
"quickfix"
|
lastplace_ignore_buftype = [
|
||||||
"nofix"
|
"quickfix"
|
||||||
"help"
|
"nofix"
|
||||||
];
|
"help"
|
||||||
ignoreFiletype = [
|
];
|
||||||
"gitcommit"
|
lastplace_ignore_filetype = [
|
||||||
"gitrebase"
|
"gitcommit"
|
||||||
"svn"
|
"gitrebase"
|
||||||
"hgcommit"
|
"svn"
|
||||||
];
|
"hgcommit"
|
||||||
openFolds = true;
|
];
|
||||||
|
lastplace_open_folds = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue