.config/nvim/plugin/tig.vim

Sun, 19 Feb 2023 11:03:32 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 19 Feb 2023 11:03:32 -0600
changeset 1025
9dfc1a5a52dc
permissions
-rw-r--r--

Fix up tig for nvim

1025
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 func! tig#Tig(...) abort
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 enew
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 setl nonumber
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 call termopen(["tig"] + a:000, {'on_exit': 'tig#TigExit'})
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 endfunc
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 func! tig#TigBlame() abort
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 call tig#Tig('blame', '+' . line('.'), '--', expand('%'))
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 endfunc
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 func! tig#TigExit(...) abort
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 buffer #
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 endfunc
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 command! -nargs=* -complete=file Tig call tig#Tig(<f-args>)
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 command! TigBlame call tig#TigBlame()
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 command! TigLog call tig#Tig('log', '-p', '--', expand('%'))
9dfc1a5a52dc Fix up tig for nvim
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18

mercurial