-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
31 lines (28 loc) · 904 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
return {
setup = function(args)
args = args or {}
local copy = args.copy or {}
local destination_register = copy.destination_register or "+"
vim.api.nvim_create_user_command("Fileline", function()
local fileline = require("fileline.to_fileline")
vim.fn.setreg(destination_register, fileline())
end, {})
vim.api.nvim_create_user_command("GHPerma", function(t)
local github_perma = require("fileline.github_perma")
local link = github_perma(t.line1, t.line2)
vim.fn.setreg(destination_register, link)
end, { range = true })
local open_fileline = require("fileline.open_fileline")
local grp = vim.api.nvim_create_augroup("fileline", {})
vim.api.nvim_create_autocmd("BufNewFile", {
pattern = "*",
group = grp,
callback = open_fileline,
})
vim.api.nvim_create_autocmd("BufRead", {
pattern = "*",
group = grp,
callback = open_fileline,
})
end,
}