Compare commits
35 Commits
54ea093ce0
...
dde2b5cac4
Author | SHA1 | Date |
---|---|---|
diniamo | dde2b5cac4 | |
diniamo | d9a62eff17 | |
diniamo | 7df75f5b55 | |
diniamo | 71064e8865 | |
diniamo | 42447cd3bf | |
diniamo | c66854fc7f | |
diniamo | 187d924509 | |
Ching Pei Yang | 415954595e | |
diniamo | 83b7632297 | |
diniamo | c96181e739 | |
Frothy | 506b29c726 | |
NotAShelf | 954470581e | |
raf | b0af809b95 | |
NotAShelf | 1bb901edeb | |
diniamo | bb2a78272b | |
raf | 155bc8e1cc | |
diniamo | a145f997f3 | |
raf | 688a457a3d | |
diniamo | c2c85d70ee | |
raf | 335fbea0c0 | |
Frothy | 216cb34caf | |
Frothy | 2e99a21010 | |
raf | 7b719d0044 | |
NotAShelf | ba803c8684 | |
NotAShelf | f00ecd4eb9 | |
raf | 35c7327f81 | |
diniamo | 8a0cddd9bb | |
raf | 923481640e | |
raf | 2759b9caae | |
jacekpoz | abdcb62941 | |
jacekpoz | d873bc0667 | |
raf | f66c40b687 | |
Frothy | ad22bca3d7 | |
NotAShelf | 95615ec308 | |
diniamo | d6cd853520 |
|
@ -222,10 +222,10 @@ inputs: let
|
|||
enable = true;
|
||||
setupOpts.custom_colorcolumn = {
|
||||
# this is a freeform module, it's `buftype = int;` for configuring column position
|
||||
nix = 110;
|
||||
ruby = 120;
|
||||
java = 130;
|
||||
go = [90 130];
|
||||
nix = "110";
|
||||
ruby = "120";
|
||||
java = "130";
|
||||
go = ["90" "130"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -12,20 +12,39 @@ Release notes for release 0.7
|
|||
[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.
|
||||
[vim.visuals.fidget-nvim.setupOpts.progress.display.overrides](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides)
|
||||
from `anything` to a `submodule` for better type checking.
|
||||
|
||||
- Fix null `vim.lsp.mappings` generating an error and not being filtered out.
|
||||
- Add basic transparency support for `oxocarbon` theme by setting the
|
||||
highlight group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and
|
||||
optionally `NvimTreeNormal` to `none`.
|
||||
|
||||
- Add basic transparency support for `oxocarbon` theme by setting the highlight
|
||||
group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally
|
||||
`NvimTreeNormal` to `none`.
|
||||
|
||||
- Fix [vim.ui.smartcolumn.setupOpts.custom_colorcolumn](#opt-vim.ui.smartcolumn.setupOpts.custom_colorcolumn)
|
||||
using the wrong type `int` instead of the expected type `string`.
|
||||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
||||
- Fix broken treesitter-context keybinds in visual mode
|
||||
- Depcrecate use of `__empty` to define empty tables in lua. Empty attrset are
|
||||
no longer filtered and thus should be used instead.
|
||||
- Deprecate use of `__empty` to define empty tables in lua. Empty attrset are no
|
||||
longer filtered and thus should be used instead.
|
||||
|
||||
[NotAShelf](https://github.com/notashelf)
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
|
||||
- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
|
||||
|
||||
- Fix Emac typo
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
- Move the `theme` dag entry to before `luaScript`.
|
||||
|
||||
- Add rustfmt as the default formatter for Rust.
|
||||
|
||||
- Enabled the terminal integration of catppuccin for theming Neovim's built-in terminal (this also affects toggleterm).
|
||||
|
||||
[NotAShelf](https://github.com/notashelf):
|
||||
|
||||
- Add `deno fmt` as the default Markdown formatter. This will be enabled
|
||||
automatically if you have autoformatting enabled, but can be disabled manually
|
||||
|
@ -39,13 +58,12 @@ Release notes for release 0.7
|
|||
added once the [credo](https://github.com/rrrene/credo) linter has been added
|
||||
to nixpkgs. A pull request is currently open.
|
||||
|
||||
- Remove vim-tidal and friends
|
||||
- Remove vim-tidal and friends.
|
||||
|
||||
- Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed
|
||||
blending issues in component separators.
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
|
||||
- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
|
||||
|
||||
- Fix Emac typo
|
||||
- Add
|
||||
[ts-error-translator.nvim](https://github.com/dmmulroy/ts-error-translator.nvim)
|
||||
extension of the TS language module, under
|
||||
`vim.languages.ts.extensions.ts-error-translator`
|
||||
|
|
25
flake.lock
25
flake.lock
|
@ -114,16 +114,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1717839683,
|
||||
"narHash": "sha256-kC0eyEsfpXbtQ2Ee5kgjmLFSVsLgnqpj10LjEi+fK+g=",
|
||||
"lastModified": 1719082008,
|
||||
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3f3a01219b4a1b6ee63039a3aa63948fbf37c0dd",
|
||||
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable-small",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -1597,6 +1597,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-ts-error-translator": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1712269172,
|
||||
"narHash": "sha256-NJ0qfKvkwZ/0GolAeATlQLyQ7nGN6Z6q3uRqI+73wPk=",
|
||||
"owner": "dmmulroy",
|
||||
"repo": "ts-error-translator.nvim",
|
||||
"rev": "11ae55b28bde02663b5f983f59b0e3fd9c4e845b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dmmulroy",
|
||||
"repo": "ts-error-translator.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-vim-dirtytalk": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1840,6 +1856,7 @@
|
|||
"plugin-toggleterm-nvim": "plugin-toggleterm-nvim",
|
||||
"plugin-tokyonight": "plugin-tokyonight",
|
||||
"plugin-trouble": "plugin-trouble",
|
||||
"plugin-ts-error-translator": "plugin-ts-error-translator",
|
||||
"plugin-vim-dirtytalk": "plugin-vim-dirtytalk",
|
||||
"plugin-vim-fugitive": "plugin-vim-fugitive",
|
||||
"plugin-vim-illuminate": "plugin-vim-illuminate",
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
# Flake inputs
|
||||
inputs = {
|
||||
## Basic Inputs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
systems.url = "github:nix-systems/default";
|
||||
|
@ -183,6 +183,11 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-ts-error-translator = {
|
||||
url = "github:dmmulroy/ts-error-translator.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Copying/Registers
|
||||
plugin-registers = {
|
||||
url = "github:tversteeg/registers.nvim";
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.autopairs;
|
||||
in {
|
||||
|
@ -14,7 +13,7 @@ in {
|
|||
vim.startPlugins = ["nvim-autopairs"];
|
||||
|
||||
vim.luaConfigRC.autopairs = entryAnywhere ''
|
||||
require("nvim-autopairs").setup{}
|
||||
require("nvim-autopairs").setup({ map_cr = ${boolToString (!config.vim.autocomplete.enable)} })
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -61,15 +61,19 @@ in {
|
|||
(mkSetLuaBinding mappings.complete ''
|
||||
require('cmp').complete
|
||||
'')
|
||||
(mkSetLuaBinding mappings.confirm ''
|
||||
function()
|
||||
if not require('cmp').confirm({ select = true }) then
|
||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)
|
||||
|
||||
vim.fn.feedkeys(termcode, 'n')
|
||||
(let
|
||||
defaultKeys =
|
||||
if config.vim.autopairs.enable
|
||||
then "require('nvim-autopairs').autopairs_cr()"
|
||||
else "vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)";
|
||||
in
|
||||
mkSetLuaBinding mappings.confirm ''
|
||||
function()
|
||||
if not require('cmp').confirm({ select = true }) then
|
||||
vim.fn.feedkeys(${defaultKeys}, 'n')
|
||||
end
|
||||
end
|
||||
end
|
||||
'')
|
||||
'')
|
||||
(mkSetLuaBinding mappings.next ''
|
||||
function()
|
||||
local has_words_before = function()
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
defaultServer = "bash-ls";
|
||||
servers = {
|
||||
bash-ls = {
|
||||
package = pkgs.nodePackages.bash-language-server;
|
||||
package = pkgs.bash-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.bashls.setup{
|
||||
capabilities = capabilities;
|
||||
|
@ -85,7 +85,7 @@ in {
|
|||
description = "bash-language-server package, or the command to run as a list of strings";
|
||||
example = literalExpression ''[lib.getExe pkgs.nodePackages.bash-language-server "start"]'';
|
||||
type = either package (listOf str);
|
||||
default = pkgs.nodePackages.bash-language-server;
|
||||
default = pkgs.bash-language-server;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
'';
|
||||
};
|
||||
clangd = {
|
||||
package = pkgs.clang-tools_16;
|
||||
package = pkgs.clang-tools;
|
||||
lspConfig = ''
|
||||
local clangd_cap = capabilities
|
||||
-- use same offsetEncoding as null-ls
|
||||
|
|
|
@ -4,17 +4,33 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.lists) isList optionals;
|
||||
inherit (lib.types) bool package str listOf either;
|
||||
inherit (lib.types) bool package str listOf either enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.rust;
|
||||
|
||||
defaultFormat = "rustfmt";
|
||||
formats = {
|
||||
rustfmt = {
|
||||
package = pkgs.rustfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.rustfmt.with({
|
||||
command = "${cfg.format.package}/bin/rustfmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.rust = {
|
||||
enable = mkEnableOption "Rust language support";
|
||||
|
@ -49,6 +65,22 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Rust formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "Rust formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Rust formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
enable = mkOption {
|
||||
description = "Rust Debug Adapter support";
|
||||
|
@ -86,6 +118,11 @@ in {
|
|||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
|
||||
})
|
||||
|
||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||
vim = {
|
||||
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.types) enum either listOf package str bool;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.ts;
|
||||
|
||||
|
@ -32,6 +33,7 @@
|
|||
}
|
||||
'';
|
||||
};
|
||||
|
||||
denols = {
|
||||
package = pkgs.deno;
|
||||
lspConfig = ''
|
||||
|
@ -143,6 +145,24 @@ in {
|
|||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
|
||||
extensions = {
|
||||
ts-error-translator = {
|
||||
enable = mkEnableOption ''
|
||||
Typescript error translation with
|
||||
[ts-error-translator.nvim](github.com/dmmulroy/ts-error-translator.nvim)
|
||||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "ts-error-translator" {
|
||||
# This is the default configuration behaviour.
|
||||
auto_override_publish_diagnostics = mkOption {
|
||||
description = "Automatically override the publish_diagnostics handler";
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
@ -169,5 +189,12 @@ in {
|
|||
inherit diagnosticsProviders;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extensions."ts-error-translator".enable {
|
||||
vim.startPlugins = ["ts-error-translator"];
|
||||
vim.luaConfigRC.ts-error-translator = entryAnywhere ''
|
||||
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@ in {
|
|||
};
|
||||
|
||||
luaConfigRC.orgmode = entryAnywhere ''
|
||||
-- Load custom treesitter grammar for org filetype
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
-- Treesitter configuration
|
||||
require('nvim-treesitter.configs').setup {
|
||||
|
||||
|
|
|
@ -6,101 +6,42 @@
|
|||
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"
|
||||
];
|
||||
|
||||
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";
|
||||
};
|
||||
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(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
in {
|
||||
options.vim.tabline.nvimBufferline = {
|
||||
enable = mkEnableOption "neovim bufferline";
|
||||
|
@ -16,5 +19,385 @@ in {
|
|||
moveNext = mkMappingOption "Move next buffer" "<leader>bmn";
|
||||
movePrevious = mkMappingOption "Move previous buffer" "<leader>bmp";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
||||
highlights = mkOption {
|
||||
type = either attrs luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
Overrides the highlight groups of bufferline.
|
||||
|
||||
See `:help bufferline-highlights`.
|
||||
'';
|
||||
};
|
||||
|
||||
options = {
|
||||
mode = mkOption {
|
||||
type = enum ["tabs" "buffers"];
|
||||
default = "buffers";
|
||||
description = "Mode to use for bufferline";
|
||||
};
|
||||
|
||||
style_preset = mkOption {
|
||||
type = enum ["default" "minimal" "no_bold" "no_italic"];
|
||||
default = "default";
|
||||
apply = value: mkLuaInline "require('bufferline').style_preset.${value}";
|
||||
description = "The base style of bufferline";
|
||||
};
|
||||
|
||||
themable = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether or not to allow 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 = 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 = 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";
|
||||
};
|
||||
|
||||
left_mouse_command = mkOption {
|
||||
type = nullOr (either str luaInline);
|
||||
default = "buffer %d";
|
||||
description = "Command to run when left 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 the 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 the prefix used when a buffer is de-duplicated";
|
||||
};
|
||||
|
||||
truncate_names = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Truncate names";
|
||||
};
|
||||
|
||||
tab_size = mkOption {
|
||||
type = int;
|
||||
default = 18;
|
||||
description = "The size of the tabs in bufferline";
|
||||
};
|
||||
|
||||
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 = 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 ''
|
||||
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.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
offsets = mkOption {
|
||||
type = listOf attrs;
|
||||
default = [
|
||||
{
|
||||
filetype = "NvimTree";
|
||||
text = "File Explorer";
|
||||
highlight = "Directory";
|
||||
separator = true;
|
||||
}
|
||||
];
|
||||
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
|
||||
};
|
||||
|
||||
color_icons = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether or not to add filetype icon highlights";
|
||||
};
|
||||
|
||||
get_element_icon = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
function(element)
|
||||
local custom_map = {my_thing_ft: {icon = "my_thing_icon", hl = "DevIconDefault"}}
|
||||
return custom_map[element.filetype]
|
||||
end
|
||||
'';
|
||||
description = "The function bufferline uses to get the icon. Recommended to leave as default.";
|
||||
};
|
||||
|
||||
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 the 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 buffer prefixes";
|
||||
};
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
separator_style = mkOption {
|
||||
type = nullOr (either (enum ["slant" "padded_slant" "slope" "padded_slope" "thick" "thin"]) (listOf str));
|
||||
default = "thin";
|
||||
description = ''
|
||||
The type of separator used to separate buffers and tabs.
|
||||
|
||||
Either one of the listed types, or a list of 2 characters for either side.
|
||||
'';
|
||||
};
|
||||
|
||||
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 = true;
|
||||
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 values, or an inline Lua value.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ in {
|
|||
require('catppuccin').setup {
|
||||
flavour = "${style}",
|
||||
transparent_background = ${boolToString transparent},
|
||||
term_colors = true,
|
||||
integrations = {
|
||||
nvimtree = {
|
||||
enabled = true,
|
||||
|
|
|
@ -45,10 +45,12 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [cfg.name];
|
||||
luaConfigRC = {
|
||||
themeSetup = entryBefore ["theme"] cfg.extraConfig;
|
||||
theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;});
|
||||
};
|
||||
configRC.theme = entryBefore ["luaScript"] ''
|
||||
lua << EOF
|
||||
${cfg.extraConfig}
|
||||
${supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;})}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -31,15 +31,15 @@ in {
|
|||
|
||||
custom_colorcolumn = mkOption {
|
||||
description = "The position at which smart column should be displayed for each individual buffer type";
|
||||
type = attrsOf (either int (listOf int));
|
||||
type = attrsOf (either str (listOf str));
|
||||
default = {};
|
||||
|
||||
example = literalExpression ''
|
||||
vim.ui.smartcolumn.setupOpts.custom_colorcolumn = {
|
||||
nix = 110;
|
||||
ruby = 120;
|
||||
java = 130;
|
||||
go = [90 130];
|
||||
nix = "110";
|
||||
ruby = "120";
|
||||
java = "130";
|
||||
go = ["90" "130"];
|
||||
};
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue