mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
11
modules/plugins/utility/binds/cheatsheet/cheatsheet.nix
Normal file
11
modules/plugins/utility/binds/cheatsheet/cheatsheet.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.binds.cheatsheet = {
|
||||
enable = mkEnableOption "cheatsheet-nvim: searchable cheatsheet for nvim using telescope";
|
||||
};
|
||||
}
|
18
modules/plugins/utility/binds/cheatsheet/config.nix
Normal file
18
modules/plugins/utility/binds/cheatsheet/config.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.binds.cheatsheet;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = ["cheatsheet-nvim"];
|
||||
|
||||
vim.luaConfigRC.cheaetsheet-nvim = entryAnywhere ''
|
||||
require('cheatsheet').setup({})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/binds/cheatsheet/default.nix
Normal file
6
modules/plugins/utility/binds/cheatsheet/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./cheatsheet.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
6
modules/plugins/utility/binds/default.nix
Normal file
6
modules/plugins/utility/binds/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./which-key
|
||||
./cheatsheet
|
||||
];
|
||||
}
|
36
modules/plugins/utility/binds/which-key/config.nix
Normal file
36
modules/plugins/utility/binds/which-key/config.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.binds.whichKey;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = ["which-key"];
|
||||
|
||||
vim.luaConfigRC.whichkey = entryAnywhere ''
|
||||
local wk = require("which-key")
|
||||
wk.setup ({
|
||||
key_labels = {
|
||||
["<space>"] = "SPACE",
|
||||
["<leader>"] = "SPACE",
|
||||
["<cr>"] = "RETURN",
|
||||
["<tab>"] = "TAB",
|
||||
},
|
||||
|
||||
${optionalString (config.vim.ui.borders.plugins.which-key.enable) ''
|
||||
window = {
|
||||
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
||||
},
|
||||
''}
|
||||
})
|
||||
|
||||
wk.register(${toLuaObject cfg.register})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/binds/which-key/default.nix
Normal file
6
modules/plugins/utility/binds/which-key/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./which-key.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
18
modules/plugins/utility/binds/which-key/which-key.nix
Normal file
18
modules/plugins/utility/binds/which-key/which-key.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf str;
|
||||
in {
|
||||
options.vim.binds.whichKey = {
|
||||
enable = mkEnableOption "which-key keybind helper menu";
|
||||
|
||||
register = mkOption {
|
||||
description = "Register label for which-key keybind helper menu";
|
||||
type = attrsOf str;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
}
|
14
modules/plugins/utility/ccc/ccc.nix
Normal file
14
modules/plugins/utility/ccc/ccc.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.utility.ccc = {
|
||||
enable = mkEnableOption "ccc color picker for neovim";
|
||||
|
||||
mappings = {
|
||||
quit = mkMappingOption "Cancel and close the UI without replace or insert" "<Esc>";
|
||||
increase10 = mkMappingOption "Increase the value times delta of the slider" "<L>";
|
||||
decrease10 = mkMappingOption "Decrease the value times delta of the slider" "<H>";
|
||||
};
|
||||
};
|
||||
}
|
54
modules/plugins/utility/ccc/config.nix
Normal file
54
modules/plugins/utility/ccc/config.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.ccc;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"ccc"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.ccc = entryAnywhere ''
|
||||
local ccc = require("ccc")
|
||||
ccc.setup {
|
||||
highlighter = {
|
||||
auto_enable = true,
|
||||
max_byte = 2 * 1024 * 1024, -- 2mb
|
||||
lsp = true,
|
||||
filetypes = colorPickerFts,
|
||||
},
|
||||
pickers = {
|
||||
ccc.picker.hex,
|
||||
ccc.picker.css_rgb,
|
||||
ccc.picker.css_hsl,
|
||||
ccc.picker.ansi_escape {
|
||||
meaning1 = "bright", -- whether the 1 means bright or yellow
|
||||
},
|
||||
},
|
||||
alpha_show = "hide", -- needed when highlighter.lsp is set to true
|
||||
recognize = { output = true }, -- automatically recognize color format under cursor
|
||||
inputs = { ccc.input.hsl },
|
||||
outputs = {
|
||||
ccc.output.css_hsl,
|
||||
ccc.output.css_rgb,
|
||||
ccc.output.hex,
|
||||
},
|
||||
convert = {
|
||||
{ ccc.picker.hex, ccc.output.css_hsl },
|
||||
{ ccc.picker.css_rgb, ccc.output.css_hsl },
|
||||
{ ccc.picker.css_hsl, ccc.output.hex },
|
||||
},
|
||||
mappings = {
|
||||
["q"] = ccc.mapping.quit,
|
||||
["L"] = ccc.mapping.increase10,
|
||||
["H"] = ccc.mapping.decrease10,
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/ccc/default.nix
Normal file
6
modules/plugins/utility/ccc/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./ccc.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/plugins/utility/default.nix
Normal file
16
modules/plugins/utility/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
imports = [
|
||||
./binds
|
||||
./ccc
|
||||
./gestures
|
||||
./motion
|
||||
./telescope
|
||||
./icon-picker
|
||||
./images
|
||||
./telescope
|
||||
./diffview
|
||||
./wakatime
|
||||
./surround
|
||||
./preview
|
||||
];
|
||||
}
|
16
modules/plugins/utility/diffview/config.nix
Normal file
16
modules/plugins/utility/diffview/config.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.utility.diffview-nvim;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"diffview-nvim"
|
||||
"plenary-nvim"
|
||||
];
|
||||
};
|
||||
}
|
6
modules/plugins/utility/diffview/default.nix
Normal file
6
modules/plugins/utility/diffview/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./diffview.nix
|
||||
];
|
||||
}
|
7
modules/plugins/utility/diffview/diffview.nix
Normal file
7
modules/plugins/utility/diffview/diffview.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.diffview-nvim = {
|
||||
enable = mkEnableOption "diffview-nvim: cycle through diffs for all modified files for any git rev";
|
||||
};
|
||||
}
|
5
modules/plugins/utility/gestures/default.nix
Normal file
5
modules/plugins/utility/gestures/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./gesture-nvim
|
||||
];
|
||||
}
|
57
modules/plugins/utility/gestures/gesture-nvim/config.nix
Normal file
57
modules/plugins/utility/gestures/gesture-nvim/config.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.gestures.gesture-nvim;
|
||||
|
||||
self = import ./gesture-nvim.nix {inherit lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.gestures.gesture-nvim.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["gesture-nvim"];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkSetLuaBinding mappings.draw "require('gesture').draw")
|
||||
(mkSetLuaBinding mappings.finish "require('gesture').finish")
|
||||
(mkIf (mappings.draw.value == "<RightDrag>") {
|
||||
"<RightMouse>" = {action = "<Nop>";};
|
||||
})
|
||||
];
|
||||
|
||||
vim.luaConfigRC.gesture-nvim = entryAnywhere ''
|
||||
vim.opt.mouse = "a"
|
||||
|
||||
local gesture = require("gesture")
|
||||
gesture.register({
|
||||
name = "scroll to bottom",
|
||||
inputs = { gesture.up(), gesture.down() },
|
||||
action = "normal! G",
|
||||
})
|
||||
gesture.register({
|
||||
name = "next tab",
|
||||
inputs = { gesture.right() },
|
||||
action = "tabnext",
|
||||
})
|
||||
gesture.register({
|
||||
name = "previous tab",
|
||||
inputs = { gesture.left() },
|
||||
action = function(ctx) -- also can use callable
|
||||
vim.cmd.tabprevious()
|
||||
end,
|
||||
})
|
||||
gesture.register({
|
||||
name = "go back",
|
||||
inputs = { gesture.right(), gesture.left() },
|
||||
-- map to `<C-o>` keycode
|
||||
action = [[lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-o>", true, false, true), "n", true)]],
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./gesture-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.gestures.gesture-nvim = {
|
||||
enable = mkEnableOption "gesture-nvim: mouse gestures";
|
||||
|
||||
mappings = {
|
||||
draw = mkMappingOption "Start drawing [gesture.nvim]" "<LeftDrag>";
|
||||
finish = mkMappingOption "Finish drawing [gesture.nvim]" "<LeftRelease>";
|
||||
};
|
||||
};
|
||||
}
|
23
modules/plugins/utility/icon-picker/config.nix
Normal file
23
modules/plugins/utility/icon-picker/config.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.icon-picker;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"icon-picker-nvim"
|
||||
"dressing-nvim"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.icon-picker = entryAnywhere ''
|
||||
require("icon-picker").setup({
|
||||
disable_legacy_commands = true
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/icon-picker/default.nix
Normal file
6
modules/plugins/utility/icon-picker/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./icon-picker.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
7
modules/plugins/utility/icon-picker/icon-picker.nix
Normal file
7
modules/plugins/utility/icon-picker/icon-picker.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.icon-picker = {
|
||||
enable = mkEnableOption "nerdfonts icon picker for nvim";
|
||||
};
|
||||
}
|
5
modules/plugins/utility/images/default.nix
Normal file
5
modules/plugins/utility/images/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./image-nvim
|
||||
];
|
||||
}
|
30
modules/plugins/utility/images/image-nvim/config.nix
Normal file
30
modules/plugins/utility/images/image-nvim/config.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.utility.images.image-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"image-nvim"
|
||||
];
|
||||
|
||||
luaPackages = [
|
||||
"magick"
|
||||
];
|
||||
|
||||
luaConfigRC.image-nvim = entryAnywhere ''
|
||||
require("image").setup(
|
||||
${toLuaObject cfg.setupOpts}
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/images/image-nvim/default.nix
Normal file
6
modules/plugins/utility/images/image-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./image-nvim.nix
|
||||
];
|
||||
}
|
118
modules/plugins/utility/images/image-nvim/image-nvim.nix
Normal file
118
modules/plugins/utility/images/image-nvim/image-nvim.nix
Normal file
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
|
||||
inherit (lib.types) enum listOf str nullOr int;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.images.image-nvim = {
|
||||
enable = mkEnableOption "image support in Neovim [image.nvim]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "image.nvim" {
|
||||
backend = mkOption {
|
||||
type = enum ["kitty" "ueberzug"];
|
||||
default = "ueberzug";
|
||||
description = ''
|
||||
The backend to use for rendering images.
|
||||
|
||||
- kitty - best in class, works great and is very snappy
|
||||
- ueberzug - backed by ueberzugpp, supports any terminal,
|
||||
but has lower performance
|
||||
'';
|
||||
};
|
||||
|
||||
integrations = {
|
||||
markdown = {
|
||||
enable = mkEnableOption " image.nvim in markdown files" // {default = true;};
|
||||
clearInInsertMode = mkEnableOption "clearing of images when entering insert mode";
|
||||
downloadRemoteImages = mkEnableOption "downloading remote images";
|
||||
onlyRenderAtCursor = mkEnableOption "only rendering images at cursor";
|
||||
filetypes = mkOption {
|
||||
type = listOf str;
|
||||
default = ["markdown" "vimwiki"];
|
||||
description = ''
|
||||
Filetypes to enable image.nvim in. Markdown extensions
|
||||
(i.e. quarto) can go here
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
neorg = {
|
||||
enable = mkEnableOption "image.nvim in Neorg files" // {default = true;};
|
||||
clearInInsertMode = mkEnableOption "clearing of images when entering insert mode";
|
||||
downloadRemoteImages = mkEnableOption "downloading remote images";
|
||||
onlyRenderAtCursor = mkEnableOption "only rendering images at cursor";
|
||||
filetypes = mkOption {
|
||||
type = listOf str;
|
||||
default = ["neorg"];
|
||||
description = ''
|
||||
Filetypes to enable image.nvim in.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
maxWidth = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = ''
|
||||
The maximum width of images to render. Images larger than
|
||||
this will be scaled down to fit within this width.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
maxHeight = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = ''
|
||||
The maximum height of images to render. Images larger than
|
||||
this will be scaled down to fit within this height.
|
||||
'';
|
||||
};
|
||||
|
||||
maxWidthWindowPercentage = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = ''
|
||||
The maximum width of images to render as a percentage of the
|
||||
window width. Images larger than this will be scaled down to
|
||||
fit within this width.
|
||||
'';
|
||||
};
|
||||
|
||||
maxHeightWindowPercentage = mkOption {
|
||||
type = nullOr int;
|
||||
default = 50;
|
||||
description = ''
|
||||
The maximum height of images to render as a percentage of the
|
||||
window height. Images larger than this will be scaled down to
|
||||
fit within this height.
|
||||
'';
|
||||
};
|
||||
|
||||
windowOverlapClear = {
|
||||
enable = mkEnableOption "clearing of images when they overlap with the window";
|
||||
ftIgnore = mkOption {
|
||||
type = listOf str;
|
||||
default = ["cmp_menu" "cmp_docs" ""];
|
||||
description = ''
|
||||
Filetypes to ignore window overlap clearing in.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
editorOnlyRenderWhenFocused = mkEnableOption "only rendering images when the editor is focused";
|
||||
hijackFilePatterns = mkOption {
|
||||
type = listOf str;
|
||||
default = ["*.png" "*.jpg" "*.jpeg" "*.gif" "*.webp"];
|
||||
description = ''
|
||||
File patterns to hijack for image.nvim. This is useful for
|
||||
filetypes that don't have a dedicated integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/motion/default.nix
Normal file
6
modules/plugins/utility/motion/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./hop
|
||||
./leap
|
||||
];
|
||||
}
|
26
modules/plugins/utility/motion/hop/config.nix
Normal file
26
modules/plugins/utility/motion/hop/config.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.motion.hop;
|
||||
|
||||
self = import ./hop.nix {inherit lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.utility.motion.hop.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["hop-nvim"];
|
||||
|
||||
vim.maps.normal = mkSetBinding mappings.hop "<cmd> HopPattern<CR>";
|
||||
|
||||
vim.luaConfigRC.hop-nvim = entryAnywhere ''
|
||||
require('hop').setup()
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/motion/hop/default.nix
Normal file
6
modules/plugins/utility/motion/hop/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./hop.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
12
modules/plugins/utility/motion/hop/hop.nix
Normal file
12
modules/plugins/utility/motion/hop/hop.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.utility.motion.hop = {
|
||||
mappings = {
|
||||
hop = mkMappingOption "Jump to occurences [hop.nvim]" "<leader>h";
|
||||
};
|
||||
|
||||
enable = mkEnableOption "Hop.nvim plugin (easy motion)";
|
||||
};
|
||||
}
|
73
modules/plugins/utility/motion/leap/config.nix
Normal file
73
modules/plugins/utility/motion/leap/config.nix
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.motion.leap;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"leap-nvim"
|
||||
"vim-repeat"
|
||||
];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
];
|
||||
|
||||
vim.maps.operator = mkMerge [
|
||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkBinding cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||
(mkBinding cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
];
|
||||
|
||||
vim.maps.visualOnly = mkMerge [
|
||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkBinding cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||
(mkBinding cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
];
|
||||
|
||||
vim.luaConfigRC.leap-nvim = entryAnywhere ''
|
||||
require('leap').opts = {
|
||||
max_phase_one_targets = nil,
|
||||
highlight_unlabeled_phase_one_targets = false,
|
||||
max_highlighted_traversal_targets = 10,
|
||||
case_sensitive = false,
|
||||
equivalence_classes = { ' \t\r\n', },
|
||||
substitute_chars = {},
|
||||
safe_labels = {
|
||||
"s", "f", "n", "u", "t", "/",
|
||||
"S", "F", "N", "L", "H", "M", "U", "G", "T", "?", "Z"
|
||||
},
|
||||
labels = {
|
||||
"s", "f", "n",
|
||||
"j", "k", "l", "h", "o", "d", "w", "e", "m", "b",
|
||||
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
|
||||
"S", "F", "N",
|
||||
"J", "K", "L", "H", "O", "D", "W", "E", "M", "B",
|
||||
"U", "Y", "V", "R", "G", "T", "C", "X", "?", "Z"
|
||||
},
|
||||
special_keys = {
|
||||
repeat_search = '<enter>',
|
||||
next_phase_one_target = '<enter>',
|
||||
next_target = {'<enter>', ';'},
|
||||
prev_target = {'<tab>', ','},
|
||||
next_group = '<space>',
|
||||
prev_group = '<tab>',
|
||||
multi_accept = '<enter>',
|
||||
multi_revert = '<backspace>',
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/motion/leap/default.nix
Normal file
6
modules/plugins/utility/motion/leap/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./leap.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
36
modules/plugins/utility/motion/leap/leap.nix
Normal file
36
modules/plugins/utility/motion/leap/leap.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) nullOr str;
|
||||
in {
|
||||
options.vim.utility.motion.leap = {
|
||||
enable = mkEnableOption "leap.nvim plugin (easy motion)";
|
||||
|
||||
mappings = {
|
||||
leapForwardTo = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap forward to";
|
||||
default = "s";
|
||||
};
|
||||
leapBackwardTo = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap backward to";
|
||||
default = "S";
|
||||
};
|
||||
leapForwardTill = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap forward till";
|
||||
default = "x";
|
||||
};
|
||||
leapBackwardTill = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap backward till";
|
||||
default = "X";
|
||||
};
|
||||
leapFromWindow = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap from window";
|
||||
default = "gs";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/preview/default.nix
Normal file
6
modules/plugins/utility/preview/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./markdown-preview
|
||||
./glow
|
||||
];
|
||||
}
|
36
modules/plugins/utility/preview/glow/config.nix
Normal file
36
modules/plugins/utility/preview/glow/config.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
# TODO: move this to its own module
|
||||
inherit (lib) pushDownDefault;
|
||||
|
||||
cfg = config.vim.utility.preview.glow;
|
||||
self = import ./glow.nix {
|
||||
inherit lib config pkgs;
|
||||
};
|
||||
mappings = self.options.vim.utility.preview.glow.mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["glow-nvim"];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.openPreview ":Glow<CR>" mappings.openPreview.description)
|
||||
];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>pm" = "+Preview Markdown";
|
||||
};
|
||||
|
||||
vim.luaConfigRC.glow = entryAnywhere ''
|
||||
require('glow').setup({
|
||||
glow_path = "${pkgs.glow}/bin/glow"
|
||||
});
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/preview/glow/default.nix
Normal file
6
modules/plugins/utility/preview/glow/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./glow.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/plugins/utility/preview/glow/glow.nix
Normal file
16
modules/plugins/utility/preview/glow/glow.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
imports = [
|
||||
(mkRenamedOptionModule ["vim" "languages" "markdown" "glow" "enable"] ["vim" "utility" "preview" "glow" "enable"])
|
||||
];
|
||||
|
||||
options.vim.utility.preview = {
|
||||
glow = {
|
||||
enable = mkEnableOption "markdown preview in neovim with glow";
|
||||
mappings.openPreview = mkMappingOption "Open preview" "<leader>p";
|
||||
};
|
||||
};
|
||||
}
|
28
modules/plugins/utility/preview/markdown-preview/config.nix
Normal file
28
modules/plugins/utility/preview/markdown-preview/config.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.strings) optionalString stringLength concatMapStringsSep;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.vim) mkVimBool;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.preview.markdownPreview;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [pkgs.vimPlugins.markdown-preview-nvim];
|
||||
|
||||
vim.configRC.markdown-preview = entryAnywhere ''
|
||||
let g:mkdp_auto_start = ${mkVimBool cfg.autoStart}
|
||||
let g:mkdp_auto_close = ${mkVimBool cfg.autoClose}
|
||||
let g:mkdp_refresh_slow = ${mkVimBool cfg.lazyRefresh}
|
||||
let g:mkdp_filetypes = [${concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes}]
|
||||
let g:mkdp_command_for_global = ${mkVimBool cfg.alwaysAllowPreview}
|
||||
let g:mkdp_open_to_the_world = ${mkVimBool cfg.broadcastServer}
|
||||
${optionalString (stringLength cfg.customIP > 0) "let g:mkdp_open_ip = '${cfg.customIP}'"}
|
||||
${optionalString (stringLength cfg.customPort > 0) "let g:mkdp_port = '${cfg.customPort}'"}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./markdown-preview.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool str listOf;
|
||||
in {
|
||||
options.vim.utility.preview = {
|
||||
markdownPreview = {
|
||||
enable = mkEnableOption "Markdown preview in neovim with markdown-preview.nvim";
|
||||
|
||||
autoStart = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Automatically open the preview window after entering a Markdown buffer";
|
||||
};
|
||||
|
||||
autoClose = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Automatically close the preview window after leaving a Markdown buffer";
|
||||
};
|
||||
|
||||
lazyRefresh = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Only update preview when saving or leaving insert mode";
|
||||
};
|
||||
|
||||
filetypes = mkOption {
|
||||
type = listOf str;
|
||||
default = ["markdown"];
|
||||
description = "Allowed filetypes";
|
||||
};
|
||||
|
||||
alwaysAllowPreview = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Allow preview on all filetypes";
|
||||
};
|
||||
|
||||
broadcastServer = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Allow for outside and network wide connections";
|
||||
};
|
||||
|
||||
customIP = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "IP-address to use";
|
||||
};
|
||||
|
||||
customPort = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Port to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
45
modules/plugins/utility/surround/config.nix
Normal file
45
modules/plugins/utility/surround/config.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.surround;
|
||||
self = import ./surround.nix {inherit lib config;};
|
||||
mappingDefinitions = self.options.vim.utility.surround.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"nvim-surround"
|
||||
];
|
||||
|
||||
luaConfigRC.surround = entryAnywhere ''
|
||||
require('nvim-surround').setup()
|
||||
'';
|
||||
|
||||
maps = {
|
||||
insert = mkMerge [
|
||||
(mkIf (mappings.insert != null) (mkSetBinding mappings.insert "<Plug>(nvim-surround-insert)"))
|
||||
(mkIf (mappings.insertLine != null) (mkSetBinding mappings.insertLine "<Plug>(nvim-surround-insert-line)"))
|
||||
];
|
||||
normal = mkMerge [
|
||||
(mkIf (mappings.normal != null) (mkSetBinding mappings.normal "<Plug>(nvim-surround-normal)"))
|
||||
(mkIf (mappings.normalCur != null) (mkSetBinding mappings.normalCur "<Plug>(nvim-surround-normal-cur)"))
|
||||
(mkIf (mappings.normalLine != null) (mkSetBinding mappings.normalLine "<Plug>(nvim-surround-normal-line)"))
|
||||
(mkIf (mappings.normalCurLine != null) (mkSetBinding mappings.normalCurLine "<Plug>(nvim-surround-normal-cur-line)"))
|
||||
(mkIf (mappings.delete != null) (mkSetBinding mappings.delete "<Plug>(nvim-surround-delete)"))
|
||||
(mkIf (mappings.change != null) (mkSetBinding mappings.change "<Plug>(nvim-surround-change)"))
|
||||
];
|
||||
visualOnly = mkMerge [
|
||||
(mkIf (mappings.visual != null) (mkSetBinding mappings.visual "<Plug>(nvim-surround-visual)"))
|
||||
(mkIf (mappings.visualLine != null) (mkSetBinding mappings.visualLine "<Plug>(nvim-surround-visual-line)"))
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/surround/default.nix
Normal file
6
modules/plugins/utility/surround/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./surround.nix
|
||||
];
|
||||
}
|
90
modules/plugins/utility/surround/surround.nix
Normal file
90
modules/plugins/utility/surround/surround.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) bool nullOr str;
|
||||
in {
|
||||
options.vim.utility.surround = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "nvim-surround: add/change/delete surrounding delimiter pairs with ease. Note that the default mappings deviate from upstreeam to avoid conflicts with nvim-leap.";
|
||||
};
|
||||
useVendoredKeybindings = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
|
||||
};
|
||||
mappings = {
|
||||
insert = mkOption {
|
||||
type = nullOr str;
|
||||
default = "<C-g>z";
|
||||
description = "Add surround character around the cursor";
|
||||
};
|
||||
insertLine = mkOption {
|
||||
type = nullOr str;
|
||||
default = "<C-g>Z";
|
||||
description = "Add surround character around the cursor on new lines";
|
||||
};
|
||||
normal = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gz";
|
||||
description = "Surround motion with character";
|
||||
};
|
||||
normalCur = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gZ";
|
||||
description = "Surround motion with character on new lines";
|
||||
};
|
||||
normalLine = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gzz";
|
||||
description = "Surround line with character";
|
||||
};
|
||||
normalCurLine = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gZZ";
|
||||
description = "Surround line with character on new lines";
|
||||
};
|
||||
visual = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gz";
|
||||
description = "Surround selection with character";
|
||||
};
|
||||
visualLine = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gZ";
|
||||
description = "Surround selection with character on new lines";
|
||||
};
|
||||
delete = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gzd";
|
||||
description = "Delete surrounding character";
|
||||
};
|
||||
change = mkOption {
|
||||
type = nullOr str;
|
||||
default = "gzr";
|
||||
description = "Change surrounding character";
|
||||
};
|
||||
};
|
||||
};
|
||||
config.vim.utility.surround = let
|
||||
cfg = config.vim.utility.surround;
|
||||
in {
|
||||
mappings = mkIf (! cfg.useVendoredKeybindings) (mkDefault {
|
||||
insert = null;
|
||||
insertLine = null;
|
||||
normal = null;
|
||||
normalCur = null;
|
||||
normalLine = null;
|
||||
normalCurLine = null;
|
||||
visual = null;
|
||||
visualLine = null;
|
||||
delete = null;
|
||||
change = null;
|
||||
});
|
||||
};
|
||||
}
|
91
modules/plugins/utility/telescope/config.nix
Normal file
91
modules/plugins/utility/telescope/config.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
# TODO: move this to its own module
|
||||
inherit (lib) pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.telescope;
|
||||
self = import ./telescope.nix {inherit pkgs lib;};
|
||||
mappingDefinitions = self.options.vim.telescope.mappings;
|
||||
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"telescope"
|
||||
];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
|
||||
|
||||
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||
|
||||
(mkIf config.vim.lsp.enable (mkMerge [
|
||||
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||
|
||||
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||
]))
|
||||
|
||||
(
|
||||
mkIf config.vim.treesitter.enable
|
||||
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||
)
|
||||
|
||||
(
|
||||
mkIf config.vim.projects.project-nvim.enable
|
||||
(mkSetBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||
)
|
||||
];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>f" = "+Telescope";
|
||||
"<leader>fl" = "Telescope LSP";
|
||||
"<leader>fm" = "Cellular Automaton";
|
||||
"<leader>fv" = "Telescope Git";
|
||||
"<leader>fvc" = "Commits";
|
||||
};
|
||||
|
||||
vim.luaConfigRC.telescope = entryAnywhere ''
|
||||
local telescope = require('telescope')
|
||||
telescope.setup(${toLuaObject cfg.setupOpts})
|
||||
|
||||
${
|
||||
if config.vim.ui.noice.enable
|
||||
then "telescope.load_extension('noice')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.notify.nvim-notify.enable
|
||||
then "telescope.load_extension('notify')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.projects.project-nvim.enable
|
||||
then "telescope.load_extension('projects')"
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/telescope/default.nix
Normal file
6
modules/plugins/utility/telescope/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./telescope.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
182
modules/plugins/utility/telescope/telescope.nix
Normal file
182
modules/plugins/utility/telescope/telescope.nix
Normal file
|
@ -0,0 +1,182 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) int str listOf float bool either enum submodule attrsOf;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
setupOptions = {
|
||||
defaults = {
|
||||
vimgrep_arguments = mkOption {
|
||||
description = ''
|
||||
Defines the command that will be used for `live_grep` and `grep_string` pickers.
|
||||
Make sure that color is set to `never` because telescope does not yet interpret color codes.
|
||||
'';
|
||||
type = listOf str;
|
||||
default = [
|
||||
"${pkgs.ripgrep}/bin/rg"
|
||||
"--color=never"
|
||||
"--no-heading"
|
||||
"--with-filename"
|
||||
"--line-number"
|
||||
"--column"
|
||||
"--smart-case"
|
||||
"--hidden"
|
||||
"--no-ignore"
|
||||
];
|
||||
};
|
||||
pickers.find_command = mkOption {
|
||||
description = "cmd to use for finding files";
|
||||
type = either (listOf str) luaInline;
|
||||
default = ["${pkgs.fd}/bin/fd"];
|
||||
};
|
||||
prompt_prefix = mkOption {
|
||||
description = "Shown in front of Telescope's prompt";
|
||||
type = str;
|
||||
default = " ";
|
||||
};
|
||||
selection_caret = mkOption {
|
||||
description = "Character(s) to show in front of the current selection";
|
||||
type = str;
|
||||
default = " ";
|
||||
};
|
||||
entry_prefix = mkOption {
|
||||
description = "Prefix in front of each result entry. Current selection not included.";
|
||||
type = str;
|
||||
default = " ";
|
||||
};
|
||||
initial_mode = mkOption {
|
||||
description = "Determines in which mode telescope starts.";
|
||||
type = enum ["insert" "normal"];
|
||||
default = "insert";
|
||||
};
|
||||
selection_strategy = mkOption {
|
||||
description = "Determines how the cursor acts after each sort iteration.";
|
||||
type = enum ["reset" "follow" "row" "closest" "none"];
|
||||
default = "reset";
|
||||
};
|
||||
sorting_strategy = mkOption {
|
||||
description = ''Determines the direction "better" results are sorted towards.'';
|
||||
type = enum ["descending" "ascending"];
|
||||
default = "ascending";
|
||||
};
|
||||
layout_strategy = mkOption {
|
||||
description = "Determines the default layout of Telescope pickers. See `:help telescope.layout`.";
|
||||
type = str;
|
||||
default = "horizontal";
|
||||
};
|
||||
layout_config = mkOption {
|
||||
description = ''
|
||||
Determines the default configuration values for layout strategies.
|
||||
See telescope.layout for details of the configurations options for
|
||||
each strategy.
|
||||
'';
|
||||
default = {};
|
||||
type = submodule {
|
||||
options = {
|
||||
horizontal = {
|
||||
prompt_position = mkOption {
|
||||
description = "";
|
||||
type = str;
|
||||
default = "top";
|
||||
};
|
||||
preview_width = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.55;
|
||||
};
|
||||
results_width = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.8;
|
||||
};
|
||||
};
|
||||
vertical = {
|
||||
mirror = mkOption {
|
||||
description = "";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
width = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.8;
|
||||
};
|
||||
height = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.8;
|
||||
};
|
||||
preview_cutoff = mkOption {
|
||||
description = "";
|
||||
type = int;
|
||||
default = 120;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
file_ignore_patterns = mkOption {
|
||||
description = "A table of lua regex that define the files that should be ignored.";
|
||||
type = listOf str;
|
||||
default = ["node_modules" ".git/" "dist/" "build/" "target/" "result/"];
|
||||
};
|
||||
color_devicons = mkOption {
|
||||
description = "Boolean if devicons should be enabled or not.";
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
path_display = mkOption {
|
||||
description = "Determines how file paths are displayed.";
|
||||
type = listOf (enum ["hidden" "tail" "absolute" "smart" "shorten" "truncate"]);
|
||||
default = ["absolute"];
|
||||
};
|
||||
set_env = mkOption {
|
||||
description = "Set an envrionment for term_previewer";
|
||||
type = attrsOf str;
|
||||
default = {
|
||||
COLORTERM = "truecolor";
|
||||
};
|
||||
};
|
||||
winblend = mkOption {
|
||||
description = "pseudo-transparency of keymap hints floating window";
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.telescope = {
|
||||
mappings = {
|
||||
findProjects = mkMappingOption "Find files [Telescope]" "<leader>fp";
|
||||
|
||||
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
|
||||
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
|
||||
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
|
||||
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
|
||||
open = mkMappingOption "Open [Telescope]" "<leader>ft";
|
||||
|
||||
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
|
||||
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";
|
||||
gitBranches = mkMappingOption "Git branches [Telescope]" "<leader>fvb";
|
||||
gitStatus = mkMappingOption "Git status [Telescope]" "<leader>fvs";
|
||||
gitStash = mkMappingOption "Git stash [Telescope]" "<leader>fvx";
|
||||
|
||||
lspDocumentSymbols = mkMappingOption "LSP Document Symbols [Telescope]" "<leader>flsb";
|
||||
lspWorkspaceSymbols = mkMappingOption "LSP Workspace Symbols [Telescope]" "<leader>flsw";
|
||||
lspReferences = mkMappingOption "LSP References [Telescope]" "<leader>flr";
|
||||
lspImplementations = mkMappingOption "LSP Implementations [Telescope]" "<leader>fli";
|
||||
lspDefinitions = mkMappingOption "LSP Definitions [Telescope]" "<leader>flD";
|
||||
lspTypeDefinitions = mkMappingOption "LSP Type Definitions [Telescope]" "<leader>flt";
|
||||
diagnostics = mkMappingOption "Diagnostics [Telescope]" "<leader>fld";
|
||||
|
||||
treesitter = mkMappingOption "Treesitter [Telescope]" "<leader>fs";
|
||||
};
|
||||
|
||||
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
||||
};
|
||||
}
|
25
modules/plugins/utility/wakatime/config.nix
Normal file
25
modules/plugins/utility/wakatime/config.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.vim-wakatime;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
pkgs.vimPlugins.vim-wakatime
|
||||
];
|
||||
|
||||
vim.configRC.vim-wakatime = entryAnywhere ''
|
||||
${
|
||||
if cfg.cli-package == null
|
||||
then ""
|
||||
else ''let g:wakatime_CLIPath = "${cfg.cli-package}"''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/wakatime/default.nix
Normal file
6
modules/plugins/utility/wakatime/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./vim-wakatime.nix
|
||||
];
|
||||
}
|
18
modules/plugins/utility/wakatime/vim-wakatime.nix
Normal file
18
modules/plugins/utility/wakatime/vim-wakatime.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) nullOr package;
|
||||
in {
|
||||
options.vim.utility.vim-wakatime = {
|
||||
enable = mkEnableOption "vim-wakatime: live code statistics";
|
||||
|
||||
cli-package = mkOption {
|
||||
type = nullOr package;
|
||||
default = pkgs.wakatime;
|
||||
description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue