https://github.com/hrsh7th/vim-gitto
vim-gitto
https://github.com/hrsh7th/vim-gitto
Last synced: 8 months ago
JSON representation
vim-gitto
- Host: GitHub
- URL: https://github.com/hrsh7th/vim-gitto
- Owner: hrsh7th
- Created: 2019-02-12T15:02:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-22T10:21:10.000Z (almost 5 years ago)
- Last Synced: 2025-01-03T08:13:54.488Z (9 months ago)
- Language: Vim script
- Homepage:
- Size: 55.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vim-gitto
git client in vim.## API
### gitto#run(feature, [...args]) -> results
You can call feature like this.```
call gitto#run('status#get')
call gitto#run('status#reset', '/path/to/file')
```### gitto#run_in_dir(dir, feature, [...args]) -> results
You can call feature like this.```
call gitto#run_in_dir(dir, 'status#get')
call gitto#run_in_dir(dir, 'status#reset', '/path/to/file')
```### gitto#view#commit(paths)
### gitto#view#commit_in_dir(dir, paths)
You can open commit view in other tabpage.```
call gitto#view#commit(['/path/to/commit1', '/path/to/commit2'])
```### gitto#view#diff_file_with_hash(path, info)
### gitto#view#diff_file_with_hash_in_dir(dir, path, info)
You can open vimdiff view in other tabpage.> `info` is `{ hash: string; path: string }`
```
call gitto#view#diff_file_with_hash('/path/to/diff', { 'hash': 'HEAD', 'path': '/path/to/diff' })
```### gitto#view#diff_hash_with_hash(info1, info2)
### gitto#view#diff_hash_with_hash_in_dir(dir, info1, info2)
You can open vimdiff view in other tabpage.> `info` is `{ hash: string; path: string }`
```
call gitto#view#diff_hash_with_hash({ 'hash': 'HEAD', 'path': '/path/to/diff' }, { 'hash': 'HEAD^', 'path': '/path/to/diff' })
```## Feature
### status#get() -> { status, path, raw }[]
`git status`### status#reset(paths) -> void
`git reset -- path`### status#checkout(paths) -> void
`git checkout -- path`### status#add(paths) -> void
`git add -- path`### status#rm(paths) -> void
`git rm -- path`... and more.
You can find other feature in `autoload/gitto/git/*.vim`.
# FAQ
Q.
> I want to use this on `special plugin's buffer`. But it's not work.A.
> You can override implementaion for detect git repo like this.
```
let g:gitto#config = {}
function! g:gitto#config.get_buffer_path()
if exists('b:defx')
return b:defx.paths[0]
endif
return expand('%:p')
endfunction
```
# TODO
- implements more feature.
- error handling?