From 82730be5029a3aee00a15c48dc5449542a181174 Mon Sep 17 00:00:00 2001
From: max397574
Date: Sat, 23 Oct 2021 16:42:01 +0200
Subject: =?UTF-8?q?docs(readme):=20=F0=9F=93=9Aadded=20more=20examples?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
readme.md | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 163 insertions(+), 21 deletions(-)
(limited to 'readme.md')
diff --git a/readme.md b/readme.md
index e1eb083..c2198ac 100644
--- a/readme.md
+++ b/readme.md
@@ -96,73 +96,86 @@ section = {
oldfiles_amount = ,
}
--- table with all the paddings
+-- the padding before each section
+-- table with integers
paddings = {
, -- for as as many sections as you have
- padding_before_section_2,
+ ,
}
--- e.g. #FF000D
-color = hex_color_string
+-- a hex color
+-- e.g. "#FF000D"
+-- string
+color =
--- text: content is a table of strings as content which will be displayed
--- mapping: content a table with commands/mapping which will be displayed
--- and can be used with
--- oldfiles: leave content empty
+-- text: just text will be displayed
+
+-- mapping: commands/mapping which will be displayed
+-- those can be executed with
+-- the mappings can be used
+
+-- oldfiles: oldfiles will be displayed
+-- those can be opened with 'o'
-- you can specify the amount of oldfiles and whether to display only one from the current directory
+-- string
type = "text"/"mapping"/"oldfiles"
-- display only oldfiles of current directory
-- only relevant if type = "oldfiles"
+-- boolean
oldfiles_directory = true/false
-- how to align the section
+-- string
align = "left"/"center"/"right"
--- whether the section should be "folded" with a title
+-- whether the section should be "folded" with the title
-- title must be set
-fold = true/false
+-- string
+fold_section = true/false
-- title of folded section
--- e.g. "Oldfiles"
-title = title_string
+-- string
+title =
-- only relevant if alignment is left or right
-- if < 0 fraction of screen width
-- if > 0 numbers of column
-margin = margin_number
+-- integer or float
+margin =
-- when type = "olfiles" -> leave empty
-- when type = "mapping" -> table with the format
{
[] = {, }
}
-e.g.
-{
- [" Find File"] = { "Telescope find_files", "ff" },
- [" Find Word"] = { "Telescope live_grep", "lg" },
-}
+
-- when type = "text" -> table with strings of text
-- those can be returned by a function
-e.g.
-{ "startup.nvim", "by max397574"}, -- example for a footer
content =
-- the highlight group to highlight the section with
-- leave empty to use a color
+-- string
highlight = highlight_group
-- color used if no highlight group is specified (highlight = "")
--- hex color code
+-- hex color
+-- string
default_color = ,
-- vim command to be executed, when section get set
-- for example to create mappings
+-- string
command = ,
-- the amount of oldfiles to be displayed
+-- integer
oldfiles_amount = ,
```
+
+### Buildingblocks
+
### Examples
@@ -194,5 +207,134 @@ content = function()
end
```
+With a separate function:
+
+```lua
+local function time()
+ local clock = " " .. os.date "%H:%M"
+ local date = " " .. os.date "%d-%m-%y"
+ return {clock,date}
+end
+
+setting = {
+ ...
+ content = time()
+ ...
+}
+```
+
+
+
+
+
+
+Content for type = "mapping"
+
+
+
+```lua
+content = {
+ [" Find File"] = { "Telescope find_files", "ff" },
+ [" Find Word"] = { "Telescope live_grep", "lg" },
+ [" Recent Files"] = { "Telescope oldfiles", "of" },
+ [" File Browser"] = { "Telescope file_browser", "fb" },
+ [" Colorschemes"] = { "Telescope colorscheme", "cs" },
+ [" New File"] = { "lua require'startup'.new_file()", "nf" },
+},
+```
+
+
+
+
+
+
+A complete configuration
+
+
+
+```lua
+local settings = {
+ header = {
+ type = "text",
+ oldfiles_directory = false,
+ align = "center",
+ fold = false,
+ title = "",
+ margin = 5,
+ content = require"startup.buildingblocks.headers".hydra(),
+ highlight = "TSString",
+ default_color = "",
+ -- use `I` to edit init.lua and `C` to search config files
+ command = [[
+ nnoremap I :e ~/.config/nvim/init.lua
+ nnoremap C :lua require'telescope.builtin'.find_files({cwd="~/.config"})
+ ]],
+ oldfiles_amount = 0,
+ }
+
+ body_1 = {
+ type = "oldfiles"
+ oldfiles_directory = false,
+ align = "center",
+ fold = true,
+ title = "Last Opened Files"
+ margin = 5,
+ content = "",
+ highlight = "",
+ default_color = "#db4b4b",
+ command = "",
+ oldfiles_amount = 8,
+ }
+
+ body_2 = {
+ type = "mappings",
+ oldfiles_directory = false,
+ align = "center",
+ fold = false,
+ title = "",
+ margin = 5,
+ content = {
+ [" Find File"] = { "Telescope find_files", "ff" },
+ [" Find Word"] = { "Telescope live_grep", "lg" },
+ [" Recent Files"] = { "Telescope oldfiles", "of" },
+ [" File Browser"] = { "Telescope file_browser", "fb" },
+ [" Colorschemes"] = { "Telescope colorscheme", "cs" },
+ [" New File"] = { "lua require'startup'.new_file()", "nf" },
+ },
+ highlight = "Number",
+ default_color = "#699999",
+ command = "",
+ oldfiles_amount = 0,
+ }
+
+ footer = {
+ type = "text",
+ oldfiles_directory = false,
+ align = "center",
+ fold = false,
+ title = "",
+ margin = 5,
+ content = require"startup.buildingblocks.functions".quote(),
+ highlight = "Constant",
+ default_color = "",
+ command = "",
+ oldfiles_amount = 0,
+ }
+
+ options = {
+ mapping_keys = true,
+ empty_lines_between_mappings = false,
+ paddings = { 1, 2, 2, 1 }
+ }
+
+ colors = {
+ background = "#1e222a"
+ }
+ parts = { "header", "body_1", "body_2", "footer" }
+}
+
+return settings
+```
+
--
cgit v1.2.3