Add new components
This commit is contained in:
@@ -27,6 +27,11 @@ M.sections = {
|
||||
require('hardline.mode'), ' ',
|
||||
require('hardline.git'), ' ',
|
||||
require('hardline.file'), ' ',
|
||||
'%=',
|
||||
-- require('hardline.lsp'),
|
||||
-- require('hardline.whitespace'),
|
||||
require('hardline.filetype'), ' ',
|
||||
require('hardline.line'),
|
||||
}
|
||||
|
||||
-------------------- HELPERS -------------------------------
|
||||
|
||||
@@ -11,6 +11,7 @@ end
|
||||
|
||||
function M.get_component()
|
||||
return table.concat({
|
||||
[[%<]],
|
||||
[[%{luaeval('require("hardline.file").get_name()')}]],
|
||||
M.get_mode(),
|
||||
})
|
||||
|
||||
15
lua/hardline/filetype.lua
Normal file
15
lua/hardline/filetype.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local vim = vim
|
||||
local bo = vim.bo
|
||||
local M = {}
|
||||
|
||||
function M.get_filetype()
|
||||
return bo.filetype
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
return table.concat({
|
||||
[[%{luaeval('require("hardline.filetype").get_filetype()')}]],
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -15,7 +15,10 @@ function M.get_hunks()
|
||||
end
|
||||
|
||||
function M.get_branch()
|
||||
return ''
|
||||
if not g.loaded_gitgutter then
|
||||
return ''
|
||||
end
|
||||
return string.format(' %s', fn.FugitiveHead())
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
|
||||
24
lua/hardline/line.lua
Normal file
24
lua/hardline/line.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local cmd, fn, vim = vim.cmd, vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_line()
|
||||
return string.format('%03d/%03d', fn.line('.'), fn.line('$'))
|
||||
end
|
||||
|
||||
function M.get_column()
|
||||
return string.format('%03d/%03d', fn.col('.'), fn.col('$') - 1)
|
||||
end
|
||||
|
||||
function M.get_percent()
|
||||
return '%03p%%'
|
||||
end
|
||||
|
||||
function M.get_component()
|
||||
return table.concat({
|
||||
[[%{luaeval('require("hardline.line").get_line()')}]], ':',
|
||||
[[%{luaeval('require("hardline.line").get_column()')}]], ' ',
|
||||
M.get_percent(),
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
8
lua/hardline/lsp.lua
Normal file
8
lua/hardline/lsp.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local fn, vim = vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_component()
|
||||
return table.concat({})
|
||||
end
|
||||
|
||||
return M
|
||||
8
lua/hardline/whitespace.lua
Normal file
8
lua/hardline/whitespace.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local fn, vim = vim.fn, vim
|
||||
local M = {}
|
||||
|
||||
function M.get_component()
|
||||
return table.concat({})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user