mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-26 08:49:48 +01:00
Merge 0ad53980f3
into 7b719d0044
This commit is contained in:
commit
ef2e61bdd7
7 changed files with 299 additions and 1 deletions
17
flake.lock
17
flake.lock
|
@ -1021,6 +1021,22 @@
|
||||||
"type": "github"
|
"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": {
|
"plugin-nvim-colorizer-lua": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1820,6 +1836,7 @@
|
||||||
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
|
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
|
||||||
"plugin-nvim-cmp": "plugin-nvim-cmp",
|
"plugin-nvim-cmp": "plugin-nvim-cmp",
|
||||||
"plugin-nvim-code-action-menu": "plugin-nvim-code-action-menu",
|
"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-colorizer-lua": "plugin-nvim-colorizer-lua",
|
||||||
"plugin-nvim-cursorline": "plugin-nvim-cursorline",
|
"plugin-nvim-cursorline": "plugin-nvim-cursorline",
|
||||||
"plugin-nvim-dap": "plugin-nvim-dap",
|
"plugin-nvim-dap": "plugin-nvim-dap",
|
||||||
|
|
|
@ -228,6 +228,12 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Cokeline
|
||||||
|
plugin-nvim-cokeline = {
|
||||||
|
url = "github:willothy/nvim-cokeline";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Statuslines
|
# Statuslines
|
||||||
plugin-lualine = {
|
plugin-lualine = {
|
||||||
url = "github:hoob3rt/lualine.nvim";
|
url = "github:hoob3rt/lualine.nvim";
|
||||||
|
|
223
modules/plugins/tabline/cokeline/cokeline.nix
Normal file
223
modules/plugins/tabline/cokeline/cokeline.nix
Normal 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,
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
46
modules/plugins/tabline/cokeline/config.nix
Normal file
46
modules/plugins/tabline/cokeline/config.nix
Normal 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})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/tabline/cokeline/default.nix
Normal file
6
modules/plugins/tabline/cokeline/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./cokeline.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./nvim-bufferline
|
./nvim-bufferline
|
||||||
|
./cokeline
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ in {
|
||||||
maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
(mkLuaBinding cfg.mappings.closeCurrent "require(\"bufdelete\").bufdelete" mappings.closeCurrent.description)
|
(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.cycleNext ":BufferLineCycleNext<CR>" mappings.cycleNext.description)
|
|
||||||
(mkBinding cfg.mappings.cyclePrevious ":BufferLineCyclePrev<CR>" mappings.cyclePrevious.description)
|
(mkBinding cfg.mappings.cyclePrevious ":BufferLineCyclePrev<CR>" mappings.cyclePrevious.description)
|
||||||
(mkBinding cfg.mappings.pick ":BufferLinePick<CR>" mappings.pick.description)
|
(mkBinding cfg.mappings.pick ":BufferLinePick<CR>" mappings.pick.description)
|
||||||
(mkBinding cfg.mappings.sortByExtension ":BufferLineSortByExtension<CR>" mappings.sortByExtension.description)
|
(mkBinding cfg.mappings.sortByExtension ":BufferLineSortByExtension<CR>" mappings.sortByExtension.description)
|
||||||
|
|
Loading…
Reference in a new issue