Skip to content

Commit b51c404

Browse files
committed
tabline/barbar: init
1 parent 5bd50f1 commit b51c404

6 files changed

Lines changed: 129 additions & 0 deletions

File tree

docs/manual/release-notes/rl-0.9.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,4 +676,8 @@ https://github.com/gorbit99/codewindow.nvim
676676
677677
- Added `goimports` as supported formatters to `vim.languages.go`.
678678
679+
[kruziikrel13](https://github.com/kruziikrel13)
680+
681+
- Added barbar plugin to vim.tabline as `vim.tabline.barbar`
682+
679683
<!-- vim: set textwidth=80: -->
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
config,
3+
lib,
4+
...
5+
}: let
6+
inherit (lib.options) mkOption mkEnableOption;
7+
inherit (lib.types) bool;
8+
inherit (lib.nvim.types) mkPluginSetupOption;
9+
inherit (config.vim.lib) mkMappingOption;
10+
in {
11+
options.vim.tabline.barbar = {
12+
enable = mkEnableOption "barbar";
13+
14+
mappings = {
15+
closeCurrent = mkMappingOption "Close buffer" "<leader>bd";
16+
cycleNext = mkMappingOption "Next buffer" "<leader>bn";
17+
cyclePrevious = mkMappingOption "Previous buffer" "<leader>bp";
18+
sortByLanguage = mkMappingOption "Sort buffers by extension" "<leader>bse";
19+
sortByDirectory = mkMappingOption "Sort buffers by directory" "<leader>bsd";
20+
sortById = mkMappingOption "Sort buffers by ID" "<leader>bsi";
21+
closeAllButVisible = mkMappingOption "Close all non-visible buffers" "<leader>bo";
22+
};
23+
24+
setupOpts = mkPluginSetupOption "barbar-nvim" {
25+
icons.filetype.enabled = mkOption {
26+
type = bool;
27+
default = true;
28+
example = false;
29+
description = ''
30+
Requires 'nvim-web-devicons' if `true`
31+
'';
32+
};
33+
insert_at_end = mkOption {
34+
type = bool;
35+
default = false;
36+
example = true;
37+
description = ''
38+
If true, new buffers will be inserted at the start / end of the list.
39+
Default is to insert after current buffer.
40+
'';
41+
};
42+
};
43+
};
44+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
config,
3+
lib,
4+
...
5+
}: let
6+
inherit (lib.modules) mkIf;
7+
inherit (lib.nvim.binds) mkKeymap;
8+
9+
cfg = config.vim.tabline.barbar;
10+
in {
11+
config = mkIf cfg.enable {
12+
vim = {
13+
lazy.plugins.barbar-nvim = {
14+
package = "barbar";
15+
setupModule = "barbar";
16+
inherit (cfg) setupOpts;
17+
18+
keys = [
19+
(mkKeymap "n" cfg.mappings.closeCurrent "<CMD>BufferClose<CR>" {
20+
desc = cfg.mappings.closeCurrent.description;
21+
silent = true;
22+
noremap = false;
23+
})
24+
(mkKeymap "n" cfg.mappings.cycleNext "<CMD>BufferNext<CR>" {
25+
desc = cfg.mappings.cycleNext.description;
26+
silent = true;
27+
noremap = false;
28+
})
29+
(mkKeymap "n" cfg.mappings.cyclePrevious "<CMD>BufferPrevious<CR>" {
30+
desc = cfg.mappings.cyclePrevious.description;
31+
silent = true;
32+
noremap = false;
33+
})
34+
(mkKeymap "n" cfg.mappings.sortByLanguage "<CMD>BufferOrderByLanguage<CR>" {
35+
desc = cfg.mappings.sortByLanguage.description;
36+
silent = true;
37+
noremap = false;
38+
})
39+
(mkKeymap "n" cfg.mappings.sortByDirectory "<CMD>BufferOrderByDirectory<CR>" {
40+
desc = cfg.mappings.sortByDirectory.description;
41+
silent = true;
42+
noremap = false;
43+
})
44+
(mkKeymap "n" cfg.mappings.sortById "<CMD>BufferOrderByBufferNumber<CR>" {
45+
desc = cfg.mappings.sortById.description;
46+
silent = true;
47+
noremap = false;
48+
})
49+
(mkKeymap "n" cfg.mappings.closeAllButVisible "<CMD>BufferCloseAllButVisible<CR>" {
50+
desc = cfg.mappings.closeAllButVisible.description;
51+
silent = true;
52+
noremap = false;
53+
})
54+
];
55+
};
56+
};
57+
};
58+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
imports = [
3+
./barbar.nix
4+
./config.nix
5+
];
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
imports = [
33
./nvim-bufferline
4+
./barbar
45
];
56
}

npins/sources.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@
3939
"url": "https://github.com/yetone/avante.nvim/archive/0222885dff8ff17def0a78ccdeaf02c32230a55a.tar.gz",
4040
"hash": "sha256-BwPoJ4XdLrxWv9QfAnLdkZXB5z7hgJ103/JVdm6xpPg="
4141
},
42+
"barbar": {
43+
"type": "GitRelease",
44+
"repository": {
45+
"type": "GitHub",
46+
"owner": "romgrk",
47+
"repo": "barbar.nvim"
48+
},
49+
"pre_releases": false,
50+
"version_upper_bound": null,
51+
"release_prefix": null,
52+
"submodules": false,
53+
"version": "v1.9.1",
54+
"revision": "791123b5a511b8a59713b530a26288b54b22a357",
55+
"url": "https://api.github.com/repos/romgrk/barbar.nvim/tarball/refs/tags/v1.9.1",
56+
"hash": "sha256-XEHEK2Z97YSS4/flsXSdle/mHKhp6maEg4uXwst88m8="
57+
},
4258
"base16": {
4359
"type": "Git",
4460
"repository": {

0 commit comments

Comments
 (0)