Compare commits

...

17 Commits

Author SHA1 Message Date
chokerman ef2e61bdd7
Merge 0ad53980f3 into 7b719d0044 2024-06-24 14:01:14 -04:00
raf 7b719d0044
Merge pull request #313 from NotAShelf/ts-error-translator
languages/ts: add `ts-error-translator.nvim` as an extension plugin
2024-06-24 17:40:06 +00:00
NotAShelf ba803c8684
docs: update release notes
Mention ts-error-translator's addition to the module system
2024-06-24 20:07:17 +03:00
NotAShelf f00ecd4eb9
languages/ts: add `ts-error-translator.nvim` as an extension plugin 2024-06-24 20:05:57 +03:00
raf 35c7327f81
Merge pull request #314 from diniamo/rustfmt
languages/rust: add format
2024-06-24 17:05:13 +00:00
diniamo 8a0cddd9bb languages/rust: add format 2024-06-24 19:02:04 +02:00
raf 923481640e
Merge pull request #306 from diniamo/fix-theme-dag
modules/theme: fix dag location
2024-06-24 16:29:53 +00:00
raf 2759b9caae
Merge pull request #310 from jacekpoz/orgmode
plugins/orgmode: remove deprecated ts setup call
2024-06-23 17:05:04 +00:00
jacekpoz abdcb62941
flake: bump nixpkgs input 2024-06-23 19:02:40 +02:00
jacekpoz d873bc0667
plugins/orgmode: remove deprecated ts setup call 2024-06-23 15:14:10 +02:00
raf f66c40b687
Merge pull request #309 from FrothyMarrow/nixpkgs-branch
flake: switch nixpkgs branch to nixpkgs-unstable
2024-06-22 23:45:01 +00:00
Frothy ad22bca3d7 flake: switch nixpkgs branch to nixpkgs-unstable 2024-06-22 19:28:54 -04:00
diniamo d6cd853520 modules/theme: fix dag location 2024-06-16 13:46:20 +02:00
justchokingaround 0ad53980f3 feat: add setupOpts 2024-06-14 04:54:41 +02:00
chokerman ff7aee90ce
Merge branch 'NotAShelf:main' into cokeline 2024-06-14 01:15:32 +02:00
chokerman 8ecc07a7fa
Merge branch 'NotAShelf:main' into cokeline 2024-05-31 07:03:21 +02:00
justchokingaround 915bef780f new: add cokeline 2024-05-22 05:07:17 +02:00
12 changed files with 422 additions and 28 deletions

View File

@ -15,15 +15,27 @@ Release notes for release 0.7
[](#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`.
[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.
[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
[NotAShelf](https://github.com/notashelf)
@ -39,13 +51,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`

View File

@ -114,16 +114,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1718910271,
"narHash": "sha256-vft9UIECxL4FtfX5UsTEE2XvvH9z9/BeP8pACAYEbwY=",
"lastModified": 1719082008,
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "19cd1c918369d89128bcb6a6da87137bdf42e997",
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable-small",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -1021,6 +1021,22 @@
"type": "github"
}
},
"plugin-nvim-cokeline": {
"flake": false,
"locked": {
"lastModified": 1715991329,
"narHash": "sha256-FXXh+a5hld9e1nW53S7vgumW4AD3bbMuewxmZyN+WvI=",
"owner": "willothy",
"repo": "nvim-cokeline",
"rev": "8145048ae68e05f31979c13b0adf7aa99f04f4c0",
"type": "github"
},
"original": {
"owner": "willothy",
"repo": "nvim-cokeline",
"type": "github"
}
},
"plugin-nvim-colorizer-lua": {
"flake": false,
"locked": {
@ -1597,6 +1613,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": {
@ -1804,6 +1836,7 @@
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
"plugin-nvim-cmp": "plugin-nvim-cmp",
"plugin-nvim-code-action-menu": "plugin-nvim-code-action-menu",
"plugin-nvim-cokeline": "plugin-nvim-cokeline",
"plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua",
"plugin-nvim-cursorline": "plugin-nvim-cursorline",
"plugin-nvim-dap": "plugin-nvim-dap",
@ -1840,6 +1873,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",

View File

@ -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";
@ -223,6 +228,12 @@
flake = false;
};
# Cokeline
plugin-nvim-cokeline = {
url = "github:willothy/nvim-cokeline";
flake = false;
};
# Statuslines
plugin-lualine = {
url = "github:hoob3rt/lualine.nvim";

View File

@ -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];

View File

@ -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})
'';
})
]);
}

View File

@ -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 {

View File

@ -0,0 +1,223 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.types) int bool str enum listOf nullOr;
inherit (lib.generators) mkLuaInline;
in {
options.vim.tabline.cokeline = {
enable = mkEnableOption "cokeline";
mappings = {
cycleNext = mkMappingOption "Next buffer" "<Tab>";
cyclePrevious = mkMappingOption "Previous buffer" "<S-Tab>";
pick = mkMappingOption "Pick buffer" "<leader>bc";
switchNext = mkMappingOption "Switch with next buffer" "<leader>bmn";
switchPrevious = mkMappingOption "Move previous buffer" "<leader>bmp";
closeByLetter = mkMappingOption "Close buffer by letter" "<leader>bd";
};
setupOpts = mkPluginSetupOption "Cokeline" {
show_if_buffers_are_at_least = mkOption {
description = "Only show the bufferline when there are at least this many visible buffers";
type = int;
default = 0;
};
buffers = {
filter_valid = mkOption {
description = "Only show valid buffers in the bufferline";
type = bool;
default = false;
};
filter_visible = mkOption {
description = "Only show visible buffers in the bufferline";
type = bool;
default = false;
};
focus_on_delete = mkOption {
description = "Focus on buffer deletion";
type = enum ["prev" "next"];
default = "next";
};
new_buffers_position = mkOption {
description = "Position of new buffers";
type = enum ["last" "next" "directory" "number"];
default = "last";
};
delete_on_right_click = mkOption {
description = "Delete buffer on right click";
type = bool;
default = true;
};
};
mappings = {
cycle_prev_next = mkOption {
description = "If true, the last (first) buffer gets focused/switched, if false, nothing happens";
type = bool;
default = true;
};
disable_mouse = mkOption {
description = "Disable mouse mappings";
type = bool;
default = false;
};
};
history = {
enable = mkOption {
description = "Enable a history of focused buffers using a ringbuffer";
type = bool;
default = true;
};
size = mkOption {
description = "The maximum number of items to keep in the history";
type = int;
default = 2;
};
};
rendering = {
max_buffer_width = mkOption {
description = "The maximum number of characters a rendered buffer is allowed to take up. The buffer will be truncated if its width is bigger than this value.";
type = int;
default = 999;
};
};
pick = {
use_filename = mkOption {
description = "Whether to use the filename's first letter first before picking a letter from the valid letters list in order.";
type = bool;
default = true;
};
letters = mkOption {
description = "The list of letters that are valid as pick letters. Sorted by keyboard reachability by default, but may require tweaking for non-QWERTY keyboard layouts.";
type = str;
default = "asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERTYQP";
};
};
default_hl = {
fg = mkOption {
description = "The default foreground color for buffers";
type = luaInline;
default = mkLuaInline ''
function(buffer)
return
buffer.is_focused
and vim.api.nvim_get_hl_by_name('Normal', true).foreground
or vim.api.nvim_get_hl_by_name('Comment', true).foreground
end
'';
};
bg = mkOption {
description = "The default background color for buffers";
type = luaInline;
default = mkLuaInline ''
function(buffer)
return vim.api.nvim_get_hl_by_name('ColorColumn', true).background
end
'';
};
sp = mkOption {
description = "The default special key color for buffers";
type = nullOr luaInline;
default = null;
};
bold = mkOption {
description = "The default bold attribute for buffers";
type = nullOr luaInline;
default = null;
};
italic = mkOption {
description = "The default italic attribute for buffers";
type = nullOr luaInline;
default = null;
};
underline = mkOption {
description = "The default underline attribute for buffers";
type = nullOr luaInline;
default = null;
};
undercurl = mkOption {
description = "The default undercurl attribute for buffers";
type = nullOr luaInline;
default = null;
};
strikethrough = mkOption {
description = "The default strikethrough attribute for buffers";
type = nullOr luaInline;
default = null;
};
};
fill_hl = mkOption {
description = "The highlight group used to fill the tabline space";
type = str;
default = "TabLineFill";
};
tabs = {
placement = mkOption {
description = "The position of the tabline";
type = enum ["left" "right"];
default = "left";
};
};
sidebar = {
filetype = mkOption {
description = "The filetype of the sidebar";
type = listOf str;
default = ["NvimTree" "neo-tree" "SidebarNvim"];
};
};
# components = mkOption {
# description = "The components to use in the tabline";
# type = luaInline;
# default = mkLuaInline ''
# {
# {
# text = ' ',
# bg = vim.api.nvim_get_hl_by_name('Normal', true).background,
# },
# {
# text = '',
# fg = vim.api.nvim_get_hl_by_name('ColorColumn', true).background,
# bg = vim.api.nvim_get_hl_by_name('Normal', true).background,
# },
# {
# text = function(buffer)
# return buffer.devicon.icon
# end,
# fg = function(buffer)
# return buffer.devicon.color
# end,
# },
# {
# text = ' ',
# },
# {
# text = function(buffer) return buffer.filename .. ' ' end,
# style = function(buffer)
# return buffer.is_focused and 'bold' or nil
# end,
# },
# {
# text = '',
# delete_buffer_on_left_click = true,
# },
# {
# text = '',
# fg = vim.api.nvim_get_hl_by_name('ColorColumn', true).background,
# bg = vim.api.nvim_get_hl_by_name('Normal', true).background,
# }
# }
# '';
# };
};
};
}

View File

@ -0,0 +1,46 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) mkBinding pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.tabline.cokeline;
self = import ./cokeline.nix {inherit lib;};
inherit (self.options.vim.tabline.cokeline) mappings;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
(assert config.vim.visuals.nvimWebDevicons.enable; "nvim-cokeline")
"bufdelete-nvim"
];
maps.normal = mkMerge [
(mkBinding cfg.mappings.cycleNext "<Plug>(cokeline-focus-next)" mappings.cycleNext.description)
(mkBinding cfg.mappings.cyclePrevious "<Plug>(cokeline-focus-prev)" mappings.cyclePrevious.description)
(mkBinding cfg.mappings.switchNext "<Plug>(cokeline-switch-next)" mappings.switchNext.description)
(mkBinding cfg.mappings.switchPrevious "<Plug>(cokeline-switch-prev)" mappings.switchPrevious.description)
# this does not work
# (mkBinding cfg.mappings.pick "<Plug>(cokeline-pick-focus)" mappings.pick.description)
# (mkLuaBinding cfg.mappings.pick "function() require('cokeline.mappings').pick(\"focus\") end" mappings.pick.description)
# (mkBinding cfg.mappings.closeByLetter "<Plug>(cokeline-pick-close)" mappings.closeByLetter.description)
];
binds.whichKey.register = pushDownDefault {
"<leader>b" = "+Buffer";
"<leader>bm" = "BufferLineMove";
};
luaConfigRC = {
cokeline = entryAnywhere ''
require('cokeline').setup(${toLuaObject cfg.setupOpts})
'';
};
};
};
}

View File

@ -0,0 +1,6 @@
{
imports = [
./cokeline.nix
./config.nix
];
}

View File

@ -1,5 +1,6 @@
{
imports = [
./nvim-bufferline
./cokeline
];
}

View File

@ -32,7 +32,6 @@ in {
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)

View File

@ -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
'';
};
};
}