diff options
author | max397574 <[email protected]> | 2021-10-23 16:42:01 +0200 |
---|---|---|
committer | max397574 <[email protected]> | 2021-10-23 16:42:01 +0200 |
commit | 82730be5029a3aee00a15c48dc5449542a181174 (patch) | |
tree | 9fe9ab8f185ff573ad825c837a4c05698c060217 /readme.md | |
parent | 10a00ff13626f1417aa52a88c195b39af0ff656a (diff) |
docs(readme): πadded more examples
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 184 |
1 files changed, 163 insertions, 21 deletions
@@ -96,73 +96,86 @@ section = { oldfiles_amount = <amount>, } --- table with all the paddings +-- the padding before each section +-- table with integers paddings = { <padding_before_section_1>, -- for as as many sections as you have - padding_before_section_2, + <padding_before_section_2>, } --- e.g. #FF000D -color = hex_color_string +-- a hex color +-- e.g. "#FF000D" +-- string +color = <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 <CR> --- oldfiles: leave content empty +-- text: just text will be displayed + +-- mapping: commands/mapping which will be displayed +-- those can be executed with <CR> +-- 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> -- title must be set -fold = true/false +-- string +fold_section = true/false -- title of folded section --- e.g. "Oldfiles" -title = title_string +-- string +title = <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 = <margin> -- when type = "olfiles" -> leave empty -- when type = "mapping" -> table with the format { [<displayed_command_name>] = {<command>, <mapping>} } -e.g. -{ - ["ο
Find File"] = { "Telescope find_files", "<leader>ff" }, - ["ο‘ Find Word"] = { "Telescope live_grep", "<leader>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 = <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 = <color>, -- vim command to be executed, when section get set -- for example to create mappings +-- string command = <command>, -- the amount of oldfiles to be displayed +-- integer oldfiles_amount = <amount>, ``` + +### Buildingblocks + ### Examples <details> <summary> @@ -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() + ... +} +``` + +</p> +</details> + +<details> +<summary> +Content for type = "mapping" +</summary> +<p> + +```lua +content = { + ["ο
Find File"] = { "Telescope find_files", "<leader>ff" }, + ["ο‘ Find Word"] = { "Telescope live_grep", "<leader>lg" }, + ["ο€ Recent Files"] = { "Telescope oldfiles", "<leader>of" }, + ["ξ File Browser"] = { "Telescope file_browser", "<leader>fb" }, + ["ξ« Colorschemes"] = { "Telescope colorscheme", "<leader>cs" }, + ["ο
New File"] = { "lua require'startup'.new_file()", "<leader>nf" }, +}, +``` + +</p> +</details> + +<details> +<summary> +A complete configuration +</summary> +<p> + +```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<CR> + nnoremap C :lua require'telescope.builtin'.find_files({cwd="~/.config"})<CR> + ]], + 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", "<leader>ff" }, + ["ο‘ Find Word"] = { "Telescope live_grep", "<leader>lg" }, + ["ο€ Recent Files"] = { "Telescope oldfiles", "<leader>of" }, + ["ξ File Browser"] = { "Telescope file_browser", "<leader>fb" }, + ["ξ« Colorschemes"] = { "Telescope colorscheme", "<leader>cs" }, + ["ο
New File"] = { "lua require'startup'.new_file()", "<leader>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 +``` + </p> </details> |