mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
feat: relocate whichkey and add cheatsheet.nvim
This commit is contained in:
parent
44692d64d5
commit
94be9167d2
10 changed files with 144 additions and 87 deletions
22
modules/binds/cheatsheet.nix
Normal file
22
modules/binds/cheatsheet.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
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({})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
11
modules/binds/default.nix
Normal file
11
modules/binds/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
./which-key.nix
|
||||||
|
./cheatsheet.nix
|
||||||
|
];
|
||||||
|
}
|
20
modules/binds/which-key.nix
Normal file
20
modules/binds/which-key.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
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 ''local wk = require("which-key").setup {}'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {imports = [./which-key.nix];}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
with builtins; let
|
|
||||||
cfg = config.vim.keys;
|
|
||||||
in {
|
|
||||||
options.vim.keys = {
|
|
||||||
enable = mkEnableOption "key binding plugins";
|
|
||||||
|
|
||||||
whichKey = {
|
|
||||||
enable = mkEnableOption "which-key menu";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf (cfg.enable && cfg.whichKey.enable) {
|
|
||||||
vim.startPlugins = ["which-key"];
|
|
||||||
|
|
||||||
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''local wk = require("which-key").setup {}'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -16,62 +16,64 @@ in {
|
||||||
isDag = dag:
|
isDag = dag:
|
||||||
builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag);
|
builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag);
|
||||||
|
|
||||||
# Takes an attribute set containing entries built by entryAnywhere,
|
/*
|
||||||
# entryAfter, and entryBefore to a topologically sorted list of
|
Takes an attribute set containing entries built by entryAnywhere,
|
||||||
# entries.
|
entryAfter, and entryBefore to a topologically sorted list of
|
||||||
#
|
entries.
|
||||||
# Internally this function uses the `toposort` function in
|
|
||||||
# `<nixpkgs/lib/lists.nix>` and its value is accordingly.
|
Internally this function uses the `toposort` function in
|
||||||
#
|
`<nixpkgs/lib/lists.nix>` and its value is accordingly.
|
||||||
# Specifically, the result on success is
|
|
||||||
#
|
Specifically, the result on success is
|
||||||
# { result = [ { name = ?; data = ?; } … ] }
|
|
||||||
#
|
{ result = [ { name = ?; data = ?; } … ] }
|
||||||
# For example
|
|
||||||
#
|
For example
|
||||||
# nix-repl> topoSort {
|
|
||||||
# a = entryAnywhere "1";
|
nix-repl> topoSort {
|
||||||
# b = entryAfter [ "a" "c" ] "2";
|
a = entryAnywhere "1";
|
||||||
# c = entryBefore [ "d" ] "3";
|
b = entryAfter [ "a" "c" ] "2";
|
||||||
# d = entryBefore [ "e" ] "4";
|
c = entryBefore [ "d" ] "3";
|
||||||
# e = entryAnywhere "5";
|
d = entryBefore [ "e" ] "4";
|
||||||
# } == {
|
e = entryAnywhere "5";
|
||||||
# result = [
|
} == {
|
||||||
# { data = "1"; name = "a"; }
|
result = [
|
||||||
# { data = "3"; name = "c"; }
|
{ data = "1"; name = "a"; }
|
||||||
# { data = "2"; name = "b"; }
|
{ data = "3"; name = "c"; }
|
||||||
# { data = "4"; name = "d"; }
|
{ data = "2"; name = "b"; }
|
||||||
# { data = "5"; name = "e"; }
|
{ data = "4"; name = "d"; }
|
||||||
# ];
|
{ data = "5"; name = "e"; }
|
||||||
# }
|
];
|
||||||
# true
|
}
|
||||||
#
|
true
|
||||||
# And the result on error is
|
|
||||||
#
|
And the result on error is
|
||||||
# {
|
|
||||||
# cycle = [ { after = ?; name = ?; data = ? } … ];
|
{
|
||||||
# loops = [ { after = ?; name = ?; data = ? } … ];
|
cycle = [ { after = ?; name = ?; data = ? } … ];
|
||||||
# }
|
loops = [ { after = ?; name = ?; data = ? } … ];
|
||||||
#
|
}
|
||||||
# For example
|
|
||||||
#
|
For example
|
||||||
# nix-repl> topoSort {
|
|
||||||
# a = entryAnywhere "1";
|
nix-repl> topoSort {
|
||||||
# b = entryAfter [ "a" "c" ] "2";
|
a = entryAnywhere "1";
|
||||||
# c = entryAfter [ "d" ] "3";
|
b = entryAfter [ "a" "c" ] "2";
|
||||||
# d = entryAfter [ "b" ] "4";
|
c = entryAfter [ "d" ] "3";
|
||||||
# e = entryAnywhere "5";
|
d = entryAfter [ "b" ] "4";
|
||||||
# } == {
|
e = entryAnywhere "5";
|
||||||
# cycle = [
|
} == {
|
||||||
# { after = [ "a" "c" ]; data = "2"; name = "b"; }
|
cycle = [
|
||||||
# { after = [ "d" ]; data = "3"; name = "c"; }
|
{ after = [ "a" "c" ]; data = "2"; name = "b"; }
|
||||||
# { after = [ "b" ]; data = "4"; name = "d"; }
|
{ after = [ "d" ]; data = "3"; name = "c"; }
|
||||||
# ];
|
{ after = [ "b" ]; data = "4"; name = "d"; }
|
||||||
# loops = [
|
];
|
||||||
# { after = [ "a" "c" ]; data = "2"; name = "b"; }
|
loops = [
|
||||||
# ];
|
{ after = [ "a" "c" ]; data = "2"; name = "b"; }
|
||||||
# }
|
];
|
||||||
# true
|
}
|
||||||
|
true
|
||||||
|
*/
|
||||||
topoSort = dag: let
|
topoSort = dag: let
|
||||||
dagBefore = dag: name:
|
dagBefore = dag: name:
|
||||||
builtins.attrNames
|
builtins.attrNames
|
||||||
|
|
|
@ -47,6 +47,8 @@ with lib; let
|
||||||
"codewindow-nvim"
|
"codewindow-nvim"
|
||||||
"nvim-notify"
|
"nvim-notify"
|
||||||
"cinnamon-nvim"
|
"cinnamon-nvim"
|
||||||
|
"cheatsheet-nvim"
|
||||||
|
"colorizer"
|
||||||
];
|
];
|
||||||
|
|
||||||
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
|
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
|
||||||
|
|
|
@ -17,13 +17,14 @@
|
||||||
./tidal
|
./tidal
|
||||||
./autopairs
|
./autopairs
|
||||||
./snippets
|
./snippets
|
||||||
./keys
|
./binds
|
||||||
./markdown
|
./markdown
|
||||||
./telescope
|
./telescope
|
||||||
./git
|
./git
|
||||||
./minimap
|
./minimap
|
||||||
./dashboard
|
./dashboard
|
||||||
./notifications
|
./notifications
|
||||||
|
./utility
|
||||||
];
|
];
|
||||||
|
|
||||||
pkgsModule = {config, ...}: {
|
pkgsModule = {config, ...}: {
|
||||||
|
|
24
modules/utility/colorizer.nix
Normal file
24
modules/utility/colorizer.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
with builtins; let
|
||||||
|
cfg = config.vim.utility.colorizer;
|
||||||
|
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 ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
5
modules/utility/default.nix
Normal file
5
modules/utility/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./colorizer.nix
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue