summaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua/plugins/tabby.lua
blob: 0aa271e2cdaea2cabe1c016e3b400cb6394a17e0 (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
return {
  {
    'nanozuki/tabby.nvim',
    dependencies = {
      'nvim-tree/nvim-web-devicons',
    },
    config = function()
      local theme = {
        fill = 'TabLineFill',
        -- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' }
        head = 'TabLine',
        current_tab = 'TabLineSel',
        tab = 'TabLine',
        current_win = 'TabLineSel',
        win = 'TabLine',
        tail = 'TabLine',
      }
      require('tabby').setup({
        option = {
          theme = theme,
          nerdfont = true,
        },
      })
      require('tabby.tabline').set(function(line)
        return {
          {
            line.sep('', theme.head, theme.fill),
          },
          line.tabs().foreach(function(tab)
            local hl = tab.is_current() and theme.current_tab or theme.tab
            return {
              line.sep('', hl, theme.fill),
              tab.number(),
              tab.name(),
              tab.close_btn(''),
              line.sep('', hl, theme.fill),
              hl = hl,
              margin = ' ',
            }
          end),
          line.spacer(),
          line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
            local hl = win.is_current() and theme.current_win or theme.win
            return {
              line.sep('', hl, theme.fill),
              win.file_icon(),
              win.buf_name(),
              line.sep('', hl, theme.fill),
              hl = hl,
              margin = ' ',
            }
          end),
          {
            line.sep('', theme.tail, theme.fill),
          },
          hl = theme.fill,
        }
      end)
    end,
    --cond = function() return vim.fn.has('gui_running') == 0 end,
  },
}