Skip to content

Commit 5e258d2

Browse files
authored
Move plugin examples from README to optional plugin files (#831)
* Move autopairs example from README to an optional plugin * Move neo-tree example from README to an optional plugin
1 parent 5540527 commit 5e258d2

File tree

4 files changed

+45
-63
lines changed

4 files changed

+45
-63
lines changed

README.md

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -99,71 +99,10 @@ That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
9999
current plugin status. Hit `q` to close the window.
100100

101101
Read through the `init.lua` file in your configuration folder for more
102-
information about extending and exploring Neovim.
102+
information about extending and exploring Neovim. That includes also
103+
examples of adding popularly requested plugins.
103104

104105

105-
#### Examples of adding popularly requested plugins
106-
107-
NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins.
108-
109-
<details>
110-
<summary>Adding autopairs</summary>
111-
112-
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs)
113-
and enable it on startup. For more information, see documentation for
114-
[lazy.nvim](https://github.com/folke/lazy.nvim).
115-
116-
In the file: `lua/custom/plugins/autopairs.lua`, add:
117-
118-
```lua
119-
-- File: lua/custom/plugins/autopairs.lua
120-
121-
return {
122-
"windwp/nvim-autopairs",
123-
-- Optional dependency
124-
dependencies = { 'hrsh7th/nvim-cmp' },
125-
config = function()
126-
require("nvim-autopairs").setup {}
127-
-- If you want to automatically add `(` after selecting a function or method
128-
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
129-
local cmp = require('cmp')
130-
cmp.event:on(
131-
'confirm_done',
132-
cmp_autopairs.on_confirm_done()
133-
)
134-
end,
135-
}
136-
```
137-
138-
</details>
139-
<details>
140-
<summary>Adding a file tree plugin</summary>
141-
142-
This will install the tree plugin and add the command `:Neotree` for you.
143-
For more information, see the documentation at
144-
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
145-
146-
In the file: `lua/custom/plugins/filetree.lua`, add:
147-
148-
```lua
149-
-- File: lua/custom/plugins/filetree.lua
150-
151-
return {
152-
"nvim-neo-tree/neo-tree.nvim",
153-
version = "*",
154-
dependencies = {
155-
"nvim-lua/plenary.nvim",
156-
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
157-
"MunifTanjim/nui.nvim",
158-
},
159-
config = function ()
160-
require('neo-tree').setup {}
161-
end,
162-
}
163-
```
164-
165-
</details>
166-
167106
### Getting Started
168107

169108
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)

init.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,8 @@ require('lazy').setup({
854854
-- require 'kickstart.plugins.debug',
855855
-- require 'kickstart.plugins.indent_line',
856856
-- require 'kickstart.plugins.lint',
857+
-- require 'kickstart.plugins.autopairs',
858+
-- require 'kickstart.plugins.neo-tree',
857859

858860
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
859861
-- This is the easiest way to modularize your config.

lua/kickstart/plugins/autopairs.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- autopairs
2+
-- https://github.com/windwp/nvim-autopairs
3+
4+
return {
5+
'windwp/nvim-autopairs',
6+
event = 'InsertEnter',
7+
-- Optional dependency
8+
dependencies = { 'hrsh7th/nvim-cmp' },
9+
config = function()
10+
require('nvim-autopairs').setup {}
11+
-- If you want to automatically add `(` after selecting a function or method
12+
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
13+
local cmp = require 'cmp'
14+
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
15+
end,
16+
}

lua/kickstart/plugins/neo-tree.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- Neo-tree is a Neovim plugin to browse the file system
2+
-- https://github.com/nvim-neo-tree/neo-tree.nvim
3+
4+
return {
5+
'nvim-neo-tree/neo-tree.nvim',
6+
version = '*',
7+
dependencies = {
8+
'nvim-lua/plenary.nvim',
9+
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
10+
'MunifTanjim/nui.nvim',
11+
},
12+
cmd = 'Neotree',
13+
keys = {
14+
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
15+
},
16+
opts = {
17+
filesystem = {
18+
window = {
19+
mappings = {
20+
['\\'] = 'close_window',
21+
},
22+
},
23+
},
24+
},
25+
}

0 commit comments

Comments
 (0)