summaryrefslogblamecommitdiffstats
path: root/.config/nvim/lua/statusline.lua
blob: 099d930d95c98da03164bbc2a1d9c4c43008cac5 (plain) (tree)





















































                                                   
--[[
-- Statusline
--]]

local api = vim.api
local cmd = vim.cmd
local utils = require('utils')

function _(str)
  return '[' .. str .. ']'
end

function set_split()
  return '%m%='
end

function get_separator()
  return ' '
end

function get_file()
  return '%f'
end

function get_fileformat()
  return '%{&fileformat}'
end

function get_fileencoding()
  return '%{&fileencoding?&fileencoding:&encoding}'
end

function get_scrollposition()
  return '%p%%'
end

function get_cursorposition()
  return '%l:%c'
end

function get_statusline()
  return table.concat({
    get_file(),
    set_split(),
    _(get_fileencoding()),
    _(get_fileformat()),
    _(get_scrollposition()),
    _(get_cursorposition()),
  })
end

-- Enable statusline
utils.opt('o', 'laststatus', 2)
utils.opt('o', 'statusline', get_statusline())
remember that computers suck.