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

Improve git layer

close #306
This commit is contained in:
wsdjeg 2017-03-18 21:20:10 +08:00
parent 976274f1fe
commit 1eeb3e35ff
4 changed files with 53 additions and 31 deletions

View File

@ -413,9 +413,6 @@ function! SpaceVim#end() abort
let g:leaderGuide_max_size = 15
let g:leaderGuide_submode_mappings =
\ { '<C-C>': 'win_close', '<PageDown>': 'page_down', '<PageUp>': 'page_up'}
let g:_spacevim_mappings.g = {'name' : 'git function',
\ 'd' : ['Gita diff', 'git diff'],
\ }
call SpaceVim#plugins#load()
endfunction

View File

@ -1,20 +1,55 @@
function! SpaceVim#layers#git#plugins() abort
return [
let plugins = [
\ ['cohama/agit.vim', { 'on_cmd' : ['Agit','AgitFile']}],
\ ['gregsexton/gitv', { 'on_cmd' : ['Gitv']}],
\ ['junegunn/gv.vim', { 'on_cmd' : 'GV'}],
\ ['lambdalisue/vim-gita', {'on_cmd': 'Gita'}],
\ ['tpope/vim-fugitive'],
\ ['tpope/vim-fugitive', { 'merged' : 0}],
\ ]
if has('patch-8.0.0027') || has('nvim')
call add(plugins, ['lambdalisue/gina.vim', { 'on_cmd' : 'Gina'}])
else
call add(plugins, ['lambdalisue/vim-gita', { 'on_cmd' : 'Gita'}])
endif
return plugins
endfunction
function! SpaceVim#layers#git#config() abort
nnoremap <silent> <Leader>gs :Gita status<CR>
if has('patch-8.0.0027') || has('nvim')
nnoremap <silent> <Leader>gd :Gina diff<CR>
nnoremap <silent> <Leader>gs :Gina status<CR>
nnoremap <silent> <Leader>gc :Gina commit<CR>
nnoremap <silent> <Leader>gb :Gina blame<CR>
nnoremap <silent> <Leader>gp :Gina push<CR>
nnoremap <silent> <Leader>ga :Gina add %<CR>
nnoremap <silent> <Leader>gA :Gina add .<CR>
let g:_spacevim_mappings.g = {'name' : 'git function',
\ 'd' : ['Gina diff', 'git diff'],
\ 's' : ['Gina status', 'git status'],
\ 'c' : ['Gina commit', 'git commit'],
\ 'b' : ['Gina blame', 'git blame'],
\ 'p' : ['Gina push', 'git push'],
\ 'a' : ['Gina add %', 'git add current buffer'],
\ 'A' : ['Gina add .', 'git add all files'],
\ }
else
nnoremap <silent> <Leader>gd :Gita diff<CR>
nnoremap <silent> <Leader>gs :Gita status<CR>
nnoremap <silent> <Leader>gc :Gita commit<CR>
nnoremap <silent> <Leader>gb :Gita blame<CR>
nnoremap <silent> <Leader>gp :Gita push<CR>
nnoremap <silent> <Leader>ga :Gita add %<CR>
nnoremap <silent> <Leader>gA :Gita add .<CR>
let g:_spacevim_mappings.g = {'name' : 'git function',
\ 'd' : ['Gita diff', 'git diff'],
\ 's' : ['Gita status', 'git status'],
\ 'c' : ['Gita commit', 'git commit'],
\ 'b' : ['Gita blame', 'git blame'],
\ 'p' : ['Gita push', 'git push'],
\ 'a' : ['Gita add %', 'git add current buffer'],
\ 'A' : ['Gita add .', 'git add all files'],
\ }
endif
nmap <leader>hj <plug>(signify-next-hunk)
nmap <leader>hk <plug>(signify-prev-hunk)
nmap <leader>hJ 9999<leader>gj
@ -24,3 +59,5 @@ function! SpaceVim#layers#git#config() abort
autocmd FileType diff nnoremap <buffer><silent> q :bd!<CR>
augroup END
endfunction
" vim:set et sw=2 cc=80:

View File

@ -1,8 +0,0 @@
let g:leaderGuide_max_size = 15
let g:leaderGuide_submode_mappings =
\ { '<C-C>': 'win_close', '<PageDown>': 'page_down', '<PageUp>': 'page_up'}
let g:_spacevim_mappings.g = {'name' : 'git function',
\ 'd' : ['Gita diff', 'git diff'],
\ }
call leaderGuide#register_prefix_descriptions("\\", 'g:_spacevim_mappings')
call leaderGuide#register_prefix_descriptions("[unite]", 'g:_spacevim_unite_mappings')

View File

@ -1,4 +0,0 @@
if g:spacevim_realtime_leader_guide
nnoremap <silent><nowait> <leader> :<c-u>LeaderGuide get(g:, 'mapleader', '\')<CR>
vnoremap <silent> <leader> :<c-u>LeaderGuideVisual get(g:, 'mapleader', '\')<CR>
endif