Prepare components
This commit is contained in:
@@ -24,14 +24,16 @@ M.events = {
|
||||
}
|
||||
|
||||
M.sections = {
|
||||
require('hardline.mode'), ' ',
|
||||
require('hardline.git'), ' ',
|
||||
require('hardline.file'), ' ',
|
||||
{class = 'A', item = require('hardline.mode').get_item()}, ' ',
|
||||
{class = 'B', item = require('hardline.git').get_item()}, ' ',
|
||||
{class = 'C', item = require('hardline.filename').get_item()}, ' ',
|
||||
'%=',
|
||||
-- require('hardline.lsp'),
|
||||
-- require('hardline.whitespace'),
|
||||
require('hardline.filetype'), ' ',
|
||||
require('hardline.line'),
|
||||
-- {class = 'error', item = require('hardline.lsp').get_error()}, ' ',
|
||||
-- {class = 'warning', item = require('hardline.lsp').get_warning()}, ' ',
|
||||
-- {class = 'warning', item = require('hardline.whitespace').get_item()}, ' ',
|
||||
-- {class = 'X', item = require('hardline.wordcount').get_item()}, ' ',
|
||||
{class = 'Y', item = require('hardline.filetype').get_item()}, ' ',
|
||||
{class = 'Z', item = require('hardline.line').get_item()},
|
||||
}
|
||||
|
||||
-------------------- HELPERS -------------------------------
|
||||
@@ -48,9 +50,9 @@ local function load_section(section)
|
||||
elseif type(section) == 'string' then
|
||||
return section
|
||||
elseif type(section) == 'table' then
|
||||
return load_section(section.get_component)
|
||||
return load_section(section.item)
|
||||
end
|
||||
echo('WarningMsg', 'Section must be a function or a string!')
|
||||
echo('WarningMsg', 'Invalid section.')
|
||||
return ''
|
||||
end
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ local fn, vim = vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_mode()
|
||||
return ' %h%r'
|
||||
return '%h%r'
|
||||
end
|
||||
|
||||
function M.get_name()
|
||||
return fn.expand('%:~:.')
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({
|
||||
[[%<]],
|
||||
[[%{luaeval('require("hardline.file").get_name()')}]],
|
||||
'%<',
|
||||
[[%{luaeval('require("hardline.filename").get_name()')}]], ' ',
|
||||
M.get_mode(),
|
||||
})
|
||||
end
|
||||
@@ -6,7 +6,7 @@ function M.get_filetype()
|
||||
return bo.filetype
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({
|
||||
[[%{luaeval('require("hardline.filetype").get_filetype()')}]],
|
||||
})
|
||||
|
||||
@@ -18,12 +18,12 @@ function M.get_branch()
|
||||
if not g.loaded_gitgutter then
|
||||
return ''
|
||||
end
|
||||
return string.format(' %s', fn.FugitiveHead())
|
||||
return string.format('%s', fn.FugitiveHead())
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({
|
||||
[[%{luaeval('require("hardline.git").get_hunks()')}]],
|
||||
[[%{luaeval('require("hardline.git").get_hunks()')}]], ' ',
|
||||
[[%{luaeval('require("hardline.git").get_branch()')}]],
|
||||
})
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ function M.get_percent()
|
||||
return '%03p%%'
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({
|
||||
[[%{luaeval('require("hardline.line").get_line()')}]], ':',
|
||||
[[%{luaeval('require("hardline.line").get_column()')}]], ' ',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local fn, vim = vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({})
|
||||
end
|
||||
|
||||
|
||||
@@ -25,21 +25,21 @@ function M.get_paste()
|
||||
if not o.paste then
|
||||
return ''
|
||||
end
|
||||
return ' PASTE'
|
||||
return 'PASTE'
|
||||
end
|
||||
|
||||
function M.get_spell()
|
||||
if not wo.spell then
|
||||
return ''
|
||||
end
|
||||
return string.format(' SPELL [%s]', string.upper(bo.spelllang))
|
||||
return string.format('SPELL [%s]', string.upper(bo.spelllang))
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({
|
||||
[[%{luaeval('require("hardline.mode").get_mode()')}]],
|
||||
[[%{luaeval('require("hardline.mode").get_paste()')}]],
|
||||
[[%{luaeval('require("hardline.mode").get_spell()')}]],
|
||||
[[%{luaeval('require("hardline.mode").get_mode()')}]], ' ',
|
||||
[[%{luaeval('require("hardline.mode").get_paste()')}]], ' ',
|
||||
[[%{luaeval('require("hardline.mode").get_spell()')}]], ' '
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local fn, vim = vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_component()
|
||||
function M.get_item()
|
||||
return table.concat({})
|
||||
end
|
||||
|
||||
|
||||
8
lua/hardline/wordcount.lua
Normal file
8
lua/hardline/wordcount.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local fn, vim = vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_item()
|
||||
return table.concat({})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user