Compare commits

..

1 commit

Author SHA1 Message Date
Ching Pei Yang
295eca2083
Merge 74856c2031 into 6670d752c7 2024-10-04 20:12:40 +00:00
12 changed files with 41 additions and 119 deletions

8
.github/README.md vendored
View file

@ -124,16 +124,10 @@ The _recommended_ way of installing **nvf** is using either the NixOS or the
Home-Manager module, though it is completely possible and no less supported to Home-Manager module, though it is completely possible and no less supported to
install **nvf** as a standalone package, or a flake output. install **nvf** as a standalone package, or a flake output.
See the rendered [nvf manual] for detailed and up-to-date installation guides, See the [**nvf** manual] for detailed and up-to-date installation guides,
configurations, available options, release notes and more. Tips for installing configurations, available options, release notes and more. Tips for installing
userspace plugins is also contained in the documentation. userspace plugins is also contained in the documentation.
> [!TIP]
> While using NixOS or Home-Manager modules,
> `programs.nvf.enableManpages = true;` will allow you to view option
> documentation from the comfort of your terminal via `man 5 nvf`. The more you
> know.
Please create an issue on the [issue tracker] if you find the documentation Please create an issue on the [issue tracker] if you find the documentation
lacking or confusing. Any improvements to the documentation through pull lacking or confusing. Any improvements to the documentation through pull
requests are also welcome, and appreciated. requests are also welcome, and appreciated.

View file

@ -106,16 +106,13 @@ everyone.
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp [ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim [new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
[neo-tree.nvim]: https://github.com/nvim-neo-tree/neo-tree.nvim
- Add [ocaml-lsp] support - Add [ocaml-lsp] support
- Fix "Emac" typo - Fix "Emac" typo
- Add [new-file-template.nvim] to automatically fill new file contents using - Add [new-file-template.nvim] to automatically fill new file contents using
templates templates.
- Make [neo-tree.nvim] display file icons properly by enabling `visuals.nvimWebDevicons`
[diniamo](https://github.com/diniamo): [diniamo](https://github.com/diniamo):
@ -224,10 +221,6 @@ everyone.
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user - Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim) configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
- Update `lualine.nvim` input and add missing themes:
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
`powerline_dark` and `solarized_light` themes.
[ppenguin](https://github.com/ppenguin): [ppenguin](https://github.com/ppenguin):
- Telescope: - Telescope:
@ -239,8 +232,3 @@ everyone.
- Add LSP and Treesitter support for R under `vim.languages.R`. - Add LSP and Treesitter support for R under `vim.languages.R`.
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with - Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
ccc ccc
[Bloxx12](https://github.com/Bloxx12)
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
`vim.theme`

23
flake.lock generated
View file

@ -172,22 +172,6 @@
"type": "github" "type": "github"
} }
}, },
"plugin-base16": {
"flake": false,
"locked": {
"lastModified": 1716483968,
"narHash": "sha256-GRF/6AobXHamw8TZ3FjL7SI6ulcpwpcohsIuZeCSh2A=",
"owner": "rrethy",
"repo": "base16-nvim",
"rev": "6ac181b5733518040a33017dde654059cd771b7c",
"type": "github"
},
"original": {
"owner": "rrethy",
"repo": "base16-nvim",
"type": "github"
}
},
"plugin-bufdelete-nvim": { "plugin-bufdelete-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -815,11 +799,11 @@
"plugin-lualine": { "plugin-lualine": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1723473562, "lastModified": 1712310396,
"narHash": "sha256-gCm7m96PkZyrgjmt7Efc+NMZKStAq1zr7JRCYOgGDuE=", "narHash": "sha256-WcH2dWdRDgMkwBQhcgT+Z/ArMdm+VbRhmQftx4t2kNI=",
"owner": "hoob3rt", "owner": "hoob3rt",
"repo": "lualine.nvim", "repo": "lualine.nvim",
"rev": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056", "rev": "0a5a66803c7407767b799067986b4dc3036e1983",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1818,7 +1802,6 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nmd": "nmd", "nmd": "nmd",
"plugin-alpha-nvim": "plugin-alpha-nvim", "plugin-alpha-nvim": "plugin-alpha-nvim",
"plugin-base16": "plugin-base16",
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
"plugin-catppuccin": "plugin-catppuccin", "plugin-catppuccin": "plugin-catppuccin",
"plugin-ccc": "plugin-ccc", "plugin-ccc": "plugin-ccc",

View file

@ -349,11 +349,6 @@
}; };
# Themes # Themes
plugin-base16 = {
url = "github:rrethy/base16-nvim";
flake = false;
};
plugin-tokyonight = { plugin-tokyonight = {
url = "github:folke/tokyonight.nvim"; url = "github:folke/tokyonight.nvim";
flake = false; flake = false;

View file

@ -1,9 +1,8 @@
{lib}: let {lib}: let
inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType; inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType;
inherit (lib.strings) isString;
inherit (lib.types) anything attrsOf; inherit (lib.types) anything attrsOf;
inherit (lib.nvim.types) anythingConcatLists; inherit (lib.nvim.types) anythingConcatLists;
inherit (builtins) typeOf isAttrs any head concatLists stringLength match; inherit (builtins) typeOf isAttrs any head concatLists stringLength;
in { in {
# HACK: Does this break anything in our case? # HACK: Does this break anything in our case?
# A modified version of the nixpkgs anything type that concatenates lists # A modified version of the nixpkgs anything type that concatenates lists
@ -59,11 +58,4 @@ in {
check = value: stringLength value < 2; check = value: stringLength value < 2;
merge = mergeEqualOption; merge = mergeEqualOption;
}; };
hexColor = mkOptionType {
name = "hex-color";
descriptionClass = "noun";
description = "RGB color in hex format";
check = v: isString v && (match "#?[0-9a-fA-F]{6}" v) != null;
};
} }

View file

@ -6,10 +6,10 @@
typesDag = import ./dag.nix {inherit lib;}; typesDag = import ./dag.nix {inherit lib;};
typesPlugin = import ./plugins.nix {inherit inputs lib;}; typesPlugin = import ./plugins.nix {inherit inputs lib;};
typesLanguage = import ./languages.nix {inherit lib;}; typesLanguage = import ./languages.nix {inherit lib;};
typesTypes = import ./types.nix {inherit lib;}; typesCustom = import ./custom.nix {inherit lib;};
in { in {
inherit (typesDag) dagOf; inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType; inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
inherit (typesLanguage) diagnostics mkGrammarOption; inherit (typesLanguage) diagnostics mkGrammarOption;
inherit (typesTypes) anythingConcatLists char hexColor; inherit (typesCustom) anythingConcatLists char;
} }

View file

@ -1,6 +1,6 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.types) either str listOf attrsOf nullOr submodule; inherit (lib.types) either str listOf attrsOf nullOr submodule bool;
inherit (lib.nvim.config) mkBool; inherit (lib.nvim.config) mkBool;
mapConfigOptions = { mapConfigOptions = {
@ -33,7 +33,9 @@
// { // {
key = mkOption { key = mkOption {
type = str; type = str;
description = "The key that triggers this keybind."; description = ''
Key that triggers this keybind.
'';
}; };
mode = mkOption { mode = mkOption {
type = either str (listOf str); type = either str (listOf str);
@ -42,17 +44,20 @@
See `:help map-modes` for a list of modes. See `:help map-modes` for a list of modes.
''; '';
example = ''`["n" "v" "c"]` for normal, visual and command mode''; example = ''"nvc" for normal, visual and command mode'';
}; };
}; };
}; };
legacyMapOption = mode: # legacy stuff
legacyMapOption = submodule {
options = mapConfigOptions;
};
mapOptions = mode:
mkOption { mkOption {
description = "Mappings for ${mode} mode"; description = "Mappings for ${mode} mode";
type = attrsOf (submodule { type = attrsOf legacyMapOption;
options = mapConfigOptions;
});
default = {}; default = {};
}; };
in { in {
@ -80,18 +85,18 @@ in {
}; };
maps = { maps = {
normal = legacyMapOption "normal"; normal = mapOptions "normal";
insert = legacyMapOption "insert"; insert = mapOptions "insert";
select = legacyMapOption "select"; select = mapOptions "select";
visual = legacyMapOption "visual and select"; visual = mapOptions "visual and select";
terminal = legacyMapOption "terminal"; terminal = mapOptions "terminal";
normalVisualOp = legacyMapOption "normal, visual, select and operator-pending (same as plain 'map')"; normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
visualOnly = legacyMapOption "visual only"; visualOnly = mapOptions "visual only";
operator = legacyMapOption "operator-pending"; operator = mapOptions "operator-pending";
insertCommand = legacyMapOption "insert and command-line"; insertCommand = mapOptions "insert and command-line";
lang = legacyMapOption "insert, command-line and lang-arg"; lang = mapOptions "insert, command-line and lang-arg";
command = legacyMapOption "command-line"; command = mapOptions "command-line";
}; };
}; };
} }

View file

@ -20,8 +20,6 @@ in {
"neo-tree-nvim" "neo-tree-nvim"
]; ];
visuals.nvimWebDevicons.enable = true;
pluginRC.neo-tree = entryAnywhere '' pluginRC.neo-tree = entryAnywhere ''
require("neo-tree").setup(${toLuaObject cfg.setupOpts}) require("neo-tree").setup(${toLuaObject cfg.setupOpts})
''; '';

View file

@ -17,36 +17,29 @@
"ayu_dark" "ayu_dark"
"ayu_light" "ayu_light"
"ayu_mirage" "ayu_mirage"
"ayu"
"codedark" "codedark"
"dracula" "dracula"
"everforest" "everforest"
"gruvbox" "gruvbox"
"gruvbox_dark"
"gruvbox_light" "gruvbox_light"
"gruvbox_material" "gruvbox_material"
"horizon" "horizon"
"iceberg_dark" "iceberg_dark"
"iceberg_light" "iceberg_light"
"iceberg"
"jellybeans" "jellybeans"
"material" "material"
"modus_vivendi" "modus_vivendi"
"molokai" "molokai"
"moonfly"
"nightfly" "nightfly"
"nord" "nord"
"oceanicnext" "oceanicnext"
"onedark"
"onelight" "onelight"
"palenight" "palenight"
"papercolor_dark" "papercolor_dark"
"papercolor_light" "papercolor_light"
"powerline_dark"
"powerline" "powerline"
"seoul256" "seoul256"
"solarized_dark" "solarized_dark"
"solarized_light"
"tomorrow" "tomorrow"
"wombat" "wombat"
]; ];
@ -231,7 +224,7 @@ in {
local buf_ft = vim.api.nvim_get_option_value('filetype', {}) local buf_ft = vim.api.nvim_get_option_value('filetype', {})
-- List of buffer types to exclude -- List of buffer types to exclude
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"} local excluded_buf_ft = {"toggleterm", "NvimTree", "TelescopePrompt"}
-- Check if the current buffer type is in the excluded list -- Check if the current buffer type is in the excluded list
for _, excluded_type in ipairs(excluded_buf_ft) do for _, excluded_type in ipairs(excluded_buf_ft) do

View file

@ -4,14 +4,7 @@
}: let }: let
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString warnIf; inherit (lib.trivial) boolToString warnIf;
inherit (lib.nvim.lua) toLuaObject;
in { in {
base16 = {
setup = {base16-colors, ...}: ''
-- Base16 theme
require('base16-colorscheme').setup(${toLuaObject base16-colors})
'';
};
onedark = { onedark = {
setup = {style ? "dark", ...}: '' setup = {style ? "dark", ...}: ''
-- OneDark theme -- OneDark theme
@ -27,7 +20,6 @@ in {
setup = { setup = {
style ? "night", style ? "night",
transparent, transparent,
...
}: '' }: ''
require('tokyonight').setup { require('tokyonight').setup {
transparent = ${boolToString transparent}; transparent = ${boolToString transparent};
@ -50,7 +42,6 @@ in {
setup = { setup = {
style ? "mocha", style ? "mocha",
transparent ? false, transparent ? false,
...
}: '' }: ''
-- Catppuccin theme -- Catppuccin theme
require('catppuccin').setup { require('catppuccin').setup {
@ -78,7 +69,7 @@ in {
notify = true, -- nvim-notify notify = true, -- nvim-notify
which_key = true, which_key = true,
navic = { navic = {
enabled = true, enabled = false,
custom_bg = "NONE", -- "lualine" will set background to mantle custom_bg = "NONE", -- "lualine" will set background to mantle
}, },
}, },

View file

@ -4,51 +4,32 @@
... ...
}: let }: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.attrsets) attrNames listToAttrs; inherit (lib.attrsets) attrNames;
inherit (lib.strings) hasPrefix;
inherit (lib.types) bool lines enum; inherit (lib.types) bool lines enum;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryBefore; inherit (lib.nvim.dag) entryBefore;
inherit (lib.nvim.types) hexColor;
cfg = config.vim.theme; cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix { supportedThemes = import ./supported-themes.nix {
inherit lib config; inherit lib config;
}; };
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
base16Options = listToAttrs (map (n: {
name = "base0${n}";
value = mkOption {
description = "The base0${n} color to use";
type = hexColor;
apply = v:
if hasPrefix "#" v
then v
else "#${v}";
};
})
numbers);
in { in {
options.vim.theme = { options.vim.theme = {
enable = mkOption { enable = mkOption {
type = bool; type = bool;
description = "Enable theming"; description = "Enable theming";
}; };
name = mkOption { name = mkOption {
type = enum (attrNames supportedThemes); type = enum (attrNames supportedThemes);
description = '' description = "Supported themes can be found in `supportedThemes.nix`";
Supported themes can be found in {file}`supportedThemes.nix`.
Setting the theme to "base16" enables base16 theming and
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
'';
}; };
base16-colors = base16Options;
style = mkOption { style = mkOption {
type = enum supportedThemes.${cfg.name}.styles; type = enum supportedThemes.${cfg.name}.styles;
description = "Specific style for theme if it supports it"; description = "Specific style for theme if it supports it";
}; };
transparent = mkOption { transparent = mkOption {
type = bool; type = bool;
default = false; default = false;
@ -66,7 +47,7 @@ in {
startPlugins = [cfg.name]; startPlugins = [cfg.name];
luaConfigRC.theme = entryBefore ["pluginConfigs"] '' luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
${cfg.extraConfig} ${cfg.extraConfig}
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent base16-colors;}} ${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
''; '';
}; };
}; };

View file

@ -43,7 +43,9 @@ in {
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})"; toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
keymaps = concatLines (map toLuaKeymap cfg.keymaps); maps = concatLines (map toLuaKeymap cfg.keymaps);
keymaps = maps;
in { in {
vim = { vim = {
luaConfigRC = { luaConfigRC = {