Skip to content

Commit 16b8029

Browse files
committed
docs: closes #60, consolidate and complete documentation in the help file
1 parent f7a20fa commit 16b8029

File tree

10 files changed

+825
-620
lines changed

10 files changed

+825
-620
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ optional scope for this project would usually be the source, i.e.
3232

3333
## Branching
3434

35-
The default branch is et to the current major version to make it simple for end
35+
The default branch is set to the current major version to make it simple for end
3636
users visiting the repo. Pull Requests, however, should go to the `main`
3737
branch. After a short testing period, it will be merged to the current release
3838
branch.
@@ -41,3 +41,18 @@ This project requires a **linear history**. I don't trust merge commits.
4141
This means you will have to rebase your branch on main before the pull request
4242
can be merged. This can get a bit annoying in a busy repository, but I think it
4343
is worth the effort.
44+
45+
## Documentation
46+
47+
All new features should be documented in the commit they were added in. The
48+
current strategy is to maintain:
49+
50+
- Config Options: added to [defaults](lua/neo-tree/defaults.lua) and described
51+
in comments
52+
- The README contains "back of the box" high level overview of features. It is
53+
meant for people trying to decide if they want to install this plugin or not.
54+
It should include refrences to the help file for more information:
55+
`:h neo-tree-setup`
56+
- The vim help file [doc/neo-tree.txt](doc/neo-tree.txt) is the definitive
57+
reference and should contain all information needed to configure and use the
58+
plugin.

README.md

Lines changed: 40 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -43,103 +43,31 @@ use {
4343
requires = {
4444
"nvim-lua/plenary.nvim",
4545
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
46-
"MunifTanjim/nui.nvim"
46+
"MunifTanjim/nui.nvim"
4747
},
4848
config = function ()
49-
require("neo-tree").setup({
50-
popup_border_style = "rounded",
51-
enable_git_status = true,
52-
enable_diagnostics = true,
53-
filesystem = {
54-
filters = { --These filters are applied to both browsing and searching
55-
show_hidden = false,
56-
respect_gitignore = true,
57-
},
58-
follow_current_file = false, -- This will find and focus the file in the
59-
-- active buffer every time the current file is changed while the tree is open.
60-
use_libuv_file_watcher = false, -- This will use the OS level file watchers
61-
-- to detect changes instead of relying on nvim autocmd events.
62-
window = {
63-
position = "left",
64-
width = 40,
65-
mappings = {
66-
["<2-LeftMouse>"] = "open",
67-
["<cr>"] = "open",
68-
["S"] = "open_split",
69-
["s"] = "open_vsplit",
70-
["C"] = "close_node",
71-
["<bs>"] = "navigate_up",
72-
["."] = "set_root",
73-
["H"] = "toggle_hidden",
74-
["I"] = "toggle_gitignore",
75-
["R"] = "refresh",
76-
["/"] = "filter_as_you_type",
77-
--["/"] = "none" -- Assigning a key to "none" will remove the default mapping
78-
["f"] = "filter_on_submit",
79-
["<c-x>"] = "clear_filter",
80-
["a"] = "add",
81-
["d"] = "delete",
82-
["r"] = "rename",
83-
["c"] = "copy_to_clipboard",
84-
["x"] = "cut_to_clipboard",
85-
["p"] = "paste_from_clipboard",
86-
["bd"] = "buffer_delete",
87-
}
88-
}
89-
},
90-
buffers = {
91-
show_unloaded = true,
92-
window = {
93-
position = "left",
94-
mappings = {
95-
["<2-LeftMouse>"] = "open",
96-
["<cr>"] = "open",
97-
["S"] = "open_split",
98-
["s"] = "open_vsplit",
99-
["<bs>"] = "navigate_up",
100-
["."] = "set_root",
101-
["R"] = "refresh",
102-
["a"] = "add",
103-
["d"] = "delete",
104-
["r"] = "rename",
105-
["c"] = "copy_to_clipboard",
106-
["x"] = "cut_to_clipboard",
107-
["p"] = "paste_from_clipboard",
108-
}
109-
},
110-
},
111-
git_status = {
112-
window = {
113-
position = "float",
114-
mappings = {
115-
["<2-LeftMouse>"] = "open",
116-
["<cr>"] = "open",
117-
["S"] = "open_split",
118-
["s"] = "open_vsplit",
119-
["C"] = "close_node",
120-
["R"] = "refresh",
121-
["d"] = "delete",
122-
["r"] = "rename",
123-
["c"] = "copy_to_clipboard",
124-
["x"] = "cut_to_clipboard",
125-
["p"] = "paste_from_clipboard",
126-
["A"] = "git_add_all",
127-
["gu"] = "git_unstage_file",
128-
["ga"] = "git_add_file",
129-
["gr"] = "git_revert_file",
130-
["gc"] = "git_commit",
131-
["gp"] = "git_push",
132-
["gg"] = "git_commit_and_push",
133-
}
134-
}
135-
}
136-
})
49+
require("neo-tree").setup() -- This is optional if you are not going to
50+
-- change any of the defaults.
13751
vim.cmd([[nnoremap \ :NeoTreeReveal<cr>]])
13852
end
13953
}
14054
```
141-
_The above configuration is not everything that can be changed, it's just the
142-
parts you might want to change first._
55+
56+
See `:h neo-tree` for full documentation. You can also preview that online at
57+
[doc/neo-tree.txt](doc/neo-tree.txt), although it's best viewed within vim.
58+
59+
60+
### Config Options
61+
62+
To see all of the default config options with commentary, you can view it online
63+
at [lua/neo-tree/defaults.lua](lua/neo-tree/defaults.lua). You can also paste it
64+
into your config after installing Neo-tree by running `:NeoTreePasteConfig`,
65+
which will paste the default config as a `config` table into the current buffer.
66+
You can then change what you want in the pasted `config` table and pass it to
67+
`require("neo-tree").setup(config)`
68+
69+
70+
### Commands
14371

14472
Here are the various ways to open the tree:
14573

@@ -181,6 +109,7 @@ at [neo-tree.txt](/doc/neo-tree.txt)
181109
An example configuration for the filesystem source with proper syntax
182110
highlighting can also be viewed at the [filesystem README](/lua/neo-tree/sources/filesystem/README.md)
183111

112+
184113
## Sources
185114

186115
Neo-tree is built on the idea of supporting various sources. Sources are
@@ -192,6 +121,13 @@ those items.
192121
The default source is `filesystem`, which displays your files and folders. This
193122
is the default source in commands when none is specified.
194123

124+
This source can be used to:
125+
- Browse the filesystem
126+
- Control the current working directory of nvim
127+
- Add/Copy/Delete/Move/Rename files and directories
128+
- Search the filesystem
129+
- Monitor git status and lsp diagnostics for the current working directory
130+
195131
### buffers
196132
![Neo-tree buffers](https://github.com/nvim-neo-tree/resources/raw/main/images/Neo-tree-buffers.png)
197133

@@ -220,18 +156,24 @@ built-in functions can be replaced with your own implementation, or you can
220156
add new ones.
221157

222158
Each node in the tree is created from the renderer specified for the given node
223-
type, and each renderer is a list of component configs to be rendered in order
224-
for each node in the tree. Each component is a function, either built-in or
225-
specified in your config. Those functions are called with the config, node, and
226-
state of the plugin, and return the text and highlight group for the component.
159+
type, and each renderer is a list of component configs to be rendered in order.
160+
Each component is a function, either built-in or specified in your config. Those
161+
functions simply return the text and highlight group for the component.
227162

228163
Additionally, there is an events system that you can hook into. If you want to
229164
show some new data point related to your files, gather it in the
230165
`before_render` event, create a component to display it, and reference that
231166
component in the renderer for the `file` and/or `directory` type.
232167

233-
Details on how to configure everything is in the help file at `:h neo-tree` or
234-
online at [neo-tree.txt](https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt)
168+
Details on how to configure everything is in the help file at `:h
169+
neo-tree-configuration` or online at
170+
[neo-tree.txt](https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt)
171+
172+
Recipes for customizations can be found on the [wiki](wiki). Recipes include
173+
things like adding a component to show the
174+
[Harpoon](https://github.com/ThePrimeagen/harpoon) index for files, or
175+
responding to the `"file_opened"` event to auto clear the search when you open a
176+
file.
235177

236178

237179
## Why?
@@ -276,7 +218,7 @@ major version, and the breaking change will happen in the next major version.
276218

277219
### Easy to Customize
278220

279-
This will follow in the spirit of plugins like
221+
Neo-tree follows in the spirit of plugins like
280222
[lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) and
281223
[nvim-cokeline](https://github.com/noib3/nvim-cokeline). Everything will be
282224
configurable and take either strings, tables, or functions. You can take sane

0 commit comments

Comments
 (0)