docs: lighten up readme and rework docs (#1327)

* docs: lighten up readme and rework docs

* docs: clean up mappings from readme + some other small changes

* docs: move sections around

* ci: remove readme parts of docs' autogen

* docs: discuss nvim-web-devicons and provide an example

* docs: add an example setup

* docs: fix opts scraping; try and make more macos compatible

* docs: add *nvim-tree* tag at start of help

* docs: add an example setup

* docs: update quick start to match readme

* docs: add basic commands

* docs: add g? hint

* docs: add :help links to readme

* docs: restore help wanted

* docs: add example screenshot

* docs: add features

* docs: add example screenshot

* docs: add features to help

* docs: clarify option functions

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
gegoune
2022-06-18 06:14:42 +02:00
committed by GitHub
parent bdb6d4a254
commit aba394896b
5 changed files with 230 additions and 476 deletions

View File

@@ -82,23 +82,3 @@ for _, m in pairs(outs_lua) do
io.write(string.format(fmt, m.key, m.action))
end
io.close(file)
-- md
file = io.open("/tmp/DEFAULT_MAPPINGS.md", "w")
io.output(file)
io.write "| Default Keys | Action | Description |\n"
io.write "| - | - | - |\n"
for _, m in pairs(M.mappings) do
local keys = ""
if type(m.key) == "table" then
local first = true
for _, sub_key in pairs(m.key) do
keys = keys .. (first and "" or " <br /> ") .. sub_key:gsub("<", "\\<")
first = false
end
else
keys = m.key:gsub("<", "\\<")
end
io.write(string.format("| %s | %s | %s |\n", keys, m.action, m.desc:gsub("|", "`")))
end
io.close(file)

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# run after changing nvim-tree.lua DEFAULT_OPTS or nvim-tree/actions/init.lua M.mappings
# scrapes and updates README.md, nvim-tree-lua.txt
# scrapes and updates nvim-tree-lua.txt
# run from repositry root: scripts/update-default-opts.sh
@@ -14,13 +14,9 @@ sed -n -e "/${begin}/,/${end}/{ /${begin}/d; /${end}/d; p; }" lua/nvim-tree.lua
# indent some more
sed -e "s/^ / /" /tmp/DEFAULT_OPTS.2.lua > /tmp/DEFAULT_OPTS.6.lua
# README.md indented at 2
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_OPTS.2.lua
}; /${end}/p; d }" README.md
# help, indented at 6
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_OPTS.6.lua
}; /${end}/p; d }" doc/nvim-tree-lua.txt
}; /${end}/p; d; }" doc/nvim-tree-lua.txt
begin="BEGIN_DEFAULT_MAPPINGS"
@@ -28,17 +24,10 @@ end="END_DEFAULT_MAPPINGS"
# generate various DEFAULT_MAPPINGS
sed -n -e "/${begin}/,/${end}/{ /${begin}/d; /${end}/d; p; }" lua/nvim-tree/actions/init.lua > /tmp/DEFAULT_MAPPINGS.M.lua
lua <(cat /tmp/DEFAULT_MAPPINGS.M.lua scripts/generate_default_mappings.lua)
# README.md
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_MAPPINGS.lua
}; /${end}/p; d }" README.md
sed -i -e "/BEGIN_DEFAULT_MAPPINGS_TABLE/,/END_DEFAULT_MAPPINGS_TABLE/{ /BEGIN_DEFAULT_MAPPINGS_TABLE/{p; r /tmp/DEFAULT_MAPPINGS.md
}; /END_DEFAULT_MAPPINGS_TABLE/p; d }" README.md
cat /tmp/DEFAULT_MAPPINGS.M.lua scripts/generate_default_mappings.lua | lua
# help
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_MAPPINGS.lua
}; /${end}/p; d }" doc/nvim-tree-lua.txt
sed -i -e "/^DEFAULT MAPPINGS/,/^>$/{ /^DEFAULT MAPPINGS/{p; r /tmp/DEFAULT_MAPPINGS.help
}; /^>$/p; d }" doc/nvim-tree-lua.txt