summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/statusline.lua
blob: c436a8e4b8885646a16adcace872fb6d2f9c683e (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
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
vim.o.lastatus = 2
vim.o.statusline = get_statusline()
remember that computers suck.