nix-community.nixvim/plugins/utils/lastplace.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

{
lib,
helpers,
config,
pkgs,
...
2024-05-05 19:39:35 +02:00
}:
let
cfg = config.plugins.lastplace;
in
2024-05-05 19:39:35 +02:00
with lib;
{
options.plugins.lastplace = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "lastplace";
package = helpers.mkPluginPackageOption "lastplace" pkgs.vimPlugins.nvim-lastplace;
2024-05-05 19:39:35 +02:00
ignoreBuftype =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["quickfix" "nofix" "help"]''
"The list of buffer types to ignore by lastplace.";
2024-05-05 19:39:35 +02:00
ignoreFiletype =
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
''["gitcommit" "gitrebase" "svn" "hgcommit"]''
"The list of file types to ignore by lastplace.";
2024-05-05 19:39:35 +02:00
openFolds = helpers.defaultNullOpts.mkBool true "Whether closed folds are automatically opened when jumping to the last edit position.";
};
2024-05-05 19:39:35 +02:00
config =
let
options = {
lastplace_ignore_buftype = cfg.ignoreBuftype;
lastplace_ignore_filetype = cfg.ignoreFiletype;
lastplace_open_folds = cfg.openFolds;
} // cfg.extraOptions;
in
2024-05-05 19:39:35 +02:00
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
2024-05-05 19:39:35 +02:00
extraConfigLua = ''
require('nvim-lastplace').setup(${helpers.toLuaObject options})
'';
};
}