.vim/autoload/tig.vim

Tue, 06 Jul 2021 13:34:06 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Tue, 06 Jul 2021 13:34:06 -0500
changeset 920
c1cc35d18597
parent 828
81ede7493890
permissions
-rw-r--r--

Add PruneSession

828
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 " Why this wrapper? vim :term sets $TERM to xterm but supports -256color and
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 " all the suggestions for fixing that involve changing $TERM for vim itself
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 " rather than just the subprocess. Also since this runs in place we can
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 " switch back after.
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 func! tig#Tig(...) abort
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 call term_start(
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 \ ['/usr/bin/env', 'TERM=xterm-256color', 'tig'] + a:000,
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 \ {'curwin': 1, 'term_name': join(['!tig'] + a:000, ' '), 'exit_cb': 'tig#TigExit'}
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 \ )
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 endfunc
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 func! tig#TigBlame() abort
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 call tig#Tig('blame', '+' . line('.'), '--', expand('%'))
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 endfunc
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 func! tig#TigExit(...) abort
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 buffer #
81ede7493890 improve tig
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 endfunc

mercurial