Sun, 12 Mar 2023 03:03:49 -0500
continue to confuse the verymagic options
1074 | 1 | local api = vim.api |
2 | local fn = vim.fn | |
3 | ||
4 | local function tig(ctx) | |
5 | local cmd = ctx.fargs | |
6 | local orig_number = vim.wo.number | |
7 | ||
8 | local buf = api.nvim_create_buf(false, true) | |
9 | vim.bo[buf].bufhidden = "delete" | |
10 | ||
11 | api.nvim_set_current_buf(buf) | |
12 | vim.wo.number = false | |
13 | ||
14 | table.insert(cmd, 1, "tig") | |
15 | fn.termopen(cmd, { | |
16 | on_exit = function() | |
17 | vim.wo.number = orig_number | |
18 | vim.cmd.buffer("#") | |
19 | end, | |
20 | }) | |
21 | end | |
22 | ||
23 | local function setup(config) | |
24 | api.nvim_create_user_command("Tig", tig, { nargs = "*", complete = "file" }) | |
25 | ||
26 | api.nvim_create_user_command("TigBlame", function() | |
1076
15007f695dfb
clean up unused vim fns
Meredith Howard <mhoward@roomag.org>
parents:
1074
diff
changeset
|
27 | tig({ fargs = { "blame", "+" .. fn.line("."), "--", fn.expand("%") } }) |
1074 | 28 | end, {}) |
29 | ||
30 | api.nvim_create_user_command("TigLog", function() | |
1076
15007f695dfb
clean up unused vim fns
Meredith Howard <mhoward@roomag.org>
parents:
1074
diff
changeset
|
31 | tig({ fargs = { "log", "-p", "--", fn.expand("%") } }) |
1074 | 32 | end, {}) |
33 | end | |
34 | ||
35 | return { | |
1076
15007f695dfb
clean up unused vim fns
Meredith Howard <mhoward@roomag.org>
parents:
1074
diff
changeset
|
36 | setup = setup, |
1074 | 37 | } |