Skip to content

Git integration via Tig

Johannes Altmanninger edited this page Jul 29, 2022 · 2 revisions

Tig is an ncurses-based interface for Git

Here's how to show git blame information in Tig:

define-command tig -params .. -docstring "Run tig" %{
	terminal env "EDITOR=kak -c %val{session}" tig %arg{@}
}
define-command tig-blame-here -docstring "Run tig blame on the current line" %{
	evaluate-commands %sh{
		dir="$(git rev-parse --show-toplevel)"
		printf %s "tig -C $dir blame -C +$kak_cursor_line -- ${kak_buffile##$dir/}"
	}
}

For an alternative approach, see https://github.com/mawww/kakoune/wiki/Integrating-Other-CLI-apps#tig

Clone this wiki locally