summaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua/config/galaxyline.lua
blob: a4bdf05ef8c1652b07dc676b96c6d13b634acc04 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
local gl = require('galaxyline')
local colors = {
  yellow = vim.g.terminal_color_11,
  cyan = vim.g.terminal_color_14,
  darkblue = vim.g.terminal_color_4,
  green = vim.g.terminal_color_10,
  orange = vim.g.terminal_color_3,
  violet = vim.g.terminal_color_5,
  magenta = vim.g.terminal_color_13,
  blue = vim.g.terminal_color_12,
  red = vim.g.terminal_color_9,
}
local condition = require('galaxyline.condition')
local gls = gl.section
local lsp = require('galaxyline.provider_lsp')
gl.short_line_list = {'nerdtree', 'NeogitStatus', 'vim-plug', 'lspsagaoutline'}

gls.left[1] = {
  RainbowBlue = {
    provider = function() return '▊ ' end,
    highlight = {colors.blue, 'StatusLine'}
  },
}
gls.left[2] = {
  ViMode = {
    provider = function()
      -- auto change color according the vim mode
      local mode_color = {n = colors.red, i = colors.green,v=colors.blue,
                          ['^V'] = colors.blue,V=colors.blue,
                          c = colors.magenta,no = colors.red,s = colors.orange,
                          S=colors.orange,['^S'] = colors.orange,
                          ic = colors.yellow,R = colors.violet,Rv = colors.violet,
                          cv = colors.red,ce=colors.red, r = colors.cyan,
                          rm = colors.cyan, ['r?'] = colors.cyan,
                          ['!']  = colors.red,t = colors.red}
      vim.api.nvim_command('hi GalaxyViMode guifg='..mode_color[vim.fn.mode()])
      return '  '
    end,
    highlight = {colors.red, 'StatusLine', 'bold'},
  }, 
}

gls.left[3] = {
  FileSize = {
    provider = 'FileSize',
    condition = condition.buffer_not_empty,
    highlight = {'StatusLine', 'StatusLine'},
  }
}
gls.left[4] ={
  FileIcon = {
    provider = 'FileIcon',
    condition = function()
        if vim.g.GtkGuiLoaded ~= nil and condition.buffer_not_empty() then
            return true
        end
        return false
    end,
    highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color, 'StatusLine'},
  },
}

gls.left[5] = {
  FileName = {
    provider = 'FileName',
    condition = condition.buffer_not_empty,
    highlight = {colors.magenta, 'StatusLine', 'bold'}
  }
}

gls.left[6] = {
  LineInfo = {
    provider = 'LineColumn',
    separator = ' ',
    separator_highlight = {'NONE', 'StatusLine'},
    highlight = {'NONE', 'StatusLine'},
  },
}

gls.left[7] = {
  PerCent = {
    provider = 'LinePercent',
    separator = ' ',
    separator_highlight = {'NONE', 'StatusLine'},
    highlight = {'NONE', 'StatusLine', 'bold'},
  }
}

gls.left[8] = {
  DiagnosticError = {
    provider = 'DiagnosticError',
    icon = '  ',
    highlight = {colors.red, 'StatusLine'}
  }
}
gls.left[9] = {
  DiagnosticWarn = {
    provider = 'DiagnosticWarn',
    icon = '  ',
    highlight = {colors.yellow, 'StatusLine'},
  }
}

gls.left[10] = {
  DiagnosticHint = {
    provider = 'DiagnosticHint',
    icon = '  ',
    highlight = {colors.cyan, 'StatusLine'},
  }
}

gls.left[11] = {
  DiagnosticInfo = {
    provider = 'DiagnosticInfo',
    icon = '  ',
    highlight = {colors.blue, 'StatusLine'},
  }
}

gls.mid[1] = {
  ShowLspClient = {
    provider = 'GetLspClient',
    condition = function ()
      local tbl = {['dashboard'] = true,['']=true}
      if tbl[vim.bo.filetype] then
        return false
      elseif lsp.get_lsp_client() == 'No Active Lsp' then
        return false
      end
      return true
    end,
    icon = '⚙ LSP:',
    highlight = {colors.cyan, 'StatusLine','bold'}
  }
}

gls.right[1] = {
  GitIcon = {
    provider = function() return '  ' end,
    condition = condition.check_git_workspace,
    separator = ' ',
    separator_highlight = {'NONE', 'StatusLine'},
    highlight = {colors.violet, 'StatusLine', 'bold'},
  }
}

gls.right[2] = {
  GitBranch = {
    provider = 'GitBranch',
    condition = condition.check_git_workspace,
    highlight = {colors.violet, 'StatusLine', 'bold'},
  }
}

gls.right[3] = {
  DiffAdd = {
    provider = 'DiffAdd',
    condition = condition.hide_in_width,
    icon = ' +',
    highlight = {colors.green, 'StatusLine'},
  }
}
gls.right[4] = {
  DiffModified = {
    provider = 'DiffModified',
    condition = condition.hide_in_width,
    icon = ' ±',
    highlight = {colors.orange, 'StatusLine'},
  }
}
gls.right[5] = {
  DiffRemove = {
    provider = 'DiffRemove',
    condition = condition.hide_in_width,
    icon = ' -',
    highlight = {colors.red, 'StatusLine'},
  }
}

gls.right[6] = {
  RainbowBlue = {
    provider = function() return ' ▊' end,
    highlight = {colors.blue, 'StatusLine'}
  },
}

gls.short_line_left[1] = {
  BufferType = {
    provider = 'FileTypeName',
    separator = ' ',
    separator_highlight = {'NONE', 'StatusLine'},
    highlight = {colors.blue, 'StatusLine', 'bold'}
  }
}

gls.short_line_left[2] = {
  SFileName = {
    provider =  'SFileName',
    condition = condition.buffer_not_empty,
    highlight = {'StatusLine', 'StatusLine', 'bold'}
  }
}

gls.short_line_right[1] = {
  BufferIcon = {
    provider= 'BufferIcon',
    highlight = {'StatusLine', 'StatusLine'},
  }
}