all repos — dotfiles @ db27583472bdd9ae76db8c01d8e77d5cfaac9f61

my *nix dotfiles

config/nvim/lua/statusline/line.lua (view raw)

 1local git = require('statusline.git')
 2local utils = require('utils')
 3
 4-- set highlights for statusline sections
 5vim.api.nvim_exec(
 6[[
 7  hi PrimaryBlock ctermfg=06 ctermbg=00
 8  hi SecondaryBlock   ctermfg=07 ctermbg=00
 9  hi Blanks   ctermfg=08 ctermbg=00
10  hi GitClean ctermfg=02 ctermbg=00
11  hi GitDirty ctermfg=01 ctermbg=00
12]], false)
13
14local git_info
15if git.in_git then
16  git_info = string.format(' %s %s', git.branch(), git.status())
17else
18  git_info = ''
19end
20
21
22local stl = {
23  '%#PrimaryBlock#',
24  '%f',
25  '%#Blanks#',
26  '%m',
27  '%#SecondaryBlock#',
28  git_info,
29  '%=',
30  '%#SecondaryBlock#',
31  '%l,%c ',
32  '%#PrimaryBlock#',
33  '%{&filetype}',
34}
35
36_G.statusline = function()
37  return table.concat(stl)
38end
39
40utils.create_augroup({
41  { 'WinEnter,BufEnter', '*', 'setlocal', 'statusline=%!v:lua.statusline()' },
42}, 'Statusline')