https://github.com/zoubin/vim-git
Tricks for using git in vim
https://github.com/zoubin/vim-git
Last synced: 5 months ago
JSON representation
Tricks for using git in vim
- Host: GitHub
- URL: https://github.com/zoubin/vim-git
- Owner: zoubin
- Created: 2014-12-30T08:19:32.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-31T05:53:55.000Z (over 11 years ago)
- Last Synced: 2025-05-31T23:54:31.232Z (about 1 year ago)
- Language: VimL
- Homepage:
- Size: 168 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
vim-git
=======
Tricks for using git in vim.
## Git Blame
Mapping should be completed in vimrc, like:
```vim
noremap g :call git#BlameRange()
```
Suppose `` is `\` (the default), then,
* In normal mode: type `\g`, and you are blaming the current line
* In visual mode: type `\g`, and you are blaming the visual block
## Git Grep
Mapping should be completed in vimrc, like:
```vim
nnoremap K :call git#GrepCursorWord()
vnoremap K y:call git#GrepText(getreg('"'))
nnoremap ^F
```
Then,
* In normal mode: type `K`, and you are git greping the word under the cursor
* In visual mode: type `K`, and you are git greping the visual text
In either mode, results are shown in a split window.
Move to any line, and type `CTRL-T`, and a new split window will be opened containing the regarding file. Also, the cursor will be positioned at the regarding line.
## Usage
After installation, finish the mapping in vimrc, like:
```vim
" for git blame
noremap g :call git#BlameRange()
" In visual mode, git grep the selection text
vnoremap K y:call git#GrepText(getreg('"'))
" In normal mode, git grep the word under the cursor
nnoremap K :call git#GrepCursorWord()
" Open in a new window. :h CTRL-W_F for more information
nnoremap ^F
```