all repos — dotfiles @ 98fdf978aec99161348d340ce20e463aca129c1c

my *nix dotfiles

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

 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
local git = require('statusline.git')
local M = {}

-- set highlights for statusline sections
vim.api.nvim_exec(
[[
  hi PrimaryBlock ctermfg=06 ctermbg=00
  hi SecondaryBlock   ctermfg=07 ctermbg=00
  hi Blanks   ctermfg=08 ctermbg=00
  hi GitClean ctermfg=02 ctermbg=00
  hi GitDirty ctermfg=01 ctermbg=00
]], false)

function M.statusline()
  local stl = {}
  if vim.bo.filetype ~= 'NvimTree' then
    stl = {''}
  end

  stl = {
    '%#PrimaryBlock#',
    '%f',
    '%#Blanks#',
    '%m',
    '%#SecondaryBlock#',
    ' '..git.git_branch,
    '%=',
    '%#SecondaryBlock#',
    '%l,%c ',
    '%#PrimaryBlock#',
    '%{&filetype}',
  }
  return table.concat(stl)
end

return M