Skip to content

Commit 70e56b2

Browse files
authored
Merge pull request #126 from sudoAlphaX/lazy-nvim-config
add installation steps for lazy.nvim
2 parents 9b02a62 + 787377a commit 70e56b2

File tree

1 file changed

+115
-67
lines changed

1 file changed

+115
-67
lines changed

README.md

Lines changed: 115 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,28 @@ Hold on, `neoclip` optionally also supports persistent history between sessions
3232
![neoclip](https://user-images.githubusercontent.com/23341710/140090515-83a08f0f-85f9-4278-bcbe-48e4d8442ace.png)
3333

3434
## Installation
35+
36+
<details>
37+
<summary>Using <a href="https://github.com/folke/lazy.nvim">Lazy.nvim</a></summary>
38+
39+
```lua
40+
require {
41+
"AckslD/nvim-neoclip.lua",
42+
dependencies = {
43+
-- you'll need at least one of these
44+
-- {'nvim-telescope/telescope.nvim'},
45+
-- {'ibhagwan/fzf-lua'},
46+
},
47+
config = function()
48+
require('neoclip').setup()
49+
end,
50+
}
51+
```
52+
</details>
53+
54+
<details>
55+
<summary>Using <a href="https://github.com/wbthomason/packer.nvim">Packer</a></summary>
56+
3557
```lua
3658
use {
3759
"AckslD/nvim-neoclip.lua",
@@ -45,13 +67,21 @@ use {
4567
end,
4668
}
4769
```
70+
</details>
71+
72+
<br>
73+
4874
When `require('neoclip').setup()` is called, only the autocommand (for `TextYankPost` event) is setup to save yanked things. This means that `telescope` is not required at this point if you lazy load it. Depending on your setup you might need to load the telescope extension before using it though, see the [troubleshooting](#troubleshooting)-section below.
4975

5076
If you want to use persistent history between sessions you also need [`sqlite.lua`](https://github.com/kkharji/sqlite.lua) installed, for example by:
77+
78+
<details>
79+
<summary>Using <a href="https://github.com/folke/lazy.nvim">Lazy.nvim</a></summary>
80+
5181
```lua
52-
use {
82+
require {
5383
"AckslD/nvim-neoclip.lua",
54-
requires = {
84+
dependencies = {
5585
{'kkharji/sqlite.lua', module = 'sqlite'},
5686
-- you'll need at least one of these
5787
-- {'nvim-telescope/telescope.nvim'},
@@ -63,77 +93,95 @@ use {
6393
}
6494
```
6595

66-
## Configuration
67-
You can configure `neoclip` by passing a table to `setup` (all are optional).
68-
The following are the defaults and the keys are explained below:
96+
</details>
97+
98+
<details>
99+
<summary>Using <a href="https://github.com/wbthomason/packer.nvim">Packer</a></summary>
100+
69101
```lua
70102
use {
71103
"AckslD/nvim-neoclip.lua",
104+
requires = {
105+
{'kkharji/sqlite.lua', module = 'sqlite'},
106+
-- you'll need at least one of these
107+
-- {'nvim-telescope/telescope.nvim'},
108+
-- {'ibhagwan/fzf-lua'},
109+
},
72110
config = function()
73-
require('neoclip').setup({
74-
history = 1000,
75-
enable_persistent_history = false,
76-
length_limit = 1048576,
77-
continuous_sync = false,
78-
db_path = vim.fn.stdpath("data") .. "/databases/neoclip.sqlite3",
79-
filter = nil,
80-
preview = true,
81-
prompt = nil,
82-
default_register = '"',
83-
default_register_macros = 'q',
84-
enable_macro_history = true,
85-
content_spec_column = false,
86-
disable_keycodes_parsing = false,
87-
on_select = {
88-
move_to_front = false,
89-
close_telescope = true,
90-
},
91-
on_paste = {
92-
set_reg = false,
93-
move_to_front = false,
94-
close_telescope = true,
95-
},
96-
on_replay = {
97-
set_reg = false,
98-
move_to_front = false,
99-
close_telescope = true,
100-
},
101-
on_custom_action = {
102-
close_telescope = true,
103-
},
104-
keys = {
105-
telescope = {
106-
i = {
107-
select = '<cr>',
108-
paste = '<c-p>',
109-
paste_behind = '<c-k>',
110-
replay = '<c-q>', -- replay a macro
111-
delete = '<c-d>', -- delete an entry
112-
edit = '<c-e>', -- edit an entry
113-
custom = {},
114-
},
115-
n = {
116-
select = '<cr>',
117-
paste = 'p',
118-
--- It is possible to map to more than one key.
119-
-- paste = { 'p', '<c-p>' },
120-
paste_behind = 'P',
121-
replay = 'q',
122-
delete = 'd',
123-
edit = 'e',
124-
custom = {},
125-
},
126-
},
127-
fzf = {
128-
select = 'default',
129-
paste = 'ctrl-p',
130-
paste_behind = 'ctrl-k',
131-
custom = {},
132-
},
133-
},
134-
})
111+
require('neoclip').setup()
135112
end,
136113
}
114+
```
115+
116+
</details>
117+
118+
## Configuration
119+
You can configure `neoclip` by passing a table to `setup` (all are optional).
120+
The following are the defaults and the keys are explained below:
121+
```lua
122+
require('neoclip').setup({
123+
history = 1000,
124+
enable_persistent_history = false,
125+
length_limit = 1048576,
126+
continuous_sync = false,
127+
db_path = vim.fn.stdpath("data") .. "/databases/neoclip.sqlite3",
128+
filter = nil,
129+
preview = true,
130+
prompt = nil,
131+
default_register = '"',
132+
default_register_macros = 'q',
133+
enable_macro_history = true,
134+
content_spec_column = false,
135+
disable_keycodes_parsing = false,
136+
on_select = {
137+
move_to_front = false,
138+
close_telescope = true,
139+
},
140+
on_paste = {
141+
set_reg = false,
142+
move_to_front = false,
143+
close_telescope = true,
144+
},
145+
on_replay = {
146+
set_reg = false,
147+
move_to_front = false,
148+
close_telescope = true,
149+
},
150+
on_custom_action = {
151+
close_telescope = true,
152+
},
153+
keys = {
154+
telescope = {
155+
i = {
156+
select = '<cr>',
157+
paste = '<c-p>',
158+
paste_behind = '<c-k>',
159+
replay = '<c-q>', -- replay a macro
160+
delete = '<c-d>', -- delete an entry
161+
edit = '<c-e>', -- edit an entry
162+
custom = {},
163+
},
164+
n = {
165+
select = '<cr>',
166+
paste = 'p',
167+
--- It is possible to map to more than one key.
168+
-- paste = { 'p', '<c-p>' },
169+
paste_behind = 'P',
170+
replay = 'q',
171+
delete = 'd',
172+
edit = 'e',
173+
custom = {},
174+
},
175+
},
176+
fzf = {
177+
select = 'default',
178+
paste = 'ctrl-p',
179+
paste_behind = 'ctrl-k',
180+
custom = {},
181+
},
182+
},
183+
})
184+
137185
```
138186
* `history`: The max number of entries to store (default 1000).
139187
* `enable_persistent_history`: If set to `true` the history is stored on `VimLeavePre` using [`sqlite.lua`](https://github.com/kkharji/sqlite.lua) and lazy loaded when querying.

0 commit comments

Comments
 (0)