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,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.plugins.lastplace;
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
inherit (lib) types;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.plugins.lastplace = lib.nixvim.plugins.neovim.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lastplace";
|
||||
lib.nixvim.plugins.mkNeovimPlugin {
|
||||
name = "lastplace";
|
||||
moduleName = "nvim-lastplace";
|
||||
packPathName = "nvim-lastplace";
|
||||
package = "nvim-lastplace";
|
||||
|
||||
package = lib.mkPackageOption pkgs "lastplace" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-lastplace"
|
||||
];
|
||||
};
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
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"
|
||||
"nofix"
|
||||
"help"
|
||||
] "The list of buffer types to ignore by lastplace.";
|
||||
|
||||
ignoreFiletype = helpers.defaultNullOpts.mkListOf types.str [
|
||||
lastplace_ignore_filetype = defaultNullOpts.mkListOf types.str [
|
||||
"gitcommit"
|
||||
"gitrebase"
|
||||
"svn"
|
||||
"hgcommit"
|
||||
] "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 =
|
||||
let
|
||||
options = {
|
||||
lastplace_ignore_buftype = cfg.ignoreBuftype;
|
||||
lastplace_ignore_filetype = cfg.ignoreFiletype;
|
||||
lastplace_open_folds = cfg.openFolds;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-lastplace').setup(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
settingsExample = {
|
||||
settings = {
|
||||
lastplace_ignore_buftype = [
|
||||
"help"
|
||||
];
|
||||
lastplace_ignore_filetype = [
|
||||
"svn"
|
||||
];
|
||||
lastplace_open_folds = false;
|
||||
};
|
||||
};
|
||||
|
||||
# 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 = {
|
||||
enable = true;
|
||||
|
||||
ignoreBuftype = [
|
||||
settings = {
|
||||
lastplace_ignore_buftype = [
|
||||
"quickfix"
|
||||
"nofix"
|
||||
"help"
|
||||
];
|
||||
ignoreFiletype = [
|
||||
lastplace_ignore_filetype = [
|
||||
"gitcommit"
|
||||
"gitrebase"
|
||||
"svn"
|
||||
"hgcommit"
|
||||
];
|
||||
openFolds = true;
|
||||
lastplace_open_folds = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue