summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/plugins/barbar.lua
blob: 906c73af56e656715d95e2c2fd1246671bd759b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
return {
    {
        "romgrk/barbar.nvim",
        dependencies = {
            'lewis6991/gitsigns.nvim',
            "nvim-tree/nvim-web-devicons"
        },
        init = function()
            vim.g.barbar_auto_setup = false -- disable auto-setup
            local map = require("helpers.keys").map

            -- move to previous/next
            map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', "switch to previous buffer")
            map('n', '<A-.>', '<Cmd>BufferNext<CR>', "switch to next buffer")

            -- re-order to previous/next
            map('n', '<A-e>', '<Cmd>BufferMovePrevious<CR>', "move buffer back")
            map('n', '<A-i>', '<Cmd>BufferMoveNext<CR>', "move buffer forward")

            -- goto buffer in position...
            map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>')
            map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>')
            map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>')
            map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>')
            map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>')
            map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>')
            map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>')
            map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>')
            map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>')
            map('n', '<A-0>', '<Cmd>BufferLast<CR>')

            -- pin/unpin buffer
            map('n', '<A-p>', '<Cmd>BufferPin<CR>', "pin buffer")
            -- close buffer
            map('n', '<A-c>', '<Cmd>BufferClose<CR>', "close buffer")
            -- magic buffer-picking mode
            map('n', '<leader>dg', '<Cmd>BufferPick<CR>', "buffer picking mode")
            -- sort automatically by...
            map('n', '<Leader>db', '<Cmd>BufferOrderByBufferNumber<CR>', "sort buffers by number")
            map('n', '<Leader>dd', '<Cmd>BufferOrderByDirectory<CR>', "sort buffers by directory")
            map('n', '<Leader>dl', '<Cmd>BufferOrderByLanguage<CR>', "sort buffers by language")
            map('n', '<Leader>dw', '<Cmd>BufferOrderByWindowNumber<CR>', "sort buffers by window number")
        end,
        opts = {
            animation = false,
            auto_hide = true,
            tabpages = true,
            closable = true,
            clickable = false,
            icons = {
                diagnostics = {
                    [vim.diagnostic.severity.ERROR] = { enabled = true, icon = '❌' },
                    [vim.diagnostic.severity.WARN] = { enabled = false },
                    [vim.diagnostic.severity.INFO] = { enabled = false },
                    [vim.diagnostic.severity.HINT] = { enabled = true },
                },
                filetype = {
                    custom_colors = false,
                    enabled = true,
                },
                separator = { left = '▎', right = '' },
                modified = { button = '' },
                pinned = { button = '', filename = true, separator = { right = '' } },
            },

            insert_at_end = false,
            insert_at_start = false,

            maximum_padding = 1,
            minimum_padding = 1,
            maximum_length = 30,
            semantic_letters = true,
            letters = 'arstneoidhqwfpluy;zxcvkmARSTNEOIDHQWFPLUYZXCVKM',
            no_name_title = nil,
        },
    },
}