mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Compare commits
6 commits
3b1a9fdc89
...
383ce4472d
Author | SHA1 | Date | |
---|---|---|---|
|
383ce4472d | ||
|
fd65c83956 | ||
7d077f43f7 | |||
cb57d3d417 | |||
754c29cb7c | |||
0e84e4ebed |
16 changed files with 313 additions and 61 deletions
|
@ -83,7 +83,7 @@ Release notes for release 0.5
|
|||
|
||||
- Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
|
||||
- Fixed scrollOffset not being used
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
|
||||
- Added rose-pine theme.
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
|
||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.
|
||||
|
||||
|
|
|
@ -62,14 +62,17 @@ configuration formats.
|
|||
recommended to go through rustacean.nvim's README to take a closer look at its
|
||||
features and usage
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
|
||||
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
||||
|
||||
- Add [ocaml-lsp] support
|
||||
|
||||
- Fix "Emac" typo
|
||||
|
||||
- Add [new-file-template.nvim] to automatically fill new file contents using templates.
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
- Move the `theme` dag entry to before `luaScript`.
|
||||
|
|
|
@ -628,9 +628,15 @@
|
|||
};
|
||||
|
||||
plugin-nvim-nio = {
|
||||
# (required nvim-dap-ui)
|
||||
# (required by nvim-dap-ui)
|
||||
url = "github:nvim-neotest/nvim-nio";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-new-file-template-nvim = {
|
||||
# (required by new-file-template.nvim)
|
||||
url = "github:otavioschwanck/new-file-template.nvim";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
# Contains configuration for core neovim features
|
||||
# such as spellchecking, mappings, and the init script (init.vim).
|
||||
neovim = map (p: ./neovim + "/${p}") [
|
||||
"global"
|
||||
"init"
|
||||
"mappings"
|
||||
];
|
||||
|
|
12
modules/neovim/global/default.nix
Normal file
12
modules/neovim/global/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.lists) concatLists;
|
||||
inherit (lib.filesystem) listFilesRecursive;
|
||||
in {
|
||||
imports = concatLists [
|
||||
# Configuration options for Neovim UI
|
||||
(listFilesRecursive ./ui)
|
||||
|
||||
# vim.diagnostics
|
||||
[./diagnostics.nix]
|
||||
];
|
||||
}
|
115
modules/neovim/global/diagnostics.nix
Normal file
115
modules/neovim/global/diagnostics.nix
Normal file
|
@ -0,0 +1,115 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) str bool enum either;
|
||||
in {
|
||||
options.vim.diagnostics = {
|
||||
virtual_text = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to use virtual text for diagnostics.
|
||||
|
||||
If multiple diagnostics are set for a namespace, one
|
||||
prefix per diagnostic + the last diagnostic message
|
||||
are shown.
|
||||
'';
|
||||
};
|
||||
|
||||
update_in_insert = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to update diagnostics in insert mode.
|
||||
|
||||
This is useful for slow diagnostics sources, but can
|
||||
also cause lag in insert mode.
|
||||
'';
|
||||
};
|
||||
|
||||
underline = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to underline diagnostics.
|
||||
'';
|
||||
};
|
||||
|
||||
severity_sort = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to sort diagnostics by severity.
|
||||
|
||||
This affects the order in which signs and
|
||||
virtual text are displayed. When true, higher
|
||||
severities are displayed before lower severities (e.g.
|
||||
ERROR is displayed before WARN)
|
||||
'';
|
||||
};
|
||||
|
||||
float = {
|
||||
focusable = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether the floating window is focusable.
|
||||
When true, the floating window can be focused and
|
||||
interacted with. When false, the floating window is
|
||||
not focusable and will not receive input.
|
||||
'';
|
||||
};
|
||||
|
||||
border = mkOption {
|
||||
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
default = config.vim.ui.border.globalStyle;
|
||||
description = ''
|
||||
The border style of the floating window.
|
||||
|
||||
Possible values:
|
||||
- none
|
||||
- single
|
||||
- double
|
||||
- rounded
|
||||
- solid
|
||||
- shadow
|
||||
|
||||
See `:h nvim_open_win` for the available border
|
||||
styles and their definitions.
|
||||
'';
|
||||
};
|
||||
|
||||
source = mkOption {
|
||||
type = either bool (enum ["always" "if_many"]);
|
||||
default = "auto";
|
||||
description = ''
|
||||
The source of the floating window.
|
||||
Possible values:
|
||||
- auto: Use the same source as the diagnostics
|
||||
window.
|
||||
- window: Use the window source.
|
||||
- buffer: Use the buffer source.
|
||||
'';
|
||||
};
|
||||
|
||||
prefix = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = ''
|
||||
Prefix string for each diagnostic in the floating window
|
||||
'';
|
||||
};
|
||||
|
||||
suffix = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = ''
|
||||
Suffix string for each diagnostic in the floating window
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
51
modules/neovim/global/ui/borders.nix
Normal file
51
modules/neovim/global/ui/borders.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.types) enum;
|
||||
|
||||
cfg = config.vim.ui.borders;
|
||||
|
||||
# See `:h nvim_open_win` for the available border styles
|
||||
# this list can be updated if additional styles are added.
|
||||
defaultStyles = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
in {
|
||||
options.vim.ui.borders = {
|
||||
enable = mkEnableOption "visible borders for windows that support configurable borders";
|
||||
|
||||
# TODO: support configurable border elements with a lua table converted from a list of str
|
||||
# e.g. [ "╔" "═" "╗" "║" "╝" "═" "╚" "║" ]
|
||||
globalStyle = mkOption {
|
||||
type = enum defaultStyles;
|
||||
default = "single";
|
||||
description = ''
|
||||
The global border style to use.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins = let
|
||||
mkPluginStyleOption = name: {
|
||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||
|
||||
style = mkOption {
|
||||
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
||||
default = cfg.globalStyle;
|
||||
description = "The border style to use for the ${name} plugin";
|
||||
};
|
||||
};
|
||||
in
|
||||
mapAttrs (_: mkPluginStyleOption) {
|
||||
# despite not having it listed in example configuration, which-key does support the rounded type
|
||||
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
|
||||
which-key = "which-key";
|
||||
lspsaga = "lspsaga";
|
||||
nvim-cmp = "nvim-cmp";
|
||||
lsp-signature = "lsp-signature";
|
||||
code-action-menu = "code-actions-menu";
|
||||
};
|
||||
};
|
||||
}
|
32
modules/neovim/global/ui/icons.nix
Normal file
32
modules/neovim/global/ui/icons.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) str;
|
||||
in {
|
||||
options.vim.ui.icons = {
|
||||
diagnostics = {
|
||||
ERROR = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The icon to use for error messages";
|
||||
};
|
||||
|
||||
WARN = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The icon to use for warning messages";
|
||||
};
|
||||
|
||||
INFO = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The icon to use for info messages";
|
||||
};
|
||||
|
||||
HINT = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The icon to use for hint messages";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.types) enum;
|
||||
|
||||
cfg = config.vim.ui.borders;
|
||||
|
||||
defaultStyles = ["none" "single" "double" "rounded"];
|
||||
in {
|
||||
options.vim.ui.borders = {
|
||||
enable = mkEnableOption "visible borders for most windows";
|
||||
|
||||
globalStyle = mkOption {
|
||||
type = enum defaultStyles;
|
||||
default = "rounded";
|
||||
description = ''
|
||||
The global border style to use.
|
||||
'';
|
||||
};
|
||||
|
||||
# TODO: make per-plugin borders configurable
|
||||
plugins = let
|
||||
mkPluginStyleOption = name: {
|
||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||
|
||||
style = mkOption {
|
||||
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
||||
default = cfg.globalStyle;
|
||||
description = "The border style to use for the ${name} plugin";
|
||||
};
|
||||
};
|
||||
in {
|
||||
# despite not having it listed in example configuration, which-key does support the rounded type
|
||||
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
|
||||
which-key = mkPluginStyleOption "which-key";
|
||||
lspsaga = mkPluginStyleOption "lspsaga";
|
||||
nvim-cmp = mkPluginStyleOption "nvim-cmp";
|
||||
lsp-signature = mkPluginStyleOption "lsp-signature";
|
||||
code-action-menu = mkPluginStyleOption "code-actions-menu";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./borders.nix
|
||||
];
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
{
|
||||
imports = [
|
||||
./noice
|
||||
./modes
|
||||
./notifications
|
||||
./smartcolumn
|
||||
./breadcrumbs
|
||||
./colorizer
|
||||
./illuminate
|
||||
./breadcrumbs
|
||||
./borders
|
||||
./modes
|
||||
./noice
|
||||
./notifications
|
||||
./smartcolumn
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
./ccc
|
||||
./gestures
|
||||
./motion
|
||||
./new-file-template
|
||||
./telescope
|
||||
./icon-picker
|
||||
./images
|
||||
|
|
23
modules/plugins/utility/new-file-template/config.nix
Normal file
23
modules/plugins/utility/new-file-template/config.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.utility.new-file-template;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"new-file-template-nvim"
|
||||
];
|
||||
|
||||
pluginRC.new-file-template = entryAnywhere ''
|
||||
require('new-file-template').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/new-file-template/default.nix
Normal file
6
modules/plugins/utility/new-file-template/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./new-file-template.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) attrsOf bool listOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.new-file-template = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
new-file-template.nvim: Automatically insert a template on new files in neovim.
|
||||
::: {.note}
|
||||
For custom templates add a directory containing `lua/templates/*.lua`
|
||||
to `vim.additionalRuntimePaths`.
|
||||
:::
|
||||
[custom-template-docs]: https://github.com/otavioschwanck/new-file-template.nvim?tab=readme-ov-file#creating-new-templates
|
||||
More documentation on the templates available at [custom-template-docs]
|
||||
'';
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "nvim-file-template.nvim" {
|
||||
disableInsert = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Enter insert mode after inserting the template";
|
||||
};
|
||||
|
||||
disableAutocmd = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Disable the autocmd that creates the template";
|
||||
};
|
||||
|
||||
disableFiletype = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Disable default templates for specific filetypes";
|
||||
};
|
||||
|
||||
disableSpecific = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
default = {};
|
||||
description = "Disable specific regexp for the default templates.";
|
||||
example = "{ ruby = [\".*\"]; }";
|
||||
};
|
||||
|
||||
suffixAsFiletype = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Use suffix of filename rather than `vim.bo.filetype` as filetype";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue