feat: apply new module format to utility plugins

new file:   modules/utility/binds/cheatsheet/cheatsheet.nix
	new file:   modules/utility/binds/cheatsheet/config.nix
	modified:   modules/utility/binds/cheatsheet/default.nix
	modified:   modules/utility/binds/default.nix
	new file:   modules/utility/binds/which-key/config.nix
	modified:   modules/utility/binds/which-key/default.nix
	new file:   modules/utility/binds/which-key/which-key.nix
	renamed:    modules/utility/colorizer.nix -> modules/utility/colorizer/colorizer.nix
	new file:   modules/utility/colorizer/config.nix
	new file:   modules/utility/colorizer/default.nix
	modified:   modules/utility/default.nix
	modified:   modules/utility/gestures/default.nix
	renamed:    modules/utility/gestures/gesture-nvim.nix -> modules/utility/gestures/gesture-nvim/config.nix
	new file:   modules/utility/gestures/gesture-nvim/default.nix
	new file:   modules/utility/gestures/gesture-nvim/gesture-nvim.nix
	renamed:    modules/utility/icon-picker.nix -> modules/utility/icon-picker/config.nix
	new file:   modules/utility/icon-picker/default.nix
	new file:   modules/utility/icon-picker/icon-picker.nix
	new file:   modules/utility/telescope/config.nix
	modified:   modules/utility/telescope/default.nix
	new file:   modules/utility/telescope/telescope.nix
	renamed:    modules/utility/venn.nix -> modules/utility/venn/config.nix
	new file:   modules/utility/venn/default.nix
	new file:   modules/utility/venn/venn.nix
This commit is contained in:
NotAShelf 2023-02-28 10:13:56 +03:00
commit 729276c4c5
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
26 changed files with 503 additions and 413 deletions

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.cheatsheet;
in {
options.vim.binds.cheatsheet = {
enable = mkEnableOption "Searchable cheatsheet for nvim using telescope";
};
}

View file

@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.cheatsheet;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = ["cheatsheet-nvim"];
vim.luaConfigRC.cheaetsheet-nvim = nvim.dag.entryAnywhere ''
require('cheatsheet').setup({})
'';
};
}

View file

@ -1,22 +1,6 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.cheatsheet;
in {
options.vim.binds.cheatsheet = {
enable = mkEnableOption "Searchable cheatsheet for nvim using telescope";
};
config = mkIf (cfg.enable) {
vim.startPlugins = ["cheatsheet-nvim"];
vim.luaConfigRC.cheaetsheet-nvim = nvim.dag.entryAnywhere ''
require('cheatsheet').setup({})
'';
};
_: {
imports = [
./cheatsheet.nix
./config.nix
];
}

View file

@ -1,9 +1,4 @@
{
config,
lib,
pkgs,
...
}: {
_: {
imports = [
./which-key
./cheatsheet

View file

@ -0,0 +1,115 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.whichKey;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = ["which-key"];
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''
local wk = require("which-key")
wk.setup {}
wk.register({
key_labels = {
["<space>"] = "SPACE",
["<leader>"] = "SPACE",
["<cr>"] = "RETURN",
["<tab>"] = "TAB",
},
${
if config.vim.tabline.nvimBufferline.enable
then ''
-- Buffer
["<leader>b"] = { name = "+Buffer" },
["<leader>bm"] = { name = "BufferLineMove" },
["<leader>bs"] = { name = "BufferLineSort" },
["<leader>bsi"] = { name = "BufferLineSortById" },
''
else ""
}
${
if config.vim.telescope.enable
then ''
["<leader>f"] = { name = "+Telescope" },
-- Telescope
["<leader>fl"] = { name = "Telescope LSP" },
["<leader>fm"] = { name = "Cellular Automaton" }, -- TODO: mvoe this to its own parent group
["<leader>fv"] = { name = "Telescope Git" },
["<leader>fvc"] = { name = "Commits" },
''
else ""
}
${
if config.vim.lsp.trouble.enable
then ''
-- Trouble
["<leader>lw"] = { name = "Workspace" },
["<leader>x"] = { name = "+Trouble" }, -- TODO: move all trouble binds to the same parent group
["<leader>l"] = { name = "+Trouble" },
''
else ""
}
${
if config.vim.lsp.nvimCodeActionMenu.enable
then ''
-- Parent Groups
["<leader>c"] = { name = "+CodeAction" },
''
else ""
}
${
if config.vim.minimap.codewindow.enable || config.vim.minimap.minimap-vim.enable
then ''
-- Minimap
["<leader>m"] = { name = "+Minimap" }, -- TODO: remap both minimap plugins' keys to be the same
''
else ""
}
${
if config.vim.notes.mind-nvim.enable || config.vim.notes.obsidian.enable || config.vim.notes.orgmode.enable
then ''
-- Notes
["<leader>o"] = { name = "+Notes" },
-- TODO: options for other note taking plugins and their individual binds
-- TODO: move all note-taker binds under leader + o
''
else ""
}
${
if config.vim.filetree.nvimTreeLua.enable
then ''
-- NvimTree
["<leader>t"] = { name = "+NvimTree" },
''
else ""
}
${
if config.vim.git.gitsigns.enable
then ''
-- Git
["<leader>g"] = { name = "+Gitsigns" },
''
else ""
}
})
'';
};
}

View file

@ -1,118 +1,6 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.whichKey;
in {
options.vim.binds.whichKey = {
enable = mkEnableOption "which-key menu";
};
config = mkIf (cfg.enable) {
vim.startPlugins = ["which-key"];
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''
require("which-key").setup {}
local wk = require("which-key")
wk.register({
key_labels = {
["<space>"] = "SPACE",
["<leader>"] = "SPACE",
["<cr>"] = "RETURN",
["<tab>"] = "TAB",
},
${
if config.vim.tabline.nvimBufferline.enable
then ''
-- Buffer
["<leader>b"] = { name = "+Buffer" },
["<leader>bm"] = { name = "BufferLineMove" },
["<leader>bs"] = { name = "BufferLineSort" },
["<leader>bsi"] = { name = "BufferLineSortById" },
''
else ""
}
${
if config.vim.telescope.enable
then ''
["<leader>f"] = { name = "+Telescope" },
-- Telescope
["<leader>fl"] = { name = "Telescope LSP" },
["<leader>fm"] = { name = "Cellular Automaton" }, -- TODO: mvoe this to its own parent group
["<leader>fv"] = { name = "Telescope Git" },
["<leader>fvc"] = { name = "Commits" },
''
else ""
}
${
if config.vim.lsp.trouble.enable
then ''
-- Trouble
["<leader>lw"] = { name = "Workspace" },
["<leader>x"] = { name = "+Trouble" }, -- TODO: move all trouble binds to the same parent group
["<leader>l"] = { name = "+Trouble" },
''
else ""
}
${
if config.vim.lsp.nvimCodeActionMenu.enable
then ''
-- Parent Groups
["<leader>c"] = { name = "+CodeAction" },
''
else ""
}
${
if config.vim.minimap.codewindow.enable || config.vim.minimap.minimap-vim.enable
then ''
-- Minimap
["<leader>m"] = { name = "+Minimap" },
''
else ""
}
${
if config.vim.notes.mind-nvim.enable || config.vim.notes.obsidian.enable || config.vim.notes.orgmode.enable
then ''
-- Notes
["<leader>o"] = { name = "+Notes" },
-- TODO: options for other note taking plugins and their individual binds
-- TODO: move all note-taker binds under leader + o
''
else ""
}
${
if config.vim.filetree.nvimTreeLua.enable
then ''
-- NvimTree
["<leader>t"] = { name = "+NvimTree" },
''
else ""
}
${
if config.vim.git.gitsigns.enable
then ''
-- Git
["<leader>g"] = { name = "+Gitsigns" },
''
else ""
}
})
'';
};
_: {
imports = [
./which-key.nix
./config.nix
];
}

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.whichKey;
in {
options.vim.binds.whichKey = {
enable = mkEnableOption "which-key menu";
};
}

View file

@ -11,14 +11,4 @@ in {
options.vim.utility.colorizer = {
enable = mkEnableOption "ccc color picker for neovim";
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"colorizer"
];
vim.configRC.ccc =
nvim.dag.entryAnywhere ''
'';
};
}

View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.colorizer;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = [
"colorizer"
];
};
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./colorizer.nix
./config.nix
];
}

View file

@ -3,8 +3,9 @@ _: {
./binds
./gestures
./telescope
./colorizer.nix
./venn.nix
./icon-picker.nix
./colorizer
./icon-picker
./telescope
./venn
];
}

View file

@ -1,5 +1,5 @@
_: {
imports = [
./gesture-nvim.nix
./gesture-nvim
];
}

View file

@ -8,10 +8,6 @@ with lib;
with builtins; let
cfg = config.vim.gestures.gesture-nvim;
in {
options.vim.gestures.gesture-nvim = {
enable = mkEnableOption "Enable GitHub Copilot";
};
config = mkIf cfg.enable {
vim.startPlugins = ["gesture-nvim"];

View file

@ -0,0 +1,6 @@
_: {
imports = [
./gesture-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.gestures.gesture-nvim;
in {
options.vim.gestures.gesture-nvim = {
enable = mkEnableOption "Enable gesture-nvim plugin";
};
}

View file

@ -8,10 +8,6 @@ with lib;
with builtins; let
cfg = config.vim.utility.icon-picker;
in {
options.vim.utility.icon-picker = {
enable = mkEnableOption "Nerdfonts icon picker for nvim";
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"icon-picker-nvim"

View file

@ -0,0 +1,6 @@
_: {
imports = [
./icon-picker.nix
./config.nix
];
}

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.icon-picker;
in {
options.vim.utility.icon-picker = {
enable = mkEnableOption "Nerdfonts icon picker for nvim";
};
}

View file

@ -0,0 +1,86 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.telescope;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = [
"telescope"
];
vim.nnoremap =
{
"<leader>ff" = "<cmd> Telescope find_files<CR>";
"<leader>fg" = "<cmd> Telescope live_grep<CR>";
"<leader>fb" = "<cmd> Telescope buffers<CR>";
"<leader>fh" = "<cmd> Telescope help_tags<CR>";
"<leader>ft" = "<cmd> Telescope<CR>";
"<leader>fvcw" = "<cmd> Telescope git_commits<CR>";
"<leader>fvcb" = "<cmd> Telescope git_bcommits<CR>";
"<leader>fvb" = "<cmd> Telescope git_branches<CR>";
"<leader>fvs" = "<cmd> Telescope git_status<CR>";
"<leader>fvx" = "<cmd> Telescope git_stash<CR>";
}
// (
if config.vim.lsp.enable
then {
"<leader>flsb" = "<cmd> Telescope lsp_document_symbols<CR>";
"<leader>flsw" = "<cmd> Telescope lsp_workspace_symbols<CR>";
"<leader>flr" = "<cmd> Telescope lsp_references<CR>";
"<leader>fli" = "<cmd> Telescope lsp_implementations<CR>";
"<leader>flD" = "<cmd> Telescope lsp_definitions<CR>";
"<leader>flt" = "<cmd> Telescope lsp_type_definitions<CR>";
"<leader>fld" = "<cmd> Telescope diagnostics<CR>";
}
else {}
)
// (
if config.vim.treesitter.enable
then {
"<leader>fs" = "<cmd> Telescope treesitter<CR>";
}
else {}
);
vim.luaConfigRC.telescope = nvim.dag.entryAnywhere ''
local telescope = require('telescope')
telescope.setup {
defaults = {
vimgrep_arguments = {
"${pkgs.ripgrep}/bin/rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case"
},
pickers = {
find_command = {
"${pkgs.fd}/bin/fd",
},
},
}
}
${
if config.vim.ui.noice.enable
then "telescope.load_extension('noice')"
else null
}
${
if config.vim.notify.nvim-notify.enable
then "telescope.load_extension('notify')"
else null
}
'';
};
}

View file

@ -1,90 +1,6 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.telescope;
in {
options.vim.telescope = {
enable = mkEnableOption "enable telescope";
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"telescope"
];
vim.nnoremap =
{
"<leader>ff" = "<cmd> Telescope find_files<CR>";
"<leader>fg" = "<cmd> Telescope live_grep<CR>";
"<leader>fb" = "<cmd> Telescope buffers<CR>";
"<leader>fh" = "<cmd> Telescope help_tags<CR>";
"<leader>ft" = "<cmd> Telescope<CR>";
"<leader>fvcw" = "<cmd> Telescope git_commits<CR>";
"<leader>fvcb" = "<cmd> Telescope git_bcommits<CR>";
"<leader>fvb" = "<cmd> Telescope git_branches<CR>";
"<leader>fvs" = "<cmd> Telescope git_status<CR>";
"<leader>fvx" = "<cmd> Telescope git_stash<CR>";
}
// (
if config.vim.lsp.enable
then {
"<leader>flsb" = "<cmd> Telescope lsp_document_symbols<CR>";
"<leader>flsw" = "<cmd> Telescope lsp_workspace_symbols<CR>";
"<leader>flr" = "<cmd> Telescope lsp_references<CR>";
"<leader>fli" = "<cmd> Telescope lsp_implementations<CR>";
"<leader>flD" = "<cmd> Telescope lsp_definitions<CR>";
"<leader>flt" = "<cmd> Telescope lsp_type_definitions<CR>";
"<leader>fld" = "<cmd> Telescope diagnostics<CR>";
}
else {}
)
// (
if config.vim.treesitter.enable
then {
"<leader>fs" = "<cmd> Telescope treesitter<CR>";
}
else {}
);
vim.luaConfigRC.telescope = nvim.dag.entryAnywhere ''
local telescope = require('telescope')
telescope.setup {
defaults = {
vimgrep_arguments = {
"${pkgs.ripgrep}/bin/rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case"
},
pickers = {
find_command = {
"${pkgs.fd}/bin/fd",
},
},
}
}
${
if config.vim.ui.noice.enable
then "telescope.load_extension('noice')"
else null
}
${
if config.vim.notify.nvim-notify.enable
then "telescope.load_extension('notify')"
else null
}
'';
};
_: {
imports = [
./telescope.nix
./config.nix
];
}

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.telescope;
in {
options.vim.telescope = {
enable = mkEnableOption "enable telescope";
};
}

View file

@ -8,10 +8,6 @@ with lib;
with builtins; let
cfg = config.vim.utility.venn-nvim;
in {
options.vim.utility.venn-nvim = {
enable = mkEnableOption "draw ASCII diagrams in Neovim";
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"venn-nvim"

View file

@ -0,0 +1,6 @@
_: {
imports = [
./config.nix
./venn.nix
];
}

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.venn-nvim;
in {
options.vim.utility.venn-nvim = {
enable = mkEnableOption "draw ASCII diagrams in Neovim";
};
}