Skip to content

Commit 17b74ba

Browse files
committed
feat: add support for lazy plugin manager
1 parent cd94484 commit 17b74ba

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ add more mappings by providing keys to the config.
88

99
1. [Requirements](#requirements)
1010
2. [Installation](#installation)
11+
- [Lazy](#lazy)
12+
- [Packer](#packer)
1113
3. [Mappings](#mappings)
1214
- [Empty Lines](#empty-lines)
1315
- [End of Lines](#end-of-lines)
@@ -34,7 +36,21 @@ as dependencies in your package manager:
3436

3537
## Installation
3638

37-
Use your favourite package manager to install this library. Packer example:
39+
Use your favourite package manager to install this library.
40+
41+
### Lazy
42+
43+
```lua
44+
{
45+
"arsham/archer.nvim",
46+
dependencies = { "arsham/arshlib.nvim" },
47+
config = true,
48+
-- or to provide configuration
49+
-- config = { mapping = false, ..}
50+
}
51+
```
52+
53+
### Packer
3854

3955
```lua
4056
use({

lua/archer/init.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,27 @@ local defaults = { --{{{1
4949
},
5050
} --}}}
5151

52-
local function config(opts) --{{{
53-
opts = vim.tbl_deep_extend("force", defaults, opts)
52+
local function setup(opts) --{{{
53+
opts = vim.tbl_deep_extend("force", defaults, opts or {})
5454
-- Validations {{{
5555
vim.validate({
56-
opts = { opts, { "table", "boolean", "nil" }, false },
56+
opts = { opts, { "table", "boolean" }, false },
5757
mappings = { opts.mappings, { "table", "boolean", "nil" }, false },
5858
textobj = { opts.textobj, { "table", "boolean", "nil" }, false },
5959
})
6060
-- }}}
6161

6262
if opts.mappings then
63-
require("archer.mappings").config(opts.mappings)
63+
require("archer.mappings").setup(opts.mappings)
6464
end
6565
if opts.textobj then
66-
require("archer.textobj").config(opts.textobj)
66+
require("archer.textobj").setup(opts.textobj)
6767
end
6868
end --}}}
6969

7070
return {
71-
config = config,
71+
setup = setup,
72+
config = setup,
7273
}
7374

7475
-- vim: fdm=marker fdl=1

lua/archer/mappings.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ local last_key = ""
4646
function _G.add_to_line_end()
4747
change_line_ends(last_key, false)
4848
end
49+
-- selene: allow(global_usage)
4950
function _G.remove_from_line_end()
5051
change_line_ends(last_key, true)
5152
end
@@ -70,6 +71,7 @@ end --}}}
7071
function _G.empty_line_below()
7172
insert_empty_lines(vim.v.count, 0)
7273
end
74+
-- selene: allow(global_usage)
7375
function _G.empty_line_above()
7476
insert_empty_lines(vim.v.count, -1)
7577
end
@@ -170,9 +172,8 @@ local function augment_vim(opts)
170172
end
171173
end
172174

173-
174-
-- stylua: ignore start
175175
local function config(opts) --{{{
176+
-- stylua: ignore
176177
vim.validate({
177178
space = { opts.space, { "table", "boolean", "nil" }, true },
178179
ending = { opts.ending, { "table", "boolean", "nil" }, true },
@@ -195,11 +196,10 @@ local function config(opts) --{{{
195196
if opts.augment_vim then --{{{
196197
augment_vim(opts.augment_vim)
197198
end --}}}
198-
199199
end --}}}
200-
-- stylua: ignore end
201200

202201
return {
202+
setup = config,
203203
config = config,
204204
}
205205

lua/archer/textobj.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ local function visual_number(around)
4747
end ---}}}
4848

4949
-- stylua: ignore start
50-
local function config(opts)
50+
local function setup(opts)
5151
vim.validate({--{{{
5252
next_obj = { opts.next_obj, { "table", "boolean", "nil" }, true },
5353
in_chars = { opts.in_chars, { "table", "boolean", "nil" }, true },
@@ -160,7 +160,8 @@ end
160160
-- stylua: ignore end
161161

162162
return {
163-
config = config,
163+
setup = setup,
164+
config = setup,
164165
}
165166

166167
-- vim: fdm=marker fdl=0

0 commit comments

Comments
 (0)