summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/statusline.lua
blob: 099d930d95c98da03164bbc2a1d9c4c43008cac5 (plain) (blame)
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
--[[
-- 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.