Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iberianpig/tig-explorer.vim

Vim plugin to use Tig as a git client. Seamless switching between vim and Tig with opening in the same buffer.
https://github.com/iberianpig/tig-explorer.vim

git tig vim vim-plugins

Last synced: about 2 months ago
JSON representation

Vim plugin to use Tig as a git client. Seamless switching between vim and Tig with opening in the same buffer.

Awesome Lists containing this project

README

        

# tig-explorer.vim

Vim plugin to use [Tig](https://github.com/jonas/tig) as a git client.
* Seamless switching between Vim and Tig
* Adding buffer in the same process, not a child of Tig process.
* Open files in tabs or vertically / horizontal split windows on Vim from Tig
* Dynamically defining keymaps on Tig
* Support Vim8 / NeoVim terminal
* Open diff-mode side by side at the selected commit from Tig

[![https://gyazo.com/181fef546cced7ca6dc651dff59cd1bf](https://i.gyazo.com/181fef546cced7ca6dc651dff59cd1bf.gif)](https://gyazo.com/181fef546cced7ca6dc651dff59cd1bf)

## Requirement

* tig(https://github.com/jonas/tig)

## Installation

```vim
" vim-plug
Plug 'iberianpig/tig-explorer.vim'

" NeoBundle
NeoBundle 'iberianpig/tig-explorer.vim'
```

**NOTE: If you use Neovim, you have to add the dependency to the plugin bclose.vim:**

```vim
" vim-plug
Plug 'rbgrouleff/bclose.vim'

" NeoBundle
NeoBundle 'rbgrouleff/bclose.vim'
```

## Usage

### Keymap on Tig

Following commands are available on Tig launched from tig-explorer.
```
e, : edit on existing tab
: edit on new tab
: edit with vsplit window
: edit with split window

o: open with commit on existing tab
t: open with commit on new tab
v: open with commit with vsplit window
s: open with commit with split window
```

Keymaps are available in the main, blame, tree, and refs views.
When opened with the commit, it opens in read-only mode.
When opening with commit with split or vsplit, it will open with diffsplit.

#### Customize Keymap on Tig

tig-explorer.vim defines the following keymap by default

```vim
let g:tig_explorer_keymap_edit_e = 'e'
let g:tig_explorer_keymap_edit = ''
let g:tig_explorer_keymap_tabedit = ''
let g:tig_explorer_keymap_split = ''
let g:tig_explorer_keymap_vsplit = ''

let g:tig_explorer_keymap_commit_edit = 'o'
let g:tig_explorer_keymap_commit_tabedit = 't'
let g:tig_explorer_keymap_commit_split = 's'
let g:tig_explorer_keymap_commit_vsplit = 'v'
```

### Keymap on Vim

Add following script to ~/.vimrc

```vim
" open tig with current file
nnoremap T :TigOpenCurrentFile

" open tig with Project root path
nnoremap t :TigOpenProjectRootDir

" open tig grep
nnoremap g :TigGrep

" resume from last grep
nnoremap r :TigGrepResume

" open tig grep with the selected word
vnoremap g y:TigGrep"

" open tig grep with the word under the cursor
nnoremap cg ::TigGrep

" open tig blame with current file
nnoremap b :TigBlame
```

### Other options

By default, tig-explorer will use the built-in terminal if available.
To force launching tig-explorer as a shell command, you can add the following to
~/.vimrc

```vim
" don't use builtin terminal
let g:tig_explorer_use_builtin_term=0
```

On Gvim, it is available only built-in terminal.

## Support

[![Patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/iberianpig)