mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:50:06 +08:00
Add Git rm
command (#4347)
This commit is contained in:
parent
e6cb9e9003
commit
697fec62ea
1
.gitignore
vendored
1
.gitignore
vendored
@ -39,3 +39,4 @@ jdt.ls-java-project/
|
|||||||
# generated by rustfmt.vim
|
# generated by rustfmt.vim
|
||||||
# https://github.com/rust-lang/rust.vim/blob/master/autoload/rustfmt.vim#L110
|
# https://github.com/rust-lang/rust.vim/blob/master/autoload/rustfmt.vim#L110
|
||||||
view/
|
view/
|
||||||
|
.vim-bookmarks
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
## Forked repos
|
## Bundle plugins
|
||||||
|
|
||||||
|
In `bundle/` directory, there are two kinds of plugins: forked plugins without changes and forked plugins which have been changed.
|
||||||
|
|
||||||
|
### Changed plugin:
|
||||||
|
|
||||||
|
- `vim-bookmarks`: based on [`MattesGroeger/vim-bookmarks@3adeae1`](https://github.com/MattesGroeger/vim-bookmarks/commit/3adeae10639edcba29ea80dafa1c58cf545cb80e)
|
||||||
|
|
||||||
|
### No changed plugins
|
||||||
|
|
||||||
- [defx.nvim](https://github.com/Shougo/defx.nvim/tree/df5e6ea6734dc002919ea41786668069fa0b497d)
|
- [defx.nvim](https://github.com/Shougo/defx.nvim/tree/df5e6ea6734dc002919ea41786668069fa0b497d)
|
||||||
- [dein.vim](https://github.com/Shougo/dein.vim/tree/772ae08cef5e712b2b31b4aaee908fc853accd94)
|
- [dein.vim](https://github.com/Shougo/dein.vim/tree/772ae08cef5e712b2b31b4aaee908fc853accd94)
|
||||||
- [neoformat](https://github.com/sbdchd/neoformat/tree/1a49552cdaddeaaa766a6f0016effe530634b39f)
|
- [neoformat](https://github.com/sbdchd/neoformat/tree/1a49552cdaddeaaa766a6f0016effe530634b39f)
|
||||||
|
|
||||||
|
|
||||||
### checkers layer
|
|
||||||
|
|
||||||
- neomake
|
|
||||||
- vim-snippets
|
|
||||||
- neco-syntax
|
|
||||||
- context_filetype.vim
|
|
||||||
- neoinclude.vim
|
|
||||||
- neosnippet-snippets
|
|
||||||
- neopairs.vim
|
|
||||||
|
@ -29,6 +29,8 @@ function! git#run(...) abort
|
|||||||
call git#config#run(a:000[1:])
|
call git#config#run(a:000[1:])
|
||||||
elseif cmd ==# 'diff'
|
elseif cmd ==# 'diff'
|
||||||
call git#diff#run(a:000[1:])
|
call git#diff#run(a:000[1:])
|
||||||
|
elseif cmd ==# 'rm'
|
||||||
|
call git#rm#run(a:000[1:])
|
||||||
elseif cmd ==# 'log'
|
elseif cmd ==# 'log'
|
||||||
call git#log#run(a:000[1:])
|
call git#log#run(a:000[1:])
|
||||||
elseif cmd ==# 'reflog'
|
elseif cmd ==# 'reflog'
|
||||||
@ -72,11 +74,13 @@ function! git#complete(ArgLead, CmdLine, CursorPos) abort
|
|||||||
return join(['add', 'push', 'status', 'commit', 'diff',
|
return join(['add', 'push', 'status', 'commit', 'diff',
|
||||||
\ 'merge', 'rebase', 'branch', 'checkout',
|
\ 'merge', 'rebase', 'branch', 'checkout',
|
||||||
\ 'fetch', 'reset', 'log', 'config', 'reflog',
|
\ 'fetch', 'reset', 'log', 'config', 'reflog',
|
||||||
\ 'blame', 'pull', 'stash', 'cherry-pick',
|
\ 'blame', 'pull', 'stash', 'cherry-pick', 'rm'
|
||||||
\ ],
|
\ ],
|
||||||
\ "\n")
|
\ "\n")
|
||||||
elseif str =~# '^Git\s\+add\s\+.*$'
|
elseif str =~# '^Git\s\+add\s\+.*$'
|
||||||
return git#add#complete(a:ArgLead, a:CmdLine, a:CursorPos)
|
return git#add#complete(a:ArgLead, a:CmdLine, a:CursorPos)
|
||||||
|
elseif str =~# '^Git\s\+rm\s\+.*$'
|
||||||
|
return git#rm#complete(a:ArgLead, a:CmdLine, a:CursorPos)
|
||||||
elseif str =~# '^Git\s\+push\s\+.*$'
|
elseif str =~# '^Git\s\+push\s\+.*$'
|
||||||
return git#push#complete(a:ArgLead, a:CmdLine, a:CursorPos)
|
return git#push#complete(a:ArgLead, a:CmdLine, a:CursorPos)
|
||||||
elseif str =~# '^Git\s\+diff\s\+.*$'
|
elseif str =~# '^Git\s\+diff\s\+.*$'
|
||||||
|
44
bundle/git.vim/autoload/git/rm.vim
Normal file
44
bundle/git.vim/autoload/git/rm.vim
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
""
|
||||||
|
" @section git-rm, rm
|
||||||
|
" @parentsection commands
|
||||||
|
" This commands is to rm file contents to the index. For example, rm current
|
||||||
|
" file to the index.
|
||||||
|
" >
|
||||||
|
" :Git rm %
|
||||||
|
" <
|
||||||
|
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
|
||||||
|
function! git#rm#run(files) abort
|
||||||
|
|
||||||
|
if len(a:files) == 1 && a:files[0] ==# '%'
|
||||||
|
let cmd = ['git', 'rm', expand('%')]
|
||||||
|
else
|
||||||
|
let cmd = ['git', 'rm'] + a:files
|
||||||
|
endif
|
||||||
|
call git#logger#info('git-rm cmd:' . string(cmd))
|
||||||
|
call s:JOB.start(cmd,
|
||||||
|
\ {
|
||||||
|
\ 'on_exit' : function('s:on_exit'),
|
||||||
|
\ }
|
||||||
|
\ )
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:on_exit(id, data, event) abort
|
||||||
|
call git#logger#info('git-rm exit data:' . string(a:data))
|
||||||
|
if a:data ==# 0
|
||||||
|
if exists(':GitGutter')
|
||||||
|
GitGutter
|
||||||
|
endif
|
||||||
|
echo 'done!'
|
||||||
|
else
|
||||||
|
echo 'failed!'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! git#rm#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
|
||||||
|
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
|
||||||
|
|
||||||
|
endfunction
|
@ -7,7 +7,8 @@ CONTENTS *git-contents*
|
|||||||
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-cherry-pick.....................................|git-cherry-pick|
|
||||||
3. git-stash.................................................|git-stash|
|
3. git-rm.......................................................|git-rm|
|
||||||
|
4. git-stash.................................................|git-stash|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INTRODUCTION *git-intro*
|
INTRODUCTION *git-intro*
|
||||||
@ -38,6 +39,15 @@ This command is to cherry pick commit from other branch.
|
|||||||
:Git cherry-pick <HashA> <HashB>
|
:Git cherry-pick <HashA> <HashB>
|
||||||
<
|
<
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
GIT-RM *git-rm*
|
||||||
|
|
||||||
|
This commands is to rm file contents to the index. For example, rm current
|
||||||
|
file to the index.
|
||||||
|
>
|
||||||
|
:Git rm %
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
GIT-STASH *git-stash*
|
GIT-STASH *git-stash*
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user