From f5d970d4506f385b29534252d8c15a782fa53034 Mon Sep 17 00:00:00 2001 From: Sander Date: Mon, 5 Jun 2023 01:10:57 +0200 Subject: [PATCH] docs: reformat quickstart readme example (#2258) --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index b2a74694..e4e0ef35 100644 --- a/README.md +++ b/README.md @@ -79,27 +79,27 @@ require("nvim-tree").setup({ Optionally customise your mappings, see [:help nvim-tree-mappings](doc/nvim-tree-lua.txt) ```lua - local function my_on_attach(bufnr) - local api = require "nvim-tree.api" +local function my_on_attach(bufnr) + local api = require "nvim-tree.api" - local function opts(desc) - return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - end - - -- default mappings - api.config.mappings.default_on_attach(bufnr) - - -- custom mappings - vim.keymap.set('n', '', api.tree.change_root_to_parent, opts('Up')) - vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } end - -- pass to setup along with your other options - require("nvim-tree").setup { - --- - on_attach = my_on_attach, - --- - } + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '', api.tree.change_root_to_parent, opts('Up')) + vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) +end + +-- pass to setup along with your other options +require("nvim-tree").setup { + --- + on_attach = my_on_attach, + --- +} ``` Open the tree: `:NvimTreeOpen`