From a92dabd3e97a7bea6e393e6b5733613dcfdcc9c2 Mon Sep 17 00:00:00 2001 From: max397574 Date: Thu, 7 Oct 2021 11:27:32 +0200 Subject: =?UTF-8?q?feat(plugin):=20=E2=9C=A8new=20settings=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings_skeleton.lua | 95 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 21 deletions(-) (limited to 'settings_skeleton.lua') diff --git a/settings_skeleton.lua b/settings_skeleton.lua index cb0078d..7e1c9b5 100644 --- a/settings_skeleton.lua +++ b/settings_skeleton.lua @@ -1,7 +1,51 @@ --- theme template (kinda) +local opts = { noremap = true, silent = true } +local function example_settings() + vim.api.nvim_buf_set_keymap(0, "n", "x", "lua print('test')", opts) + return { "entry_1", "entry_2" } +end + +---[[ +local example_section = { + -- text: content is a table of string (directly or from function) + -- mapping: content is mapping in format from below + type = "text", + -- left: text on left side with padding + -- right: text on right side with padding + -- center: text will be in center + align = "left", + -- int: amount of columns, + -- float: fraction of screen + -- only if right or left align + padding = 5, + -- table: a table with strings + -- function: a call to a function which returns a table with strings and does some other things + -- mapping: [""] = { "", ""} + content = { "line 1", "line 2" }, --table or function or mapping + highlight = "example", -- highlight group + default_color = "#FFFFFF", -- hex color code + command = "echo 'test worked'", -- a command which will be exected when section gets loaded +} +local settings = { + header = {}, + body = {}, + footer = {}, + options = { + mapping_keys = true, -- display keys for mappings (e.g. ff) + empty_lines_between_mappings = true, -- empty lines between mapping names + gap1 = 3, -- space between header and body -1 + gap2 = 4, -- space between body and footer -1 + }, + colors = { + background = "#1f2227", -- the default background color + }, +} +-- ]]-- local settings = { + -- every line should be same width without escaped \ header = { type = "text", + align = "center", + padding = 5, content = { " /$$ ", " |__/ ", @@ -12,34 +56,43 @@ local settings = { "| $$ | $$| $$$$$$$| $$$$$$/ \\ $/ | $$| $$ | $$ | $$", "|__/ |__/ \\_______/ \\______/ \\_/ |__/|__/ |__/ |__/", }, + highlight = "TSString", + default_color = "#009900", + command = "echo 'header works'", }, + -- name which will be displayed and command body = { + type = "mapping", + align = "left", + padding = 0.3, content = { [" Find File"] = { "Telescope find_files", "ff" }, [" Find Word"] = { "Telescope live_grep", "lg" }, [" Recent Files"] = { "Telescope oldfiles", "of" }, - [" File Browser"] = { "Telescope file_browser", "fb" }, - [" Config Files"] = { - 'lua require("telescope.builtin").find_files({cwd="~/.config"})', - "cf", - }, - [" Colorschemes"] = { "Telescope colorscheme", "cs" }, [" New File"] = { "lua require'startup'.new_file()", "nf" }, - ["ﲉ Help Files"] = { "Telescope help_tags", "fh" }, }, + highlight = "CoolHighlight", + default_color = "", + command = "highlight CoolHighlight guifg=#FF0000", + }, + footer = { + type = "text", + align = "right", + padding = 15, + content = example_settings(), + highlight = "", + default_color = "#990000", + command = "", + }, + + options = { + mapping_keys = true, -- display keys for mappings (e.g. ff) + empty_lines_between_mappings = true, -- empty lines between mapping names + gap1 = 3, -- space between header and body -1 + gap2 = 4, -- space between body and footer -1 + }, + colors = { + background = "#1f2227", }, - footer = {}, } return settings - ---[[ -type can be text or mapping - -text -> table with strings in it, can also be from a function -in function additional stuff can be done/defined -mapping -> ["title that will be displayed"] = { "command", "keys"} -e.g. [" Find File"] = { "Telescope find_files", "ff" }, -symbols can be found at -https://www.nerdfonts.com/cheat-sheet -]] --- -- cgit v1.2.3