docs: clarify on_attach example, quick start (#2165)

* doc: more on_attach examples

* doc: human readable mappings help

* doc: human readable mappings help

* doc: more on_attach examples

* doc: enhance quick start

* doc: enhance quick start

* doc: enhance quick start

* doc: enhance quick start

* doc: enhance quick start

* doc: enhance quick start
This commit is contained in:
Alexander Courtis
2023-04-29 17:00:40 +10:00
committed by GitHub
parent 1f5bbc1efd
commit 74996b8626
3 changed files with 104 additions and 12 deletions

View File

@@ -31,11 +31,23 @@ end="END_DEFAULT_ON_ATTACH"
# scrape DEFAULT_ON_ATTACH, indented at 2
sed -n -e "/${begin}/,/${end}/{ /${begin}/d; /${end}/d; p; }" lua/nvim-tree/keymap.lua > /tmp/DEFAULT_ON_ATTACH.lua
# help
# help lua
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_ON_ATTACH.lua
}; /${end}/p; d; }" doc/nvim-tree-lua.txt
# legacy keymap
# legacy keymap lua
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_ON_ATTACH.lua
}; /${end}/p; d; }" lua/nvim-tree/keymap-legacy.lua
# help human
echo > /tmp/DEFAULT_ON_ATTACH.help
sed -E "s/^ *vim.keymap.set\('n', '(.*)',.*api(.*),.*opts\('(.*)'.*$/'\`\1\`' '\3' '|nvim-tree-api\2()|'/g
" /tmp/DEFAULT_ON_ATTACH.lua | while read line
do
eval "printf '%-17.17s %-23.23s %s\n' ${line}" >> /tmp/DEFAULT_ON_ATTACH.help
done
echo >> /tmp/DEFAULT_ON_ATTACH.help
begin="Show the mappings:"
end="======"
sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_ON_ATTACH.help
}; /${end}/p; d; }" doc/nvim-tree-lua.txt