Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/manual/release-notes/rl-0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -676,4 +676,8 @@ https://github.com/gorbit99/codewindow.nvim
- Added `goimports` as supported formatters to `vim.languages.go`.
[kruziikrel13](https://github.com/kruziikrel13)
- Added barbar plugin to vim.tabline as `vim.tabline.barbar`
<!-- vim: set textwidth=80: -->
44 changes: 44 additions & 0 deletions modules/plugins/tabline/barbar/barbar.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (config.vim.lib) mkMappingOption;
in {
options.vim.tabline.barbar = {
enable = mkEnableOption "barbar";

mappings = {
closeCurrent = mkMappingOption "Close buffer" "<leader>bd";
cycleNext = mkMappingOption "Next buffer" "<leader>bn";
cyclePrevious = mkMappingOption "Previous buffer" "<leader>bp";
sortByLanguage = mkMappingOption "Sort buffers by extension" "<leader>bse";
sortByDirectory = mkMappingOption "Sort buffers by directory" "<leader>bsd";
sortById = mkMappingOption "Sort buffers by ID" "<leader>bsi";
closeAllButVisible = mkMappingOption "Close all non-visible buffers" "<leader>bo";
};

setupOpts = mkPluginSetupOption "barbar-nvim" {
icons.filetype.enabled = mkOption {
type = bool;
default = true;
example = false;
description = ''
Requires 'nvim-web-devicons' if `true`
'';
Comment on lines +29 to +31

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This should be inline if the description is to be kept less than 80 characters.
  2. Please describe what the option does rather than what it depends on; you can also do nvim-web-devicons.enable = config.vim.tabline.barbar.setupOpts.icons.filetype.enabled; in the config section.

};
insert_at_end = mkOption {
type = bool;
default = false;
example = true;
description = ''
If true, new buffers will be inserted at the start / end of the list.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If true, new buffers will be inserted at the start / end of the list.
If `true`, new buffers will be inserted at the start / end of the list.

Default is to insert after current buffer.
'';
};
};
};
}
63 changes: 63 additions & 0 deletions modules/plugins/tabline/barbar/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
config,
options,
lib,
...
}:
let
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) mkKeymap;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;

cfg = config.vim.tabline.barbar;
mappings = options.vim.tabline.barbar.mappings;
in
{
config = mkIf cfg.enable {
vim = {
startPlugins = [ "barbar" ];
pluginRC.barbar = entryAnywhere ''
require('barbar').setup(${toLuaObject cfg.setupOpts})
'';

keymaps = [
(mkKeymap "n" cfg.mappings.closeCurrent "<CMD>BufferClose<CR>" {
desc = mappings.closeCurrent.description;
silent = true;
noremap = false;
})
(mkKeymap "n" cfg.mappings.cycleNext "<CMD>BufferNext<CR>" {
desc = mappings.cycleNext.description;
silent = true;
noremap = false;
})
(mkKeymap "n" cfg.mappings.cyclePrevious "<CMD>BufferPrevious<CR>" {
desc = mappings.cyclePrevious.description;
silent = true;
noremap = false;
})
(mkKeymap "n" cfg.mappings.sortByLanguage "<CMD>BufferOrderByLanguage<CR>" {
desc = mappings.sortByLanguage.description;
silent = true;
noremap = false;
})
(mkKeymap "n" cfg.mappings.sortByDirectory "<CMD>BufferOrderByDirectory<CR>" {
desc = mappings.sortByDirectory.description;
silent = true;
noremap = false;
})
(mkKeymap "n" cfg.mappings.sortById "<CMD>BufferOrderByBufferNumber<CR>" {
desc = mappings.sortById.description;
silent = true;
noremap = false;
})
(mkKeymap "n" cfg.mappings.closeAllButVisible "<CMD>BufferCloseAllButVisible<CR>" {
desc = mappings.closeAllButVisible.description;
silent = true;
noremap = false;
})
];
};
};
}
6 changes: 6 additions & 0 deletions modules/plugins/tabline/barbar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
imports = [
./barbar.nix
./config.nix
];
}
1 change: 1 addition & 0 deletions modules/plugins/tabline/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
imports = [
./nvim-bufferline
./barbar
];
}
16 changes: 16 additions & 0 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@
"url": "https://github.com/yetone/avante.nvim/archive/0222885dff8ff17def0a78ccdeaf02c32230a55a.tar.gz",
"hash": "sha256-BwPoJ4XdLrxWv9QfAnLdkZXB5z7hgJ103/JVdm6xpPg="
},
"barbar": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "romgrk",
"repo": "barbar.nvim"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v1.9.1",
"revision": "791123b5a511b8a59713b530a26288b54b22a357",
"url": "https://api.github.com/repos/romgrk/barbar.nvim/tarball/refs/tags/v1.9.1",
"hash": "sha256-XEHEK2Z97YSS4/flsXSdle/mHKhp6maEg4uXwst88m8="
},
"base16": {
"type": "Git",
"repository": {
Expand Down