Compare commits

...

16 commits

Author SHA1 Message Date
raf
f56698f89f
Merge 64e79a9f4c into 5b982fafa0 2024-05-04 12:58:15 +00:00
raf
5b982fafa0
docs: fix missing header in README 2024-05-03 09:56:57 +00:00
d25492788c
Merge pull request #272 from FrothyMarrow/fix-fidget-overrides
visuals/fidget: use submodule for notification group overrides
2024-05-02 03:21:53 +00:00
Frothy
e1edeb5189 docs: entry for modified type in fidget display overrides 2024-05-01 23:19:46 -04:00
Frothy
4df41ae0d0 visuals/fidget: use submodule for notification group overrides 2024-05-01 23:19:44 -04:00
0ae4408fd8
Merge pull request #276 from NotAShelf/NotAShelf-patch-1
docs: fix license URLs
2024-05-01 18:52:03 +00:00
32615fca69
docs: fix license URLs 2024-05-01 18:51:50 +00:00
768449eff7
Merge pull request #275 from NotAShelf/NotAShelf-patch-1
nvf: let people pay me
2024-05-01 18:50:03 +00:00
4d41469b3d
nvf: let people pay me
I initially removed the ability to fund me due to this project being a soft-fork of JordanIsaac's neovim-flake. However, the project has changed *enough* to justify it being a standalone and therefore unaffiliated project. With the number of commits and the time spent in mind, I am allowing funding again.
2024-05-01 18:49:47 +00:00
fbc138a51b
Merge pull request #273 from FrothyMarrow/typst-docs-entry
docs: add entry for typst language support
2024-05-01 16:08:19 +00:00
d5fde3f445
docs: wording 2024-05-01 16:05:12 +00:00
Frothy
90ee038794 docs: add entry for typst language support 2024-04-29 07:47:07 -04:00
f66a879dce
Merge pull request #274 from FrothyMarrow/disable-wakatime
configuration: disable wakatime in maximal output
2024-04-29 05:28:14 +00:00
Frothy
ee240a1483 configuration: disable wakatime in maximal output 2024-04-28 22:33:00 -04:00
Frothy
64e79a9f4c
lib: avoid filtering null values to be used as nil 2024-04-28 21:09:07 +03:00
fe9bcf224b
tabline/bufferline: convert to setupOpts
this is pretty much WIP and contains a bunch of bugs that I haven't tackled yet.
2024-04-28 21:09:06 +03:00
9 changed files with 542 additions and 103 deletions

4
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,4 @@
github: NotAShelf
ko_fi: NotAShelf
liberapay: NotAShelf

10
.github/README.md vendored
View file

@ -1,6 +1,7 @@
<div align="center">
<img src="assets/nvf-logo-work.svg" alt="nvf Logo" width="200">
<h1 nvf</h1>
<br/>
<h1>nvf</h1>
</div>
<div align="center">
@ -182,9 +183,10 @@ recommend checking their work out.
## License
Following the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake)
**nvf** has been made available under the **MIT License**. However, all assets
and documentation are published under the [CC BY License].
Following the license of the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake),
**nvf** has been made available under the [**MIT License**](LICENSE). However, all assets
and documentation are published under the
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
---

View file

@ -176,7 +176,7 @@ inputs: let
utility = {
ccc.enable = isMaximal;
vim-wakatime.enable = isMaximal;
vim-wakatime.enable = false;
icon-picker.enable = isMaximal;
surround.enable = isMaximal;
diffview-nvim.enable = true;

View file

@ -10,4 +10,5 @@ rl-0.3.md
rl-0.4.md
rl-0.5.md
rl-0.6.md
rl-0.7.md
```

View file

@ -0,0 +1,15 @@
# Release 0.7 {#sec-release-0.7}
Release notes for release 0.7
## Changelog {#sec-release-0.7-changelog}
[ItsSorae](https://github.com/ItsSorae):
- Added support for [typst](https://typst.app/) under `vim.languages.typst`.
This will enable the `typst-lsp` language server, and the `typstfmt` formatter.
[frothymarrow](https://github.com/frothymarrow):
- Modified type for [](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides)
from `anything` to a `submodule` for better type checking.

View file

@ -77,8 +77,7 @@ in rec {
else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs
(
_: v:
(v != null) && (toLuaObject v != "{}")
_: v: (toLuaObject v != "{}")
)
args)))
+ "}"

View file

@ -6,101 +6,30 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) mkLuaBinding mkBinding pushDownDefault;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.tabline.nvimBufferline;
self = import ./nvim-bufferline.nix {inherit lib;};
inherit (self.options.vim.tabline.nvimBufferline) mappings;
in {
config = mkIf cfg.enable (
let
mouse = {
right = "'vertical sbuffer %d'";
close = ''
function(bufnum)
require("bufdelete").bufdelete(bufnum, false)
end
'';
config = mkIf cfg.enable {
vim = {
startPlugins = [
(assert config.vim.visuals.nvimWebDevicons.enable; "nvim-bufferline-lua")
"bufdelete-nvim"
];
binds.whichKey.register = pushDownDefault {
"<leader>b" = "+Buffer";
"<leader>bm" = "BufferLineMove";
"<leader>bs" = "BufferLineSort";
"<leader>bsi" = "BufferLineSortById";
};
in {
vim = {
startPlugins = [
(assert config.vim.visuals.nvimWebDevicons.enable; "nvim-bufferline-lua")
"bufdelete-nvim"
];
maps.normal = mkMerge [
(mkLuaBinding cfg.mappings.closeCurrent "require(\"bufdelete\").bufdelete" mappings.closeCurrent.description)
(mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext<CR>" mappings.cycleNext.description)
(mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext<CR>" mappings.cycleNext.description)
(mkBinding cfg.mappings.cyclePrevious ":BufferLineCyclePrev<CR>" mappings.cyclePrevious.description)
(mkBinding cfg.mappings.pick ":BufferLinePick<CR>" mappings.pick.description)
(mkBinding cfg.mappings.sortByExtension ":BufferLineSortByExtension<CR>" mappings.sortByExtension.description)
(mkBinding cfg.mappings.sortByDirectory ":BufferLineSortByDirectory<CR>" mappings.sortByDirectory.description)
(mkLuaBinding cfg.mappings.sortById "function() require(\"bufferline\").sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end) end" mappings.sortById.description)
(mkBinding cfg.mappings.moveNext ":BufferLineMoveNext<CR>" mappings.moveNext.description)
(mkBinding cfg.mappings.movePrevious ":BufferLineMovePrev<CR>" mappings.movePrevious.description)
];
binds.whichKey.register = pushDownDefault {
"<leader>b" = "+Buffer";
"<leader>bm" = "BufferLineMove";
"<leader>bs" = "BufferLineSort";
"<leader>bsi" = "BufferLineSortById";
};
luaConfigRC.nvimBufferline = entryAnywhere ''
require("bufferline").setup{
options = {
mode = "buffers",
numbers = "both",
close_command = ${mouse.close},
right_mouse_command = ${mouse.right},
indicator = {
style = 'icon',
indicator_icon = '',
},
buffer_close_icon = '󰅖',
modified_icon = '',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
max_name_length = 18,
max_prefix_length = 15,
tab_size = 18,
show_buffer_icons = true,
show_buffer_close_icons = true,
show_close_icon = true,
show_tab_indicators = true,
persist_buffer_sort = true,
--separator_style = "thin",
separator_style = { " ", " " },
enforce_regular_tabs = true,
always_show_bufferline = true,
offsets = {
{filetype = "NvimTree", text = "File Explorer", text_align = "center"}
},
sort_by = 'extension',
diagnostics = "nvim_lsp", -- TODO: use coc if it's enabled
diagnostics_update_in_insert = true,
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local s = ""
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and ""
or (e == "warning" and "" or "" )
if(sym ~= "") then
s = s .. " " .. n .. sym
end
end
return s
end,
numbers = function(opts)
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
end,
}
}
'';
};
}
);
luaConfigRC.nvimBufferline = entryAnywhere ''
require("bufferline").setup({options = ${toLuaObject cfg.setupOpts}})
'';
};
};
}

View file

@ -1,6 +1,8 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) enum bool either nullOr str int listOf;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
in {
options.vim.tabline.nvimBufferline = {
enable = mkEnableOption "neovim bufferline";
@ -16,5 +18,319 @@ in {
moveNext = mkMappingOption "Move next buffer" "<leader>bmn";
movePrevious = mkMappingOption "Move previous buffer" "<leader>bmp";
};
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
mode = mkOption {
type = enum ["tabs" "buffers"];
default = "tabs";
description = "Mode to use for bufferline";
};
themable = mkOption {
type = bool;
default = true;
description = ''
Whether or not highlight groups to be overriden.
While false, bufferline.nvim sets highlights as default
'';
};
numbers = mkOption {
type = either (enum ["none" "ordinal" "buffer_id" "both"]) luaInline;
default = lib.generators.mkLuaInline ''
function(opts)
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
end
'';
description = "Whether or not to show buffer numbers";
};
close_command = mkOption {
type = either str luaInline;
default = lib.generators.mkLuaInline ''
function(bufnum)
require("bufdelete").bufdelete(bufnum, false)
end
'';
description = "Command to run when closing a buffer";
};
right_mouse_command = mkOption {
type = nullOr (either str luaInline);
default = "vertical sbuffer %d";
description = "Command to run when right clicking a buffer";
};
middle_mouse_command = mkOption {
type = nullOr (either str luaInline);
default = null;
description = "Command to run when middle clicking a buffer";
};
indicator = {
icon = mkOption {
type = nullOr str;
default = null;
description = ''
The indicatotor icon to use for current buffer.
::: {.warning}
This **must** be ommitted while style is not `icon`
:::
'';
};
style = mkOption {
type = enum ["icon" "underline" "none"];
default = "underline";
description = "Style for indicator";
};
};
buffer_close_icon = mkOption {
type = str;
default = " 󰅖 ";
description = "Icon for close button";
};
modified_icon = mkOption {
type = str;
default = " ";
description = "Icon for modified buffer";
};
close_icon = mkOption {
type = str;
default = " ";
description = "Icon for close button";
};
left_trunc_marker = mkOption {
type = str;
default = "";
description = "Icon for left truncation";
};
right_trunc_marker = mkOption {
type = str;
default = "";
description = "Icon for right truncation";
};
name_formatter = mkOption {
type = nullOr luaInline;
default = null;
description = ''
`name_formatter` can be used to change the buffer's label in the
bufferline.
::: {.note}
Some names can/will break the bufferline so use this at your
discretion knowing that it has some limitations that will
**NOT** be fixed.
:::
'';
};
max_name_length = mkOption {
type = int;
default = 18;
description = "Max name length";
};
max_prefix_length = mkOption {
type = int;
default = 15;
description = "Length of prefix used when a buffer is de-duplicated";
};
truncate_names = mkOption {
type = bool;
default = true;
description = "Truncate names";
};
diagnostics = mkOption {
type = enum [false "nvim_lsp" "coc"];
default = "nvim_lsp";
description = "Diagnostics provider to be used in buffer LSP indicators";
};
diagnostics_update_in_insert = mkOption {
type = bool;
default = false;
description = ''
Whether to update diagnostics while in insert mode.
Setting this to true has performance implications, but they may be
negligible depending on your setup. Set it to true if you know what
you are doing.
'';
};
diagnostics_indicator = mkOption {
type = nullOr luaInline;
default = lib.generators.mkLuaInline ''
function(count, level, diagnostics_dict, context)
local s = " "
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and " "
or (e == "warning" and " " or " " )
s = s .. n .. sym
end
return s
end
'';
description = ''
Function to get the diagnostics indicator.
The function should return a string to be used as the indicator.
Can be set to nil to keep the buffer name highlight, but delete the
highlighting.
'';
};
custom_filter = mkOption {
type = nullOr luaInline;
default = null;
example = literalExpression lib.generators.mkLuaInline ''
custom_filter = function(buf_number, buf_numbers)
-- filter out filetypes you don't want to see
if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
return true
end
-- filter out by buffer name
if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
return true
end
-- filter out based on arbitrary rules
-- e.g. filter out vim wiki buffer from tabline in your work repo
if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
return true
end
-- filter out by it's index number in list (don't show first buffer)
if buf_numbers[1] ~= buf_number then
return true
end
end
'';
description = ''
Custom filter function for filtering out buffers.
::: {.note}
This will be called a lot, so you are encouraged to keep it as
short and lightweight as possible unless you are fully aware
of the performance implications.
:::
'';
};
color_icons = mkOption {
type = bool;
default = true;
description = "Whether or not to add filetype icon highlights";
};
show_buffer_icons = mkOption {
type = bool;
default = true;
description = "Whether or not to show buffer icons";
};
show_buffer_close_icons = mkOption {
type = bool;
default = true;
description = "Whether or not to show buffer close icons";
};
show_close_icon = mkOption {
type = bool;
default = true;
description = "Whether or not to show close icon";
};
show_tab_indicators = mkOption {
type = bool;
default = true;
description = "Whether or not to show tab indicators";
};
show_duplicate_prefix = mkOption {
type = bool;
default = true;
description = "Whether or not to show duplicate prefix";
};
duplicates_across_groups = mkOption {
type = bool;
default = true;
description = "Whether to consider duplicate paths in different groups as duplicates";
};
persist_buffer_sort = mkOption {
type = bool;
default = true;
description = "Whether or not custom sorted buffers should persist";
};
move_wraps_at_ends = mkOption {
type = bool;
default = false;
description = "Whether or not the move command \"wraps\" at the first or last position";
};
seperator_style = mkOption {
type = either (enum ["thick" "thin" "slope" "slant"]) (listOf str);
default = [" " " "];
description = ''
Style of the buffer separator.
Can be either one of the suspported values, or a list containing
**at most** two elements for `focused` and `unfocused` respectively.
'';
};
enforce_regular_tabs = mkOption {
type = bool;
default = false;
description = "Whether to enforce regular tabs";
};
always_show_bufferline = mkOption {
type = bool;
default = true;
description = "Whether to always show bufferline";
};
auto_toggle_bufferline = mkOption {
type = bool;
default = false;
description = "Whether to auto toggle bufferline";
};
hover = {
enabled = mkEnableOption "hover" // {default = true;};
delay = mkOption {
type = int;
default = 200;
description = "Delay for hover, in ms";
};
reveal = mkOption {
type = listOf str;
default = ["close"];
description = "Reveal hover window";
};
};
sort_by = mkOption {
type = either (enum ["insert_after_current" "insert_at_end" "id" "extension" "relative_directory" "directory" "tabs"]) luaInline;
default = "extension";
description = "Method to sort buffers by. Must be one of the supported valuees, or an inline Lua value.";
};
};
};
}

View file

@ -4,10 +4,9 @@
...
}: let
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.attrsets) mapAttrs;
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.strings) toUpper;
inherit (lib.types) int float bool str enum listOf attrsOf anything;
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.generators) mkLuaInline;
in {
@ -176,9 +175,183 @@ in {
'';
};
overrides = mkOption {
description = "Override options from the default notification config";
type = attrsOf (attrsOf anything);
default = {rust_analyzer = {name = "rust-analyzer";};};
description = ''
Overrides the default configuration for a notification group defined
in [](#opt-vim.visuals.fidget-nvim.setupOpts.notification.configs).
If any of the fields are null, the value from the default
configuration is used.
If default configuration is not defined, the following defaults are used:
```lua
{
name = "Notifications",
icon = "",
ttl = 5,
group_style = "Title",
icon_style = "Special",
annote_style = "Question",
debug_style = "Comment",
info_style = "Question",
warn_style = "WarningMsg",
error_style = "ErrorMsg",
debug_annote = "DEBUG",
info_annote = "INFO",
warn_annote = "WARN",
error_annote = "ERROR",
update_hook = function(item)
notification.set_content_key(item)
end,
}
```
'';
type = attrsOf (submodule {
options = {
name = mkOption {
description = ''
Name of the group, displayed in the notification window.
Can be a string or a function that returns a string.
If a function, it is invoked every render cycle with the items
list, useful for rendering animations and other dynamic content.
::: {.note}
If you're looking for detailed information into the function
signature, you can refer to the fidget API documentation available
[here](https://github.com/j-hui/fidget.nvim/blob/1ba38e4cbb24683973e00c2e36f53ae64da38ef5/doc/fidget-api.txt#L70-L77)
:::
'';
type = nullOr (oneOf [str luaInline]);
default = null;
};
icon = mkOption {
description = ''
Icon of the group, displayed in the notification window.
Can be a string or a function that returns a string.
If a function, it is invoked every render cycle with the items
list, useful for rendering animations and other dynamic content.
::: {.note}
If you're looking for detailed information into the function
signature, you can refer to the fidget API documentation available
[here](https://github.com/j-hui/fidget.nvim/blob/1ba38e4cbb24683973e00c2e36f53ae64da38ef5/doc/fidget-api.txt#L70-L77)
:::
'';
type = nullOr (oneOf [str luaInline]);
default = null;
};
icon_on_left = mkOption {
description = "If true, icon is rendered on the left instead of right";
type = nullOr bool;
default = null;
};
annote_separator = mkOption {
description = "Separator between message from annote";
type = nullOr str;
default = " ";
};
ttl = mkOption {
description = "How long a notification item should exist";
type = nullOr int;
default = 5;
};
render_limit = mkOption {
description = "How many notification items to show at once";
type = nullOr int;
default = null;
};
group_style = mkOption {
description = "Style used to highlight group name";
type = nullOr str;
default = "Title";
};
icon_style = mkOption {
description = "Style used to highlight icon, if null, use group_style";
type = nullOr str;
default = null;
};
annote_style = mkOption {
description = "Default style used to highlight item annotes";
type = nullOr str;
default = "Question";
};
debug_style = mkOption {
description = "Style used to highlight debug item annotes";
type = nullOr str;
default = null;
};
info_style = mkOption {
description = "Style used to highlight info item annotes";
type = nullOr str;
default = null;
};
warn_style = mkOption {
description = "Style used to highlight warn item annotes";
type = nullOr str;
default = null;
};
error_style = mkOption {
description = "Style used to highlight error item annotes";
type = nullOr str;
default = null;
};
debug_annote = mkOption {
description = "Default annotation for debug items";
type = nullOr str;
default = null;
};
info_annote = mkOption {
description = "Default annotation for info items";
type = nullOr str;
default = null;
};
warn_annote = mkOption {
description = "Default annotation for warn items";
type = nullOr str;
default = null;
};
error_annote = mkOption {
description = "Default annotation for error items";
type = nullOr str;
default = null;
};
priority = mkOption {
description = "Order in which group should be displayed";
type = nullOr int;
default = 50;
};
skip_history = mkOption {
description = "Whether messages should be preserved in history";
type = nullOr bool;
default = null;
};
update_hook = mkOption {
description = ''
Called when an item is updated.
If false, no action is taken.
If a function, it is invoked with the item being updated.
::: {.note}
If you're looking for detailed information into the function
signature, you can refer to the fidget API documentation available
[here](https://github.com/j-hui/fidget.nvim/blob/1ba38e4cbb24683973e00c2e36f53ae64da38ef5/doc/fidget-api.txt#L114)
:::
'';
type = nullOr (oneOf [bool luaInline]);
default = false;
};
};
});
default = {};
example = literalExpression ''
{
rust_analyzer = {
name = "Rust Analyzer";
};
}
'';
};
};