Skip to content

Commit

Permalink
modules: add comments; formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Feb 19, 2024
1 parent 4eb26c0 commit 7c66ea2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
14 changes: 7 additions & 7 deletions modules/core/mappings/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{lib, ...}: let
inherit (lib) mkOption types;
inherit (lib) nvim;
inherit (nvim.bool) mkBool;
inherit (nvim.modules) mkBoolOption;

# Most of the keybindings code is highly inspired by pta2002/nixvim. Thank you!
mapConfigOptions = {
silent =
mkBool false
mkBoolOption false
"Whether this mapping should be silent. Equivalent to adding <silent> to a map.";

nowait =
mkBool false
mkBoolOption false
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";

script =
mkBool false
mkBoolOption false
"Equivalent to adding <script> to a map.";

expr =
mkBool false
mkBoolOption false
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";

unique =
mkBool false
mkBoolOption false
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";

noremap =
mkBool true
mkBoolOption true
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";

desc = mkOption {
Expand Down
14 changes: 11 additions & 3 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ inputs: {
extraSpecialArgs ? {},
}: let
inherit (builtins) map filter isString toString getAttr;
inherit (pkgs) wrapNeovim vimPlugins;
inherit (pkgs.vimUtils) buildVimPlugin;
inherit (lib.asserts) assertMsg;

# extend nixpkgs.lib with our own set of functions
extendedLib = import ../lib/stdlib-extended.nix lib;

# define neovim modules that will be used to configure neovim
nvimModules = import ./modules.nix {
inherit check pkgs;
lib = extendedLib;
Expand All @@ -23,10 +24,13 @@ inputs: {

vimOptions = module.config.vim;

inherit (pkgs) wrapNeovim vimPlugins;
inherit (pkgs.vimUtils) buildVimPlugin;

extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;

buildPlug = {pname, ...} @ args:
assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
assert assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
buildVimPlugin (args
// {
version = "master";
Expand Down Expand Up @@ -57,6 +61,10 @@ inputs: {
(f: f != null)
plugins);

# configure the neovim wrapper
# for details on how to use the wrapper, see:
# - https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/neovim/wrapper.nix
# - https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/neovim/utils.nix
neovim = wrapNeovim vimOptions.package {
inherit (vimOptions) viAlias;
inherit (vimOptions) vimAlias;
Expand Down
36 changes: 19 additions & 17 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,33 @@
inherit (lib.lists) concatLists;

# map each plugin from our plugins module into a list
# while adding a new parent module, it needs to be added
# here by name before it can be evaluated
plugins = map (p: ./plugins + "/${p}") [
"assistant"
"autopairs"
"comments"
"completion"
"theme"
"statusline"
"tabline"
"dashboard"
"debugger"
"filetree"
"visuals"
"lsp"
"treesitter"
"autopairs"
"snippets"
"git"
"languages"
"lsp"
"minimap"
"dashboard"
"utility"
"rich-presence"
"notes"
"projects"
"rich-presence"
"session"
"snippets"
"statusline"
"tabline"
"terminal"
"theme"
"treesitter"
"ui"
"assistant"
"session"
"comments"
"projects"
"languages"
"debugger"
"utility"
"visuals"
];

core = map (p: ./core + "/${p}") [
Expand Down
5 changes: 0 additions & 5 deletions modules/neovim/default.nix

This file was deleted.

0 comments on commit 7c66ea2

Please sign in to comment.