1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 01:50:05 +08:00

docs(git): add :h git-functions and :h git-branch

This commit is contained in:
wsdjeg 2022-11-20 12:04:36 +08:00
parent e40635a035
commit e8f52d50c5
2 changed files with 36 additions and 7 deletions

View File

@ -6,6 +6,14 @@
" License: GPLv3 " License: GPLv3
"============================================================================= "=============================================================================
""
" @section git-branch, branch
" @parentsection commands
" This commands is to open branch manager.
" >
" :Git branch
" <
let s:JOB = SpaceVim#api#import('job') let s:JOB = SpaceVim#api#import('job')
let s:STR = SpaceVim#api#import('data#string') let s:STR = SpaceVim#api#import('data#string')
@ -102,7 +110,8 @@ function! s:on_exit_show_branch(id, data, event) abort
\ }) \ })
endif endif
endfunction endfunction
""
" return the current branch info. this function can be used in statusline.
function! git#branch#current(...) abort function! git#branch#current(...) abort
let pwd = getcwd() let pwd = getcwd()
let branch = get(s:branch_info, pwd, {}) let branch = get(s:branch_info, pwd, {})
@ -117,7 +126,8 @@ function! git#branch#current(...) abort
return '' return ''
endif endif
endfunction endfunction
""
" update the branch info manually.
function! git#branch#detect() abort function! git#branch#detect() abort
call s:update_branch_name(getcwd(), 1) call s:update_branch_name(getcwd(), 1)
endfunction endfunction

View File

@ -6,11 +6,13 @@ CONTENTS *git-contents*
1. Introduction..................................................|git-intro| 1. Introduction..................................................|git-intro|
2. Commands...................................................|git-commands| 2. Commands...................................................|git-commands|
1. git-add.....................................................|git-add| 1. git-add.....................................................|git-add|
2. git-cherry-pick.....................................|git-cherry-pick| 2. git-branch...............................................|git-branch|
3. git-clean.................................................|git-clean| 3. git-cherry-pick.....................................|git-cherry-pick|
4. git-mv.......................................................|git-mv| 4. git-clean.................................................|git-clean|
5. git-rm.......................................................|git-rm| 5. git-mv.......................................................|git-mv|
6. git-stash.................................................|git-stash| 6. git-rm.......................................................|git-rm|
7. git-stash.................................................|git-stash|
3. Functions.................................................|git-functions|
============================================================================== ==============================================================================
INTRODUCTION *git-intro* INTRODUCTION *git-intro*
@ -33,6 +35,14 @@ file to the index.
:Git add % :Git add %
< <
==============================================================================
GIT-BRANCH *git-branch*
This commands is to open branch manager.
>
:Git branch
<
============================================================================== ==============================================================================
GIT-CHERRY-PICK *git-cherry-pick* GIT-CHERRY-PICK *git-cherry-pick*
@ -75,5 +85,14 @@ This commands is to manage git stash.
:Git stash list :Git stash list
< <
==============================================================================
FUNCTIONS *git-functions*
git#branch#current() *git#branch#current()*
return the current branch info. this function can be used in statusline.
git#branch#detect() *git#branch#detect()*
update the branch info manually.
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl: