5. Table of Contents
1. Using Git from Vim (w/o any plugins)
2. Plugins for Git
3. Advanced usage
6. Table of Contents
1. Using Git from Vim (w/o any plugins)
2. Plugins for Git
3. Advanced usage
7. Using Git from Vim w/o any plugins
● At first, use Git from default Vim!
● Why?
○ learn about natural Vim power.
○ too many plug-ins is too complex.
○ forbidden to access github.com.
(It’ me)
8. Getting ready to use
$ git config --global core.editor vim
# or
$ git config --global core.editor gvim -f
9. Using Git from command-line mode
● Just use :!
:!git add %
:!git commit -m”commit message”
:!git checkout HEAD %
● Define key mapping (if you need)
“ e.g.
nnoremap ga :<C-u>!git add %<CR>
21. Table of Contents
1. Using Git from Vim (w/o any plugins)
2. Plugins for Git
3. Advanced usage
22. Advanced usage of gitv and fugitive
● Remember the gitv window.
SHA-1 hash!
● Get the hash of the current line.
matchstr(getline('.'), '[zsx+ze]$')
23. Advanced usage of gitv and fugitive
● Use :Git with the hash.
:Git rebase <hash>
:Git reset --hard <hash>
:Git checkout -b hoge <hash>
…more
● Define key mappings