mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:50:05 +08:00
Compare commits
4 Commits
a0b86e67e8
...
eacd71c784
Author | SHA1 | Date | |
---|---|---|---|
|
eacd71c784 | ||
|
7959583115 | ||
|
bde1252f93 | ||
|
3ffa25addc |
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
||||||
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](development/#license)
|
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](development/#license)
|
||||||
[![reddit](https://img.spacevim.org/reddit.svg)](https://www.reddit.com/r/SpaceVim/)
|
|
||||||
[![matrix](https://img.spacevim.org/spacevim-matrix.svg)](https://app.element.io/#/room/#spacevim:matrix.org)
|
|
||||||
|
|
||||||
![work-flow](https://img.spacevim.org/workflow.png)
|
![work-flow](https://img.spacevim.org/workflow.png)
|
||||||
|
|
||||||
|
@ -2872,10 +2872,6 @@ endfunction
|
|||||||
" send email to spacevim@googlegroups.com
|
" send email to spacevim@googlegroups.com
|
||||||
"
|
"
|
||||||
" To subscribe the maillist, send anything to:spacevim+subscribe@googlegroups.com
|
" To subscribe the maillist, send anything to:spacevim+subscribe@googlegroups.com
|
||||||
"
|
|
||||||
" @subsection Forum
|
|
||||||
"
|
|
||||||
" - Reddit: https://www.reddit.com/r/SpaceVim/
|
|
||||||
|
|
||||||
""
|
""
|
||||||
" @section Roadmap, roadmap
|
" @section Roadmap, roadmap
|
||||||
|
@ -1,6 +1,29 @@
|
|||||||
let s:JOB = SpaceVim#api#import('job')
|
"=============================================================================
|
||||||
|
" fetch.vim --- Git fetch command
|
||||||
|
" Copyright 2021 Eric Wong
|
||||||
|
" Author: Eric Wong < wsdjeg@outlook.com >
|
||||||
|
" URL: https://spacevim.org
|
||||||
|
" License: GPLv3
|
||||||
|
"=============================================================================
|
||||||
|
|
||||||
function! git#fetch#run(args)
|
|
||||||
|
if has('nvim-0.9.0')
|
||||||
|
function! git#fetch#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
return luaeval('require("git.command.fetch").complete(vim.api.nvim_eval("a:ArgLead"), vim.api.nvim_eval("a:CmdLine"), vim.api.nvim_eval("a:CursorPos"))')
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
|
||||||
|
""
|
||||||
|
" @section git-fetch, fetch
|
||||||
|
" @parentsection commands
|
||||||
|
" This commands is to fetch remote repo.
|
||||||
|
" >
|
||||||
|
" :Git fetch --all
|
||||||
|
" <
|
||||||
|
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
|
||||||
|
function! git#fetch#run(args)
|
||||||
|
|
||||||
let cmd = ['git', 'fetch'] + a:args
|
let cmd = ['git', 'fetch'] + a:args
|
||||||
call git#logger#debug('git-fetch cmd:' . string(cmd))
|
call git#logger#debug('git-fetch cmd:' . string(cmd))
|
||||||
@ -10,18 +33,18 @@ function! git#fetch#run(args)
|
|||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit(id, data, event) abort
|
function! s:on_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-fetch exit data:' . string(a:data))
|
call git#logger#debug('git-fetch exit data:' . string(a:data))
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
echo 'fetch done!'
|
echo 'fetch done!'
|
||||||
else
|
else
|
||||||
echo 'fetch failed!'
|
echo 'fetch failed!'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! git#fetch#complete(ArgLead, CmdLine, CursorPos)
|
function! git#fetch#complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
|
||||||
if a:ArgLead =~# '^-'
|
if a:ArgLead =~# '^-'
|
||||||
return s:options()
|
return s:options()
|
||||||
@ -33,15 +56,16 @@ function! git#fetch#complete(ArgLead, CmdLine, CursorPos)
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:remotes() abort
|
function! s:remotes() abort
|
||||||
return map(systemlist('git remote'), 'trim(v:val)')
|
return map(systemlist('git remote'), 'trim(v:val)')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:options() abort
|
function! s:options() abort
|
||||||
return join([
|
return join([
|
||||||
\ '--all',
|
\ '--all',
|
||||||
\ '--multiple',
|
\ '--multiple',
|
||||||
\ ], "\n")
|
\ ], "\n")
|
||||||
endfunction
|
endfunction
|
||||||
|
endif
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
let s:JOB = SpaceVim#api#import('job')
|
"=============================================================================
|
||||||
|
" reset.vim --- git reset command
|
||||||
|
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||||
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||||
|
" URL: https://spacevim.org
|
||||||
|
" License: GPLv3
|
||||||
|
"=============================================================================
|
||||||
|
|
||||||
|
if has('nvim-0.9.0')
|
||||||
|
function! git#reset#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
return luaeval('require("git.command.reset").complete(vim.api.nvim_eval("a:ArgLead"), vim.api.nvim_eval("a:CmdLine"), vim.api.nvim_eval("a:CursorPos"))')
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
|
||||||
|
|
||||||
function! git#reset#run(args)
|
function! git#reset#run(args)
|
||||||
|
|
||||||
if len(a:args) == 1 && a:args[0] ==# '%'
|
if len(a:args) == 1 && a:args[0] ==# '%'
|
||||||
let cmd = ['git', 'reset', 'HEAD', expand('%')]
|
let cmd = ['git', 'reset', 'HEAD', expand('%')]
|
||||||
@ -15,9 +28,9 @@ function! git#reset#run(args)
|
|||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit(id, data, event) abort
|
function! s:on_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-reset exit data:' . string(a:data))
|
call git#logger#debug('git-reset exit data:' . string(a:data))
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
if exists(':GitGutter')
|
if exists(':GitGutter')
|
||||||
@ -27,11 +40,11 @@ function! s:on_exit(id, data, event) abort
|
|||||||
else
|
else
|
||||||
echo 'failed!'
|
echo 'failed!'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! git#reset#complete(ArgLead, CmdLine, CursorPos)
|
function! git#reset#complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
|
||||||
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
|
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
endif
|
||||||
|
@ -7,9 +7,14 @@
|
|||||||
" :Git rm %
|
" :Git rm %
|
||||||
" <
|
" <
|
||||||
|
|
||||||
let s:JOB = SpaceVim#api#import('job')
|
if has('nvim-0.9.0')
|
||||||
|
function! git#rm#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
return luaeval('require("git.command.rm").complete(vim.api.nvim_eval("a:ArgLead"), vim.api.nvim_eval("a:CmdLine"), vim.api.nvim_eval("a:CursorPos"))')
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
|
||||||
function! git#rm#run(files) abort
|
function! git#rm#run(files) abort
|
||||||
|
|
||||||
if len(a:files) == 1 && a:files[0] ==# '%'
|
if len(a:files) == 1 && a:files[0] ==# '%'
|
||||||
let cmd = ['git', 'rm', expand('%')]
|
let cmd = ['git', 'rm', expand('%')]
|
||||||
@ -23,9 +28,9 @@ function! git#rm#run(files) abort
|
|||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit(id, data, event) abort
|
function! s:on_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-rm exit data:' . string(a:data))
|
call git#logger#debug('git-rm exit data:' . string(a:data))
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
if exists(':GitGutter')
|
if exists(':GitGutter')
|
||||||
@ -35,10 +40,11 @@ function! s:on_exit(id, data, event) abort
|
|||||||
else
|
else
|
||||||
echo 'failed!'
|
echo 'failed!'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! git#rm#complete(ArgLead, CmdLine, CursorPos) abort
|
function! git#rm#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
|
||||||
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
|
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
endif
|
||||||
|
@ -6,14 +6,19 @@
|
|||||||
" :Git stash list
|
" :Git stash list
|
||||||
" <
|
" <
|
||||||
|
|
||||||
let s:JOB = SpaceVim#api#import('job')
|
if has('nvim-0.9.0')
|
||||||
let s:NOTI = SpaceVim#api#import('notify')
|
function! git#stash#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
let s:BUFFER = SpaceVim#api#import('vim#buffer')
|
return luaeval('require("git.command.stash").complete(vim.api.nvim_eval("a:ArgLead"), vim.api.nvim_eval("a:CmdLine"), vim.api.nvim_eval("a:CursorPos"))')
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
let s:NOTI = SpaceVim#api#import('notify')
|
||||||
|
let s:BUFFER = SpaceVim#api#import('vim#buffer')
|
||||||
|
|
||||||
|
|
||||||
let s:stash_show_bufnr = -1
|
let s:stash_show_bufnr = -1
|
||||||
" @todo rewrite Git stash in lua
|
" @todo rewrite Git stash in lua
|
||||||
function! git#stash#run(args) abort
|
function! git#stash#run(args) abort
|
||||||
|
|
||||||
let cmd = ['git', 'stash'] + a:args
|
let cmd = ['git', 'stash'] + a:args
|
||||||
let subcmd = get(a:args, 0, '')
|
let subcmd = get(a:args, 0, '')
|
||||||
@ -32,68 +37,68 @@ function! git#stash#run(args) abort
|
|||||||
\ 'on_exit' : function('s:on_' . subcmd . 'exit'),
|
\ 'on_exit' : function('s:on_' . subcmd . 'exit'),
|
||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_stdout(id, data, event) abort
|
function! s:on_stdout(id, data, event) abort
|
||||||
for line in filter(a:data, '!empty(v:val)')
|
for line in filter(a:data, '!empty(v:val)')
|
||||||
call git#logger#debug('git-stash stdout:' . line)
|
call git#logger#debug('git-stash stdout:' . line)
|
||||||
call s:NOTI.notify(line, 'Normal')
|
call s:NOTI.notify(line, 'Normal')
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_stderr(id, data, event) abort
|
function! s:on_stderr(id, data, event) abort
|
||||||
for data in a:data
|
for data in a:data
|
||||||
call git#logger#debug('git-stash stderr:' . data)
|
call git#logger#debug('git-stash stderr:' . data)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit(id, data, event) abort
|
function! s:on_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-stash exit data:' . string(a:data))
|
call git#logger#debug('git-stash exit data:' . string(a:data))
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
" echo 'done!'
|
" echo 'done!'
|
||||||
else
|
else
|
||||||
" echo 'failed!'
|
" echo 'failed!'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_drop_stdout(id, data, event) abort
|
function! s:on_drop_stdout(id, data, event) abort
|
||||||
for line in filter(a:data, '!empty(v:val)')
|
for line in filter(a:data, '!empty(v:val)')
|
||||||
call git#logger#debug('git-stash stdout:' . line)
|
call git#logger#debug('git-stash stdout:' . line)
|
||||||
call s:NOTI.notify(line, 'Normal')
|
call s:NOTI.notify(line, 'Normal')
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_drop_stderr(id, data, event) abort
|
function! s:on_drop_stderr(id, data, event) abort
|
||||||
for line in filter(a:data, '!empty(v:val)')
|
for line in filter(a:data, '!empty(v:val)')
|
||||||
call git#logger#debug('git-stash stdout:' . line)
|
call git#logger#debug('git-stash stdout:' . line)
|
||||||
call s:NOTI.notify(line, 'WarningMsg')
|
call s:NOTI.notify(line, 'WarningMsg')
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_drop_exit(id, data, event) abort
|
function! s:on_drop_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-stash exit data:' . string(a:data))
|
call git#logger#debug('git-stash exit data:' . string(a:data))
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
" echo 'done!'
|
" echo 'done!'
|
||||||
else
|
else
|
||||||
" echo 'failed!'
|
" echo 'failed!'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_show_stdout(id, data, event) abort
|
function! s:on_show_stdout(id, data, event) abort
|
||||||
for data in a:data
|
for data in a:data
|
||||||
call git#logger#debug('git-stash stdout:' . data)
|
call git#logger#debug('git-stash stdout:' . data)
|
||||||
endfor
|
endfor
|
||||||
let s:lines += a:data
|
let s:lines += a:data
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_show_stderr(id, data, event) abort
|
function! s:on_show_stderr(id, data, event) abort
|
||||||
for line in filter(a:data, '!empty(v:val)')
|
for line in filter(a:data, '!empty(v:val)')
|
||||||
call git#logger#debug('git-stash stdout:' . line)
|
call git#logger#debug('git-stash stdout:' . line)
|
||||||
call s:NOTI.notify(line, 'WarningMsg')
|
call s:NOTI.notify(line, 'WarningMsg')
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_show_exit(id, data, event) abort
|
function! s:on_show_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-stash exit data:' . string(a:data))
|
call git#logger#debug('git-stash exit data:' . string(a:data))
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
if !bufexists(s:stash_show_bufnr)
|
if !bufexists(s:stash_show_bufnr)
|
||||||
@ -101,9 +106,9 @@ function! s:on_show_exit(id, data, event) abort
|
|||||||
endif
|
endif
|
||||||
call s:BUFFER.buf_set_lines(s:stash_show_bufnr, 0 , -1, 0, s:lines)
|
call s:BUFFER.buf_set_lines(s:stash_show_bufnr, 0 , -1, 0, s:lines)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:openStashShowBuffer() abort
|
function! s:openStashShowBuffer() abort
|
||||||
edit git://blame
|
edit git://blame
|
||||||
normal! "_dd
|
normal! "_dd
|
||||||
setl nobuflisted
|
setl nobuflisted
|
||||||
@ -114,9 +119,9 @@ function! s:openStashShowBuffer() abort
|
|||||||
setl syntax=diff
|
setl syntax=diff
|
||||||
nnoremap <buffer><silent> q :bd!<CR>
|
nnoremap <buffer><silent> q :bd!<CR>
|
||||||
return bufnr('%')
|
return bufnr('%')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:sub_commands() abort
|
function! s:sub_commands() abort
|
||||||
return join([
|
return join([
|
||||||
\ 'list',
|
\ 'list',
|
||||||
\ 'show',
|
\ 'show',
|
||||||
@ -128,9 +133,9 @@ function! s:sub_commands() abort
|
|||||||
\ 'push',
|
\ 'push',
|
||||||
\ ],
|
\ ],
|
||||||
\ "\n")
|
\ "\n")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! git#stash#complete(ArgLead, CmdLine, CursorPos) abort
|
function! git#stash#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
|
||||||
let str = a:CmdLine[:a:CursorPos-1]
|
let str = a:CmdLine[:a:CursorPos-1]
|
||||||
if str =~# '^Git\s\+stash\s\+[a-z]\=$'
|
if str =~# '^Git\s\+stash\s\+[a-z]\=$'
|
||||||
@ -139,5 +144,6 @@ function! git#stash#complete(ArgLead, CmdLine, CursorPos) abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
|
@ -6,12 +6,17 @@
|
|||||||
" :Git tag --list
|
" :Git tag --list
|
||||||
" <
|
" <
|
||||||
|
|
||||||
let s:JOB = SpaceVim#api#import('job')
|
if has('nvim-0.9.0')
|
||||||
let s:NT = SpaceVim#api#import('notify')
|
function! git#tag#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
let s:jobid = -1
|
return luaeval('require("git.command.tag").complete(vim.api.nvim_eval("a:ArgLead"), vim.api.nvim_eval("a:CmdLine"), vim.api.nvim_eval("a:CursorPos"))')
|
||||||
let s:stderr_data = []
|
endfunction
|
||||||
|
else
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
let s:NT = SpaceVim#api#import('notify')
|
||||||
|
let s:jobid = -1
|
||||||
|
let s:stderr_data = []
|
||||||
|
|
||||||
function! git#tag#run(argvs) abort
|
function! git#tag#run(argvs) abort
|
||||||
|
|
||||||
if s:jobid != -1
|
if s:jobid != -1
|
||||||
call s:NT.notify('previous tag command is not finished')
|
call s:NT.notify('previous tag command is not finished')
|
||||||
@ -36,27 +41,27 @@ function! git#tag#run(argvs) abort
|
|||||||
call s:NT.notify('`git` is not executable', 'WarningMsg')
|
call s:NT.notify('`git` is not executable', 'WarningMsg')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_stdout(id, data, event) abort
|
function! s:on_stdout(id, data, event) abort
|
||||||
if a:id != s:jobid
|
if a:id != s:jobid
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
for line in a:data
|
for line in a:data
|
||||||
call s:NT.notify(line)
|
call s:NT.notify(line)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_stderr(id, data, event) abort
|
function! s:on_stderr(id, data, event) abort
|
||||||
if a:id != s:jobid
|
if a:id != s:jobid
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
for line in a:data
|
for line in a:data
|
||||||
call add(s:stderr_data, line)
|
call add(s:stderr_data, line)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit(id, data, event) abort
|
function! s:on_exit(id, data, event) abort
|
||||||
call git#logger#debug('git-tag exit data:' . string(a:data))
|
call git#logger#debug('git-tag exit data:' . string(a:data))
|
||||||
if a:id != s:jobid
|
if a:id != s:jobid
|
||||||
return
|
return
|
||||||
@ -71,15 +76,15 @@ function! s:on_exit(id, data, event) abort
|
|||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
let s:jobid = -1
|
let s:jobid = -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:options() abort
|
function! s:options() abort
|
||||||
return [
|
return [
|
||||||
\ '--list',
|
\ '--list',
|
||||||
\ ]
|
\ ]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! git#tag#complete(ArgLead, CmdLine, CursorPos) abort
|
function! git#tag#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
let str = a:CmdLine[:a:CursorPos-1]
|
let str = a:CmdLine[:a:CursorPos-1]
|
||||||
if str =~# '^Git\s\+tag\s\+-$'
|
if str =~# '^Git\s\+tag\s\+-$'
|
||||||
return join(s:options(), "\n")
|
return join(s:options(), "\n")
|
||||||
@ -89,5 +94,6 @@ function! git#tag#complete(ArgLead, CmdLine, CursorPos) abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
|
@ -10,11 +10,12 @@ CONTENTS *git-contents*
|
|||||||
3. git-checkout............................................ |git-checkout|
|
3. git-checkout............................................ |git-checkout|
|
||||||
4. git-cherry-pick...................................... |git-cherry-pick|
|
4. git-cherry-pick...................................... |git-cherry-pick|
|
||||||
5. git-clean.................................................. |git-clean|
|
5. git-clean.................................................. |git-clean|
|
||||||
6. git-mv........................................................ |git-mv|
|
6. git-fetch.................................................. |git-fetch|
|
||||||
7. git-reflog................................................ |git-reflog|
|
7. git-mv........................................................ |git-mv|
|
||||||
8. git-rm........................................................ |git-rm|
|
8. git-reflog................................................ |git-reflog|
|
||||||
9. git-stash.................................................. |git-stash|
|
9. git-rm........................................................ |git-rm|
|
||||||
10. git-tag..................................................... |git-tag|
|
10. git-stash................................................. |git-stash|
|
||||||
|
11. git-tag..................................................... |git-tag|
|
||||||
3. Functions.................................................. |git-functions|
|
3. Functions.................................................. |git-functions|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
@ -70,6 +71,14 @@ This commands is to run `git clean`.
|
|||||||
:Git clean -f
|
:Git clean -f
|
||||||
<
|
<
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
GIT-FETCH *git-fetch*
|
||||||
|
|
||||||
|
This commands is to fetch remote repo.
|
||||||
|
>
|
||||||
|
:Git fetch --all
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
GIT-MV *git-mv*
|
GIT-MV *git-mv*
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
--=============================================================================
|
--=============================================================================
|
||||||
-- fetch.lua --- :Git fetch
|
-- fetch.lua --- Git fetch
|
||||||
-- Copyright (c) 2016-2022 Wang Shidong & Contributors
|
-- Copyright 2023 Eric Wong
|
||||||
-- Author: Wang Shidong < wsdjeg@outlook.com >
|
-- Author: Eric Wong < wsdjeg@outlook.com >
|
||||||
-- URL: https://spacevim.org
|
-- URL: https://spacevim.org
|
||||||
-- License: GPLv3
|
-- License: GPLv3
|
||||||
--=============================================================================
|
--=============================================================================
|
||||||
|
|
||||||
local m = {}
|
local M = {}
|
||||||
|
|
||||||
local job = require('spacevim.api.job')
|
local job = require('spacevim.api.job')
|
||||||
local nt = require('spacevim.api.notify')
|
local nt = require('spacevim.api.notify')
|
||||||
@ -28,7 +28,7 @@ local function on_std(id, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.run(argv)
|
function M.run(argv)
|
||||||
local cmd = { 'git', 'fetch' }
|
local cmd = { 'git', 'fetch' }
|
||||||
for _, v in ipairs(argv) do
|
for _, v in ipairs(argv) do
|
||||||
table.insert(cmd, v)
|
table.insert(cmd, v)
|
||||||
@ -38,8 +38,27 @@ function m.run(argv)
|
|||||||
job.start(cmd, {
|
job.start(cmd, {
|
||||||
on_exit = on_exit,
|
on_exit = on_exit,
|
||||||
on_stdout = on_std,
|
on_stdout = on_std,
|
||||||
on_stderr = on_std
|
on_stderr = on_std,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return m
|
local function get_remotes()
|
||||||
|
return vim.tbl_map(function(t)
|
||||||
|
return vim.fn.trim(t)
|
||||||
|
end, vim.fn.systemlist('git remote'))
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
if vim.startswith(ArgLead, '-') then
|
||||||
|
return table.concat({ '--all', '--multiple' }, '\n')
|
||||||
|
end
|
||||||
|
|
||||||
|
local str = string.sub(CmdLine, 1, CursorPos)
|
||||||
|
if vim.regex([[^Git\s\+fetch\s\+[^ ]*$]]):match_str(str) then
|
||||||
|
return table.concat(get_remotes(), '\n')
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
-- URL: https://spacevim.org
|
-- URL: https://spacevim.org
|
||||||
-- License: GPLv3
|
-- License: GPLv3
|
||||||
--=============================================================================
|
--=============================================================================
|
||||||
local m = {}
|
local M = {}
|
||||||
|
|
||||||
local job = require('spacevim.api.job')
|
local job = require('spacevim.api.job')
|
||||||
local nt = require('spacevim.api.notify')
|
local nt = require('spacevim.api.notify')
|
||||||
@ -23,7 +23,7 @@ local function on_exit(id, code, single)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.run(argv)
|
function M.run(argv)
|
||||||
local cmd = { 'git', 'reset' }
|
local cmd = { 'git', 'reset' }
|
||||||
if #argv == 1 and argv[1] == '%' then
|
if #argv == 1 and argv[1] == '%' then
|
||||||
cmd = { 'git', 'reset', 'HEAD', vim.fn.expand('%') }
|
cmd = { 'git', 'reset', 'HEAD', vim.fn.expand('%') }
|
||||||
@ -38,4 +38,9 @@ function m.run(argv)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return m
|
function M.complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
local rst = vim.fn.getcompletion(ArgLead, 'file')
|
||||||
|
return table.concat(rst, '\n')
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
@ -47,4 +47,9 @@ function m.run(argv)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
local rst = vim.fn.getcompletion(ArgLead, 'file')
|
||||||
|
return table.concat(rst, '\n')
|
||||||
|
end
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
@ -97,4 +97,27 @@ function M.run(argv)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function sub_commands()
|
||||||
|
return {
|
||||||
|
'list',
|
||||||
|
'show',
|
||||||
|
'drop',
|
||||||
|
'pop',
|
||||||
|
'apply',
|
||||||
|
'branch',
|
||||||
|
'clear',
|
||||||
|
'save',
|
||||||
|
'push',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
local str = string.sub(CmdLine, 1, CursorPos)
|
||||||
|
if vim.regex([[^Git\s\+stash\s\+[a-z]\+$]]):match_str(str) then
|
||||||
|
return table.concat(sub_commands(), '\n')
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -72,7 +72,14 @@ function M.run(argv)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.complete(ArgLead, CmdLine, CursorPos) end
|
function M.complete(ArgLead, CmdLine, CursorPos)
|
||||||
|
local str = string.sub(CmdLine, 1, CursorPos)
|
||||||
|
if vim.regex([[^Git\s\+tag\s\+-\+$]]):match_str(str) then
|
||||||
|
return table.concat({'--list'}, '\n')
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
@ -8465,10 +8465,6 @@ send email to spacevim@googlegroups.com
|
|||||||
To subscribe the maillist, send anything
|
To subscribe the maillist, send anything
|
||||||
to:spacevim+subscribe@googlegroups.com
|
to:spacevim+subscribe@googlegroups.com
|
||||||
|
|
||||||
FORUM
|
|
||||||
|
|
||||||
Reddit: https://www.reddit.com/r/SpaceVim/
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
FAQ *SpaceVim-faq*
|
FAQ *SpaceVim-faq*
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@ lang: zh
|
|||||||
|
|
||||||
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
||||||
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](development/#证书)
|
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](development/#证书)
|
||||||
[![reddit](https://img.spacevim.org/reddit.svg)](https://www.reddit.com/r/SpaceVim/)
|
|
||||||
-[![matrix](https://img.spacevim.org/spacevim-cn-matrix.svg)](https://app.element.io/#/room/#spacevim-cn:matrix.org)
|
|
||||||
|
|
||||||
![work-flow](https://img.spacevim.org/workflow.png)
|
![work-flow](https://img.spacevim.org/workflow.png)
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ description: "SpaceVim is a modular Vim/Neovim configuration that seeks to provi
|
|||||||
|
|
||||||
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
||||||
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](development/#license)
|
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](development/#license)
|
||||||
[![reddit](https://img.spacevim.org/reddit.svg)](https://www.reddit.com/r/SpaceVim/)
|
|
||||||
[![matrix](https://img.spacevim.org/spacevim-matrix.svg)](https://app.element.io/#/room/#spacevim:matrix.org)
|
|
||||||
|
|
||||||
![work-flow](https://img.spacevim.org/workflow.png)
|
![work-flow](https://img.spacevim.org/workflow.png)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user