mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/utils: move to by-name
This commit is contained in:
parent
faff32b9f1
commit
52f125679f
195 changed files with 2 additions and 102 deletions
68
plugins/by-name/bufdelete/default.nix
Normal file
68
plugins/by-name/bufdelete/default.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
helpers,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "bufdelete";
|
||||
originalName = "bufdelete.nvim";
|
||||
package = "bufdelete-nvim";
|
||||
globalPrefix = "bufdelete_";
|
||||
|
||||
maintainers = [ maintainers.MattSturgeon ];
|
||||
|
||||
description = ''
|
||||
This plugin provides two commands, `:Bdelete` and `:Bwipeout`.
|
||||
They work exactly the same as `:bdelete` and `:bwipeout`,
|
||||
except they keep your window layout intact.
|
||||
|
||||
There's also two Lua functions provided, `bufdelete` and `bufwipeout`,
|
||||
which do the same thing as their command counterparts.
|
||||
Both take three arguments, `buffers`, `force` and `switchable_buffers`.
|
||||
|
||||
Here's an example of how to use the functions:
|
||||
|
||||
```lua
|
||||
-- Forcibly delete current buffer
|
||||
require('bufdelete').bufdelete(0, true)
|
||||
|
||||
-- Wipeout buffer number 100 without force
|
||||
require('bufdelete').bufwipeout(100)
|
||||
|
||||
-- Delete buffer 7 and 30 without force.
|
||||
require('bufdelete').bufdelete({7, 30})
|
||||
|
||||
-- Delete buffer matching foo.txt with force
|
||||
require('bufdelete').bufdelete("foo.txt", true)
|
||||
|
||||
-- Delete buffer matching foo.txt, buffer matching bar.txt and buffer 3 with force
|
||||
require('bufdelete').bufdelete({"foo.txt", "bar.txt", 3}, true)
|
||||
|
||||
-- Delete current buffer and switch to one of buffer 3, 5 or 10
|
||||
require('bufdelete').bufdelete(0, false, { 3, 5, 10 })
|
||||
```
|
||||
|
||||
See the plugin's [README] for more details.
|
||||
|
||||
[README]: https://github.com/famiu/bufdelete.nvim/?tab=readme-ov-file
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
buf_filter = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
Function that determines buffers that bufdelete.nvim can switch to,
|
||||
instead of the default behavior of switching to any buffer.
|
||||
|
||||
Must be a function that takes no argument and returns a list of buffers.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
buf_filter = ''
|
||||
function()
|
||||
-- TODO: return a list of buffers
|
||||
return { }
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue