mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-02 05:14:30 +02:00
plugins/lastplace: add plugin + test (#322)
This commit is contained in:
parent
82f04e3cf1
commit
f79dccdc2e
3 changed files with 66 additions and 0 deletions
|
@ -74,6 +74,7 @@
|
||||||
./utils/harpoon.nix
|
./utils/harpoon.nix
|
||||||
./utils/indent-blankline.nix
|
./utils/indent-blankline.nix
|
||||||
./utils/intellitab.nix
|
./utils/intellitab.nix
|
||||||
|
./utils/lastplace.nix
|
||||||
./utils/mark-radar.nix
|
./utils/mark-radar.nix
|
||||||
./utils/neorg.nix
|
./utils/neorg.nix
|
||||||
./utils/notify.nix
|
./utils/notify.nix
|
||||||
|
|
49
plugins/utils/lastplace.nix
Normal file
49
plugins/utils/lastplace.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.plugins.lastplace;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in
|
||||||
|
with lib; {
|
||||||
|
options.plugins.lastplace =
|
||||||
|
helpers.extraOptionsOptions
|
||||||
|
// {
|
||||||
|
enable = mkEnableOption "lastplace";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "lastplace" pkgs.vimPlugins.nvim-lastplace;
|
||||||
|
|
||||||
|
ignoreBuftype =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
|
''["quickfix" "nofix" "help"]''
|
||||||
|
"The list of buffer types to ignore by lastplace.";
|
||||||
|
|
||||||
|
ignoreFiletype =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf 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.";
|
||||||
|
};
|
||||||
|
|
||||||
|
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(${helpers.toLuaObject options})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
16
tests/test-sources/plugins/utils/lastplace.nix
Normal file
16
tests/test-sources/plugins/utils/lastplace.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.lastplace.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# All the upstream default options of lastplace
|
||||||
|
defaults = {
|
||||||
|
plugins.lastplace = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
ignoreBuftype = ["quickfix" "nofix" "help"];
|
||||||
|
ignoreFiletype = ["gitcommit" "gitrebase" "svn" "hgcommit"];
|
||||||
|
openFolds = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue