diff options
author | max397574 <[email protected]> | 2021-10-06 16:07:16 +0200 |
---|---|---|
committer | max397574 <[email protected]> | 2021-10-06 16:07:16 +0200 |
commit | f67f7bf4d9952abfcba3a26dd25c6f7afcd8614f (patch) | |
tree | 9bfbeccfa70bdfcbf65728e7a515bb6e4b91074b /lua | |
parent | c9c01918e614484b49c6eb5d02499b289ce54376 (diff) |
feat(config): ✨allow right align
Diffstat (limited to 'lua')
-rw-r--r-- | lua/startup.lua | 15 | ||||
-rw-r--r-- | lua/startup/config.lua | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/lua/startup.lua b/lua/startup.lua index cffe0b9..0696112 100644 --- a/lua/startup.lua +++ b/lua/startup.lua @@ -1,12 +1,13 @@ local M = {} local ns = vim.api.nvim_create_namespace "startup" +local limited_space = false + local opts = { noremap = true, silent = true } local settings = require "startup.config" local utils = require "startup.utils" local spaces = utils.spaces -local empty = utils.empty local function create_mappings() vim.api.nvim_buf_set_keymap( @@ -43,16 +44,23 @@ end local function align(dict) local aligned = {} + local max_len = utils.longest_line(dict) if settings.options.align == "center" then - local max_len = utils.longest_line(dict) local space_left = vim.o.columns - max_len for _, line in ipairs(dict) do table.insert(aligned, spaces(space_left / 2) .. line) end - elseif settings.options.align == "padding" then + elseif settings.options.align == "left" then for _, line in ipairs(dict) do table.insert(aligned, spaces(settings.options.padding) .. line) end + elseif settings.options.align == "right" then + for _, line in ipairs(dict) do + table.insert( + aligned, + spaces(vim.o.columns - max_len - settings.options.padding - 10) .. line + ) + end end return aligned end @@ -91,7 +99,6 @@ local function body() end function M.display() - local limited_space = false local rly_limited_space = false if vim.o.lines < (#settings.header + (#settings.tools * 2) + 20) then diff --git a/lua/startup/config.lua b/lua/startup/config.lua index 13a5df0..27206e7 100644 --- a/lua/startup/config.lua +++ b/lua/startup/config.lua @@ -25,9 +25,9 @@ local settings = { ["ﲉ Help Files"] = { "Telescope help_tags", "<leader>fh" }, }, options = { - align = "center", -- center or padding + align = "center", -- center, left or right mapping_names = true, - padding = 5, -- only used if align padding + padding = 5, -- only used if align left or right }, colors = { background = "#1f2227", |