mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/utils/nvim-bqf: add plugin nvim-bqf (#208)
This commit is contained in:
parent
c9abc97ee5
commit
e08f03ec12
2 changed files with 161 additions and 0 deletions
|
@ -66,6 +66,7 @@
|
||||||
./utils/neorg.nix
|
./utils/neorg.nix
|
||||||
./utils/notify.nix
|
./utils/notify.nix
|
||||||
./utils/nvim-autopairs.nix
|
./utils/nvim-autopairs.nix
|
||||||
|
./utils/nvim-bqf.nix
|
||||||
./utils/nvim-colorizer.nix
|
./utils/nvim-colorizer.nix
|
||||||
./utils/nvim-tree.nix
|
./utils/nvim-tree.nix
|
||||||
./utils/project-nvim.nix
|
./utils/project-nvim.nix
|
||||||
|
|
160
plugins/utils/nvim-bqf.nix
Normal file
160
plugins/utils/nvim-bqf.nix
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.nvim-bqf;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
|
options.plugins.nvim-bqf =
|
||||||
|
helpers.extraOptionsOptions
|
||||||
|
// {
|
||||||
|
enable = mkEnableOption "nvim-bqf";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "nvim-bqf" pkgs.vimPlugins.nvim-bqf;
|
||||||
|
|
||||||
|
autoEnable = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Enable nvim-bqf in quickfix window automatically.
|
||||||
|
'';
|
||||||
|
|
||||||
|
magicWindow = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Give the window magic, when the window is splited horizontally, keep the distance between the
|
||||||
|
current line and the top/bottom border of neovim unchanged.
|
||||||
|
It's a bit like a floating window, but the window is indeed a normal window, without any
|
||||||
|
floating attributes.
|
||||||
|
'';
|
||||||
|
|
||||||
|
autoResizeHeight = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Resize quickfix window height automatically.
|
||||||
|
Shrink higher height to size of list in quickfix window, otherwise extend height to size of
|
||||||
|
list or to default height (10).
|
||||||
|
'';
|
||||||
|
|
||||||
|
preview = {
|
||||||
|
autoPreview = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Enable preview in quickfix window automatically.
|
||||||
|
'';
|
||||||
|
|
||||||
|
borderChars =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
|
"[ \"│\" \"│\" \"─\" \"─\" \"╭\" \"╮\" \"╰\" \"╯\" \"█\" ]"
|
||||||
|
''
|
||||||
|
Border and scroll bar chars, they respectively represent:
|
||||||
|
vline, vline, hline, hline, ulcorner, urcorner, blcorner, brcorner, sbar
|
||||||
|
'';
|
||||||
|
|
||||||
|
showTitle = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Show the window title.
|
||||||
|
'';
|
||||||
|
|
||||||
|
delaySyntax = helpers.defaultNullOpts.mkInt 50 ''
|
||||||
|
Delay time, to do syntax for previewed buffer, unit is millisecond.
|
||||||
|
'';
|
||||||
|
|
||||||
|
winHeight = helpers.defaultNullOpts.mkInt 15 ''
|
||||||
|
The height of preview window for horizontal layout.
|
||||||
|
Large value (like 999) perform preview window as a "full" mode.
|
||||||
|
'';
|
||||||
|
|
||||||
|
winVheight = helpers.defaultNullOpts.mkInt 15 ''
|
||||||
|
The height of preview window for vertical layout.
|
||||||
|
'';
|
||||||
|
|
||||||
|
wrap = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Wrap the line, `:h wrap` for detail.
|
||||||
|
'';
|
||||||
|
|
||||||
|
bufLabel = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Add label of current item buffer at the end of the item line.
|
||||||
|
'';
|
||||||
|
|
||||||
|
shouldPreviewCb = helpers.mkNullOrOption types.str ''
|
||||||
|
A callback function to decide whether to preview while switching buffer, with
|
||||||
|
(bufnr: number, qwinid: number) parameters.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
funcMap = helpers.mkNullOrOption (types.attrsOf types.str) ''
|
||||||
|
The table for {function = key}.
|
||||||
|
|
||||||
|
Example (some default values):
|
||||||
|
funcMap = {
|
||||||
|
open = "<CR>";
|
||||||
|
tab = "t";
|
||||||
|
sclear = "z<Tab>";
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
|
||||||
|
filter = {
|
||||||
|
fzf = {
|
||||||
|
actionFor = {
|
||||||
|
"ctrl-t" = helpers.defaultNullOpts.mkStr "tabedit" ''
|
||||||
|
Press ctrl-t to open up the item in a new tab.
|
||||||
|
'';
|
||||||
|
|
||||||
|
"ctrl-v" = helpers.defaultNullOpts.mkStr "vsplit" ''
|
||||||
|
Press ctrl-v to open up the item in a new vertical split.
|
||||||
|
'';
|
||||||
|
|
||||||
|
"ctrl-x" = helpers.defaultNullOpts.mkStr "split" ''
|
||||||
|
Press ctrl-x to open up the item in a new horizontal split.
|
||||||
|
'';
|
||||||
|
|
||||||
|
"ctrl-q" = helpers.defaultNullOpts.mkStr "signtoggle" ''
|
||||||
|
Press ctrl-q to toggle sign for the selected items.
|
||||||
|
'';
|
||||||
|
|
||||||
|
"ctrl-c" = helpers.defaultNullOpts.mkStr "closeall" ''
|
||||||
|
Press ctrl-c to close quickfix window and abort fzf.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraOpts =
|
||||||
|
helpers.defaultNullOpts.mkNullable
|
||||||
|
(types.listOf types.str)
|
||||||
|
"[ \"--bind\" \"ctrl-o:toggle-all\" ]"
|
||||||
|
"Extra options for fzf.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
options =
|
||||||
|
{
|
||||||
|
auto_enable = cfg.autoEnable;
|
||||||
|
magic_window = cfg.magicWindow;
|
||||||
|
auto_resize_height = cfg.autoResizeHeight;
|
||||||
|
preview = with cfg.preview; {
|
||||||
|
auto_preview = autoPreview;
|
||||||
|
border_chars = borderChars;
|
||||||
|
show_title = showTitle;
|
||||||
|
delay_syntax = delaySyntax;
|
||||||
|
win_height = winHeight;
|
||||||
|
win_vheight = winVheight;
|
||||||
|
inherit wrap;
|
||||||
|
buf_label = bufLabel;
|
||||||
|
should_preview_cb =
|
||||||
|
if isNull shouldPreviewCb
|
||||||
|
then null
|
||||||
|
else helpers.mkRaw shouldPreviewCb;
|
||||||
|
};
|
||||||
|
func_map = cfg.funcMap;
|
||||||
|
filter = {
|
||||||
|
fzf = with cfg.filter.fzf; {
|
||||||
|
action_for = actionFor;
|
||||||
|
extra_opts = extraOpts;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// cfg.extraOptions;
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
|
extraConfigLua = ''
|
||||||
|
require('bqf').setup(${helpers.toLuaObject options})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue