1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 12:30:40 +08:00

Improve Version Control layer (#1470)

This commit is contained in:
Wang Shidong 2018-03-12 21:00:24 +08:00 committed by GitHub
parent fd3d26afb0
commit e088980f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 532 additions and 274 deletions

View File

@ -200,7 +200,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow'
" <
let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode',
\ 'syntax checking', 'minor mode lighters',
\ 'version control info', 'hunks']
\ ]
""
" Define the right section of statusline in active windows. By default:
" >

View File

@ -9,6 +9,7 @@
scriptencoding utf-8
let s:SYSTEM = SpaceVim#api#import('system')
" Default options {{{
function! SpaceVim#default#options() abort
" basic vim settiing
@ -67,7 +68,9 @@ function! SpaceVim#default#options() abort
" Automatically read a file changed outside of vim
set autoread
" backup
" Set SpaceVim data directory {{{
" use ~/.cache/SpaceVim/ as default data directory, create the directory if
" it does not exist.
set backup
set undofile
set undolevels=1000
@ -94,9 +97,8 @@ function! SpaceVim#default#options() abort
set undodir=$HOME/.cache/SpaceVim/undofile
set backupdir=$HOME/.cache/SpaceVim/backup
set directory=$HOME/.cache/SpaceVim/swap
" }}}
" no fold enable
set nofoldenable
set nowritebackup
set matchtime=0
set ruler
@ -125,6 +127,9 @@ function! SpaceVim#default#options() abort
endif
" Do not wrap lone lines
set nowrap
set foldtext=SpaceVim#default#Customfoldtext()
endfunction
"}}}
@ -303,4 +308,29 @@ function! SpaceVim#default#UseSimpleMode() abort
endfunction
function! SpaceVim#default#Customfoldtext() abort
"get first non-blank line
let fs = v:foldstart
while getline(fs) =~# '^\s*$' | let fs = nextnonblank(fs + 1)
endwhile
if fs > v:foldend
let line = getline(v:foldstart)
else
let line = substitute(getline(fs), '\t', repeat(' ', &tabstop), 'g')
endif
let foldsymbol='+'
let repeatsymbol=''
let prefix = foldsymbol . ' '
let w = winwidth(0) - &foldcolumn - (&number ? 8 : 0)
let foldSize = 1 + v:foldend - v:foldstart
let foldSizeStr = ' ' . foldSize . ' lines '
let foldLevelStr = repeat('+--', v:foldlevel)
let lineCount = line('$')
let foldPercentage = printf('[%.1f', (foldSize*1.0)/lineCount*100) . '%] '
let expansionString = repeat(repeatsymbol, w - strwidth(prefix.foldSizeStr.line.foldLevelStr.foldPercentage))
return prefix . line . expansionString . foldSizeStr . foldPercentage . foldLevelStr
endfunction
" vim:set et sw=2:

View File

@ -6,102 +6,312 @@
" License: GPLv3
"=============================================================================
scriptencoding utf-8
function! SpaceVim#layers#VersionControl#plugins() abort
let plugins = []
call add(plugins, ['mhinz/vim-signify', {'merged' : 0}])
call add(plugins, ['tpope/vim-fugitive', { 'merged' : 0}])
return plugins
endfunction
function! SpaceVim#layers#VersionControl#config() abort
let g:_spacevim_mappings_space.g = get(g:_spacevim_mappings_space, 'g', {'name' : '+VersionControl/git'})
let g:_spacevim_mappings_space.g.v = get(g:_spacevim_mappings_space.g, 'v', {'name' : '+VersionControl'})
call SpaceVim#mapping#space#def('nnoremap', ['g', '.'], 'call call('
\ . string(s:_function('s:buffer_transient_state')) . ', [])',
\ 'buffer transient state', 1)
call SpaceVim#layers#core#statusline#register_sections('vcs', s:_function('s:git_branch'))
call SpaceVim#layers#core#statusline#register_sections('hunks', s:_function('s:hunks'))
call add(g:spacevim_statusline_left_sections, 'vcs')
call add(g:spacevim_statusline_left_sections, 'hunks')
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'v'], 'call SpaceVim#layers#core#statusline#toggle_section("vcs")',
\ 'version control info', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")',
\ 'toggle the hunks summary', 1)
endfunction
"  master
function! s:git_branch() abort
if exists('g:loaded_fugitive')
let l:head = fugitive#head()
if empty(l:head)
call fugitive#detect(getcwd())
let l:head = fugitive#head()
endif
return empty(l:head) ? '' : '  '.l:head . ' '
endif
return ''
endfunction
" +0 ~0 -0
function! s:hunks() abort
let hunks = [0,0,0]
try
let hunks = sy#repo#get_stats()
catch
endtry
let rst = ''
if hunks[0] > 0
let rst .= hunks[0] . '+ '
endif
if hunks[1] > 0
let rst .= hunks[1] . '~ '
endif
if hunks[2] > 0
let rst .= hunks[2] . '- '
endif
return empty(rst) ? '' : ' ' . rst
endfunction
" vcs transient state functions:
" first we need to open a buffer contains:
" Switches
" -g Show graph (--graph)
" -c Show graph in color (--color)
"
" Options
" =n Limit number of commits (-n"256")
" =f Limit to files (-- )
" =a Limit to author (--author=)
"
" Actions
" l Log current
let s:git_log_switches = {
\ 'g' : {'desc' : 'Show graph', 'option' : '--graph'},
\ 'c' : {'desc' : 'Show graph in color', 'option' : '--color'},
\ 'd' : {'desc' : 'Show refnames', 'option' : '--decorate'},
\ 'S' : {'desc' : 'Show signatures', 'option' : '--show-signature'},
\ 'u' : {'desc' : 'Show diffs', 'option' : '--patch'},
\ 's' : {'desc' : 'Show diffstats', 'option' : '--stat'},
\ 'h' : {'desc' : 'Show header', 'option' : '++header'},
\ 'D' : {'desc' : 'Simplify by decoration', 'option' : '--simplify-by-decoration'},
\ 'f' : {'desc' : 'Follow renames when showing single-file log', 'option' : '--follow'},
\ }
let s:git_log_options = {
\ 'n' : {'desc' : 'Limit number of commits', 'option' : '-n'},
\ 'f' : {'desc' : 'Limit to files', 'option' : '--'},
\ 'a' : {'desc' : 'Limit to author', 'option' : '--author='},
\ 'o' : {'desc' : 'Order commits by', 'option' : '++order='},
\ 'g' : {'desc' : 'Search messages', 'option' : '--grep='},
\ 'G' : {'desc' : 'Search changes', 'option' : '-G'},
\ 'S' : {'desc' : 'Search occurrences', 'option' : '-S'},
\ 'L' : {'desc' : 'Trace line evolution', 'option' : '-L'},
\ }
let s:git_log_actions = {
\ 'l' : {'desc' : 'Log current'},
\ 'o' : {'desc' : 'Log other'},
\ 'h' : {'desc' : 'Log HEAD'},
\ 'L' : {'desc' : 'Log local branches'},
\ 'b' : {'desc' : 'Log all branches'},
\ 'a' : {'desc' : 'Log all references'},
\ 'r' : {'desc' : 'Reflog current'},
\ 'O' : {'desc' : 'Reflog other'},
\ 'H' : {'desc' : 'Reflog HEAD'},
\ }
function! s:generate_git_log_popup_content() abort
let lines = ['Switches']
for k in keys(s:git_log_switches)
call add(lines, ' -' . k . ' ' . s:git_log_switches[k]['desc'] . '(' . s:git_log_switches[k]['option'] . ')')
endfor
call add(lines, '')
call add(lines, 'Options')
for k in keys(s:git_log_options)
call add(lines, ' =' . k . ' ' . s:git_log_options[k]['desc'] . '(' . s:git_log_options[k]['option'] . ')')
endfor
call add(lines, '')
call add(lines, 'Actions')
let actions_line = ''
let i = 0
for k in ['l', 'L', 'r', 'o', 'b', 'O', 'h', 'a', 'H']
let i += 1
let actions_line .= ' ' . k . ' ' . s:git_log_actions[k]['desc']
let actions_line .= repeat(' ', i % 3 * 30 - len(actions_line))
if i%3 == 0
call add(lines, actions_line)
let actions_line = ''
endif
endfor
if !empty(actions_line)
call add(lines, actions_line)
let actions_line = ''
endif
return lines
endfunction
function! s:open_log_popup_buffer() abort
let content = s:generate_git_log_popup_content()
exe 'rightbelow ' . len(content) . 'split __SpaceVim_git_log_popup__'
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber nocursorline
setfiletype SpaceVimGitLogPopup
call setline(1, content)
endfunction
function! Gitlog() abort
call s:open_log_popup_buffer()
endfunction
function! s:show_repo_log() abort
endfunction
function! s:show_diff_of_unstaged_hunks() abort
endfunction
function! s:fetch_repo() abort
endfunction
function! s:pull_repo() abort
endfunction
function! s:push_repo() abort
endfunction
function! s:commit_popup() abort
endfunction
function! s:commit() abort
endfunction
function! s:revert_hunk() abort
endfunction
function! s:stage_hunk() abort
endfunction
function! s:show_hunk_diff() abort
endfunction
function! s:buffer_transient_state() abort
let state = SpaceVim#api#import('transient_state')
call state.set_title('VCS Transient State')
call state.defind_keys(
\ {
\ 'layout' : 'vertical split',
\ 'left' : [
\ {
\ 'key' : 'n',
\ 'desc' : 'next hunk',
\ 'func' : '',
\ 'cmd' : 'normal ]c',
\ 'exit' : 0,
\ },
\ {
\ 'key' : ['N', 'p'],
\ 'desc' : 'previous hunk',
\ 'func' : '',
\ 'cmd' : 'normal [c',
\ 'exit' : 0,
\ },
\ {
\ 'key' : ['r', 's', 'h'],
\ 'desc' : 'revert/stage/show',
\ 'func' : '',
\ 'cmd' : 'normal [c',
\ 'exit' : 0,
\ },
\ {
\ 'key' : 't',
\ 'desc' : 'toggle diff signs',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ ],
\ 'right' : [
\ {
\ 'key' : {
\ 'name' : 'w/u',
\ 'pos': [[0,1], [2,3]],
\ 'handles' : [
\ ['w', 'Gina add %'],
\ ['u', 'Gina reset %'],
\ ],
\ },
\ 'desc' : 'stage/unstage in current file',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : ['c', 'C'],
\ 'desc' : 'commit with popup/direct commit',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ {
\ 'key' : ['f', 'F', 'P'],
\ 'desc' : 'fetch/pull/push popup',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ {
\ 'key' : ['l', 'D'],
\ 'desc' : 'log/diff popup',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ ],
\ }
\ )
call state.open()
let state = SpaceVim#api#import('transient_state')
call state.set_title('VCS Transient State')
call state.defind_keys(
\ {
\ 'layout' : 'vertical split',
\ 'left' : [
\ {
\ 'key' : 'n',
\ 'desc' : 'next hunk',
\ 'func' : '',
\ 'cmd' : 'normal ]c',
\ 'exit' : 0,
\ },
\ {
\ 'key' : ['N', 'p'],
\ 'desc' : 'previous hunk',
\ 'func' : '',
\ 'cmd' : 'normal [c',
\ 'exit' : 0,
\ },
\ {
\ 'key' : {
\ 'name' : 'r/s/h',
\ 'pos' : [[0,1], [2,3], [4,5]],
\ 'handles' : [
\ ['r' , 'call call(' . string(s:_function('s:revert_hunk')) . ', [])'],
\ ['s' , 'call call(' . string(s:_function('s:stage_hunk')) . ', [])'],
\ ['h' , 'call call(' . string(s:_function('s:show_hunk_diff')) . ', [])'],
\ ],
\ },
\ 'desc' : 'revert/stage/show hunk',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : 't',
\ 'desc' : 'toggle diff signs',
\ 'func' : '',
\ 'cmd' : 'SignifyToggle',
\ 'exit' : 0,
\ },
\ ],
\ 'right' : [
\ {
\ 'key' : {
\ 'name' : 'w/u',
\ 'pos': [[0,1], [2,3]],
\ 'handles' : [
\ ['w', 'Gina add %'],
\ ['u', 'Gina reset %'],
\ ],
\ },
\ 'desc' : 'stage/unstage in current file',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : {
\ 'name' : 'c/C',
\ 'pos' : [[0,1], [2,3]],
\ 'handles' : [
\ ['c' , 'call call(' . string(s:_function('s:commit_popup')) . ', [])'],
\ ['C' , 'call call(' . string(s:_function('s:commit')) . ', [])'],
\ ],
\ },
\ 'desc' : 'commit with popup/direct commit',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ {
\ 'key' : {
\ 'name' : 'f/F/P',
\ 'pos' : [[0,1], [2,3], [4,5]],
\ 'handles' : [
\ ['f' , 'call call(' . string(s:_function('s:fetch_repo')) . ', [])'],
\ ['F' , 'call call(' . string(s:_function('s:pull_repo')) . ', [])'],
\ ['P' , 'call call(' . string(s:_function('s:push_repo')) . ', [])'],
\ ],
\ },
\ 'desc' : 'fetch/pull/push popup',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ {
\ 'key' : {
\ 'name' : 'l/D',
\ 'pos' : [[0,1], [2,3]],
\ 'handles' : [
\ ['l' , 'call call(' . string(s:_function('s:show_repo_log')) . ', [])'],
\ ['D' , 'call call(' . string(s:_function('s:show_diff_of_unstaged_hunks')) . ', [])'],
\ ],
\ },
\ 'desc' : 'log/diff popup',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ ],
\ }
\ )
call state.open()
endfunction
" function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170')
function! s:_function(fstr) abort
return function(a:fstr)
endfunction
function! s:_function(fstr) abort
return function(a:fstr)
endfunction
else
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
let s:_s = '<SNR>' . s:_SID() . '_'
function! s:_function(fstr) abort
return function(substitute(a:fstr, 's:', s:_s, 'g'))
endfunction
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
let s:_s = '<SNR>' . s:_SID() . '_'
function! s:_function(fstr) abort
return function(substitute(a:fstr, 's:', s:_s, 'g'))
endfunction
endif

View File

@ -10,13 +10,14 @@ function! SpaceVim#layers#core#plugins() abort
let plugins = []
if g:spacevim_filemanager ==# 'nerdtree'
call add(plugins, ['scrooloose/nerdtree', { 'on_cmd' : 'NERDTreeToggle',
\ 'loadconf' : 1}])
\ 'loadconf' : 1}])
elseif g:spacevim_filemanager ==# 'vimfiler'
call add(plugins, ['Shougo/vimfiler.vim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1, 'on_cmd' : ['VimFiler', 'VimFilerBufferDir']}])
call add(plugins, ['Shougo/unite.vim',{ 'merged' : 0 , 'loadconf' : 1}])
call add(plugins, ['Shougo/vimproc.vim', {'build' : ['make']}])
endif
call add(plugins, ['benizi/vim-automkdir'])
call add(plugins, ['andymass/vim-matchup'])
return plugins
endfunction

View File

@ -140,17 +140,6 @@ function! s:modes() abort
return m . ' '
endfunction
function! s:git_branch() abort
if exists('g:loaded_fugitive')
let l:head = fugitive#head()
if empty(l:head)
call fugitive#detect(getcwd())
let l:head = fugitive#head()
endif
return empty(l:head) ? '' : '  '.l:head . ' '
endif
return ''
endfunction
function! s:percentage() abort
return ' %P '
@ -238,25 +227,6 @@ else
endfunction
endif
function! s:hunks() abort
let hunks = [0,0,0]
try
let hunks = GitGutterGetHunkSummary()
catch
endtry
let rst = ''
if hunks[0] > 0
let rst .= hunks[0] . '+ '
endif
if hunks[1] > 0
let rst .= hunks[1] . '~ '
endif
if hunks[2] > 0
let rst .= hunks[2] . '- '
endif
return empty(rst) ? '' : ' ' . rst
endfunction
let s:registed_sections = {
\ 'winnr' : function('s:winnr'),
\ 'syntax checking' : function('s:syntax_checking'),
@ -264,8 +234,6 @@ let s:registed_sections = {
\ 'fileformat' : function('s:fileformat'),
\ 'major mode' : function('s:major_mode'),
\ 'minor mode lighters' : function('s:modes'),
\ 'version control info' : function('s:git_branch'),
\ 'hunks' : function('s:hunks'),
\ 'cursorpos' : function('s:cursorpos'),
\ 'percentage' : function('s:percentage'),
\ 'time' : function('s:time'),
@ -344,6 +312,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
elseif &filetype ==# 'SpaceVimLayerManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'SpaceVimGitLogPopup'
return '%#SpaceVim_statusline_a# Git log popup %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
elseif &filetype ==# 'SpaceVimPlugManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
@ -414,7 +384,7 @@ endfunction
function! s:inactive() abort
let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#'
let secs = [s:filename(), " " . &filetype, s:modes(), s:git_branch()]
let secs = [s:filename(), " " . &filetype, s:modes()]
let base = 10
for sec in secs
let len = s:STATUSLINE.len(sec)
@ -518,8 +488,6 @@ endfunction
function! SpaceVim#layers#core#statusline#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'm'], 'call SpaceVim#layers#core#statusline#toggle_section("minor mode lighters")',
\ 'toggle the minor mode lighters', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'v'], 'call SpaceVim#layers#core#statusline#toggle_section("version control info")',
\ 'version control info', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'M'], 'call SpaceVim#layers#core#statusline#toggle_section("major mode")',
\ 'toggle the major mode', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'b'], 'call SpaceVim#layers#core#statusline#toggle_section("battery status")',
@ -532,8 +500,6 @@ function! SpaceVim#layers#core#statusline#config() abort
\ 'toggle the cursor position', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif',
\ 'toggle the statuline itself', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")',
\ 'toggle the hunks summary', 1)
function! TagbarStatusline(...) abort
let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3
return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '',

View File

@ -9,8 +9,6 @@
function! SpaceVim#layers#git#plugins() abort
let plugins = [
\ ['junegunn/gv.vim', { 'on_cmd' : ['GV']}],
\ ['airblade/vim-gitgutter', { 'merged' : 0}],
\ ['tpope/vim-fugitive', { 'merged' : 0}],
\ ]
if has('patch-8.0.0027') || has('nvim')
call add(plugins, ['lambdalisue/gina.vim', { 'on_cmd' : 'Gina'}])

View File

@ -38,7 +38,6 @@ function! SpaceVim#layers#ui#config() abort
let g:indentLine_char = get(g:, 'indentLine_char', '┊')
let g:indentLine_concealcursor = 'niv'
let g:indentLine_conceallevel = 2
let g:indentLine_fileType = ['*']
let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler']
let g:signify_disable_by_default = 0
let g:signify_line_highlight = 0

View File

@ -75,71 +75,71 @@ lang: cn
- [文件树中的常用操作](#文件树中的常用操作)
- [文件树中打开文件](#文件树中打开文件)
- [以 `g` 为前缀的快捷键](#以-g-为前缀的快捷键)
- [以 `z` 为前缀的快捷键](#以 -z- 为前缀的快捷键)
- [以 `z` 开头的命令](#以-z-开头的命令)
- [自动保存](#自动保存)
- [搜索](#搜索)
- [使用工具](#使用工具)
- [有用的按键绑](#有用的按键绑定)
- [使用外工具](#使用外工具)
- [常用按键绑定](#常用按键绑定)
- [在当前文件中进行搜索](#在当前文件中进行搜索)
- [本地所有缓冲区内搜索](#在本地所有缓冲区内进行搜索)
- [所有打开的缓冲区中进行搜索](#在所有打开的缓冲区中进行搜索)
- [在任意目录中进行搜索](#在任意目录中进行搜索)
- [在工程中进行搜](#在工程中进行搜索)
- [在工程中后台搜](#在工程中后台搜索)
- [在工程中进行搜](#在工程中进行搜索)
- [后台进行工程搜索](#后台进行工程搜索)
- [在网上进行搜索](#在网上进行搜索)
- [ fly 进行搜索](#用 fly 进行搜索)
- [ fly 工具进行搜索](#用fly-工具进行搜索)
- [保持高亮](#保持高亮)
- [编辑](#编辑)
- [粘贴文本](#粘贴文本)
- [粘贴文本自动缩进](#粘贴文本自动缩进)
- [文本操作命令](#文本操作命令)
- [文本插入命令](#文本插入命令)
- [评论Commenting](#评论commenting)
- [编码方式](#多编码方式)
- [错误处理(handling)](#错误处理)
- [注释(Commentings)](#注释commentings)
- [方式编码](#多方式编码)
- [错误处理](#错误处理)
- [工程管理](#工程管理)
- [完成(Achievements)](#完成(achievements))
- [成就](#成就)
- [错误](#错误)
- [开始 forks 和 watchers](#开始 forks 和 watchers)
- [Stars, forks and watchers](#stars-forks-and-watchers)
- [特性](#特性)
- [出彩的用户界面(ui)](#)
- [按键绑定助记符](#案件绑定助记符)
- [语言特性模式](#语言特性模式)
- [按键映射](#按键映射)
- [c/c++ 支持](#c/c++ 支持)
- [go 支持](#go 支持)
- [python 支持](#python 支持)
- [以 Neovim 为中心的 SpaceVim 的 Dark powered 模式.](#以 Neovim 为中心的 SpaceVim 的 Dark powered 模式.)
- [优雅的用户界面](#优雅的用户界面)
- [按键绑定助记符](#按键绑定助记符)
- [特定语言模式](#特定语言模式)
- [按键导航](#按键导航)
- [c/c++ 支持](#cc-支持)
- [go 支持](#go-支持)
- [python 支持](#python-支持)
- [以 Neovim 为中心的 SpaceVim Dark powered 模式.](#以-neovim-为中心的-spacevim-dark-powered-模式)
- [模块化配置](#模块化配置)
- [导航键模式](#多导航键模式)
- [vim 初始全局导航键](# vim 初始全局导航键)
- [vim 本地初始导航键](#vim 本地初始导航键)
- [窗口函数导航键](#窗口函数导航键)
- [Unite 工作流程(work flow)导航键](#unite 工作流程导航键)
- [Unite 为中心的工作流程(work-flow)](#unite 为中心的工作流程)
- [高亮插件](#高亮插件)
- [非延迟(non lazy-loaded)加载插件](#非延迟加载插件)
- [迟(lazy-loaded)加载插件](#延迟加载插件)
- [ leader 模式](#多-leader-模式)
- [初始 vim 全局 leader](#初始-vim-全局-leader)
- [本地 vim 初始 leader](#本地-vim-初始-leader)
- [窗口函数 leader](#窗口函数-leader)
- [联合工作流程 leader](#联合工作流程-leader)
- [中心联合工作流程](#中心联合工作流程)
- [插件亮点](#插件亮点)
- [非延时加载插件](#非延时加载插件)
- [时加载插件](#延时加载插件)
- [语言](#语言)
- [命令](#命令)
- [命令](#命令-1)
- [补全](#补全)
- [Unite](#unite)
- [操作符 & 文本对象](#operators--text-objects)
- [联合](#联合)
- [操作符 & 文本的对象](#操作符--文本的对象)
- [默认按键绑定](#默认按键绑定)
- [文件操作](#文件操作)
- [UI 编辑](#UI 编辑)
- [文件操作](#文件操作)
- [UI 编辑](#ui-编辑)
- [窗口管理](#窗口管理)
- [本地(Native)函数](#本地函数)
- [插件: Unite](#plugin-unite)
- [插件: neocomplete](#plugin-neocomplete)
- [插件: NERD Commenter](#plugin-nerd-commenter)
- [插件: Goyo and Limelight](#plugin-goyo-and-limelight)
- [插件: ChooseWin](#plugin-choosewin)
- [插件: Bookmarks](#plugin-bookmarks)
- [插件: Gina/Gita](#plugin-ginagita)
- [插件: vim-signify](#plugin-vim-signify)
- [本地函数](#本地函数)
- [Plugin: Unite](#plugin-unite)
- [Plugin: neocomplete](#plugin-neocomplete)
- [Plugin: NERD Commenter](#plugin-nerd-commenter)
- [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight)
- [Plugin: ChooseWin](#plugin-choosewin)
- [Plugin: Bookmarks](#plugin-bookmarks)
- [Plugin: Gina/Gita](#plugin-ginagita)
- [Plugin: vim-signify](#plugin-vim-signify)
- [Misc Plugins](#misc-plugins)
- [模块化配置](#模块化配置)
- [模块化配置](#模块化配置-1)
- [Denite/Unite为主的工作平台](#deniteunite为主的工作平台)
- [自动补全](#自动补全-1)
- [细致的tags管理](#细致的tags管理)
@ -699,29 +699,29 @@ let g:spacevim_custom_plugins = [
##### 常用的成对快捷键
| 快捷键 | 描述 |
| ------- | ------------------------------ |
| `[ SPC` | 在当前行或已选区域上方添加空行 |
| `] SPC` | 在当前行或已选区域下方添加空行 |
| `[ b` | 跳至前一 buffer |
| `] b` | 跳至下一 buffer |
| `[ f` | 跳至文件夹中的前一个文件 |
| `] f` | 跳至文件夹中的下一个文件 |
| `[ l` | 跳至前一个错误处 |
| `] l` | 跳至下一个错误处 |
| `[ c` | 跳至前一个 vcs hunk |
| `] c` | 跳至下一个 vcs hunk |
| `[ q` | 跳至前一个错误 |
| `] q` | 跳至下一个错误 |
| `[ t` | 跳至前一个标签页 |
| `] t` | 跳至下一个标签页 |
| `[ w` | 跳至前一个窗口 |
| `] w` | 跳至下一个窗口 |
| `[ e` | 向上移动当前行或者已选择行 |
| `] e` | 向下移动当前行或者已选择行 |
| `[ p` | 粘贴至当前行上方 |
| `] p` | 粘贴至当前行下方 |
| `g p` | 选择粘贴的区域 |
| 快捷键 | 描述 |
| ------- | ---------------------------------------------- |
| `[ SPC` | 在当前行或已选区域上方添加空行 |
| `] SPC` | 在当前行或已选区域下方添加空行 |
| `[ b` | 跳至前一 buffer |
| `] b` | 跳至下一 buffer |
| `[ f` | 跳至文件夹中的前一个文件 |
| `] f` | 跳至文件夹中的下一个文件 |
| `[ l` | 跳至前一个错误处 |
| `] l` | 跳至下一个错误处 |
| `[ c` | 跳至前一个 vcs hunk (需要 VersionControl 模块) |
| `] c` | 跳至下一个 vcs hunk (需要 VersionControl 模块) |
| `[ q` | 跳至前一个错误 |
| `] q` | 跳至下一个错误 |
| `[ t` | 跳至前一个标签页 |
| `] t` | 跳至下一个标签页 |
| `[ w` | 跳至前一个窗口 |
| `] w` | 跳至下一个窗口 |
| `[ e` | 向上移动当前行或者已选择行 |
| `] e` | 向下移动当前行或者已选择行 |
| `[ p` | 粘贴至当前行上方 |
| `] p` | 粘贴至当前行下方 |
| `g p` | 选择粘贴的区域 |
##### 跳转,合并,拆分
@ -998,52 +998,52 @@ SpaceVim 的文件树提供了版本控制信息的借口,但是这一特性
当你不记得按键映射时, 你可以在普通模式下输入前缀 `z` , 然后你会看到所有以 `z` 为前缀的函数映射.
| Key Binding | Description |
| ----------- | -------------------------------------------- |
| `z<Right>` | scroll screen N characters to left |
| `z+` | cursor to screen top line N |
| `z-` | cursor to screen bottom line N |
| `z.` | cursor line to center |
| `z<CR>` | cursor line to top |
| `z=` | spelling suggestions |
| `zA` | toggle folds recursively |
| `zC` | close folds recursively |
| `zD` | delete folds recursively |
| `zE` | eliminate all folds |
| `zF` | create a fold for N lines |
| `zG` | mark good spelled(update internal-wordlist) |
| `zH` | scroll half a screenwidth to the right |
| `zL` | scroll half a screenwidth to the left |
| `zM` | set `foldlevel` to zero |
| `zN` | set `foldenable` |
| `zO` | open folds recursively |
| `zR` | set `foldlevel` to deepest fold |
| `zW` | mark wrong spelled |
| `zX` | re-apply `foldleve` |
| `z^` | cursor to screen bottom line N |
| `za` | toggle a fold |
| `zb` | redraw, cursor line at bottom |
| `zc` | close a fold |
| `zd` | delete a fold |
| `ze` | right scroll horizontally to cursor position |
| `zf` | create a fold for motion |
| `zg` | mark good spelled |
| `zh` | scroll screen N characters to right |
| `zi` | toggle foldenable |
| `zj` | mode to start of next fold |
| `zk` | mode to end of previous fold |
| `zl` | scroll screen N characters to left |
| `zm` | subtract one from `foldlevel` |
| `zn` | reset `foldenable` |
| `zo` | open fold |
| `zr` | add one to `foldlevel` |
| `zs` | left scroll horizontally to cursor position |
| `zt` | cursor line at top of window |
| `zv` | open enough folds to view cursor line |
| `zx` | re-apply foldlevel and do "zV" |
| `zz` | smart scroll |
| `z<Left>` | scroll screen N characters to right |
\| ----------- \| -------------------------------------------- \|
\| `z<Right>` | scroll screen N characters to left |
\| `z+` | cursor to screen top line N |
\| `z-` | cursor to screen bottom line N |
\| `z.` | cursor line to center |
\| `z<CR>` | cursor line to top |
\| `z=` | spelling suggestions |
\| `zA` | toggle folds recursively |
\| `zC` | close folds recursively |
\| `zD` | delete folds recursively |
\| `zE` | eliminate all folds |
\| `zF` | create a fold for N lines |
\| `zG` | mark good spelled(update internal-wordlist) |
\| `zH` | scroll half a screenwidth to the right |
\| `zL` | scroll half a screenwidth to the left |
\| `zM` | set `foldlevel` to zero |
\| `zN` | set `foldenable` \|
\| `zO` | open folds recursively |
\| `zR` | set `foldlevel` to deepest fold |
\| `zW` | mark wrong spelled |
\| `zX` | re-apply `foldleve` \|
\| `z^` | cursor to screen bottom line N |
\| `za` | toggle a fold |
\| `zb` | redraw, cursor line at bottom |
\| `zc` | close a fold |
\| `zd` | delete a fold |
\| `ze` | right scroll horizontally to cursor position |
\| `zf` | create a fold for motion |
\| `zg` | mark good spelled |
\| `zh` | scroll screen N characters to right |
\| `zi` | toggle foldenable |
\| `zj` | mode to start of next fold |
\| `zk` | mode to end of previous fold |
\| `zl` | scroll screen N characters to left |
\| `zm` | subtract one from `foldlevel` \|
\| `zn` | reset `foldenable` \|
\| `zo` | open fold |
\| `zr` | add one to `foldlevel` \|
\| `zs` | left scroll horizontally to cursor position |
\| `zt` | cursor line at top of window |
\| `zv` | open enough folds to view cursor line |
\| `zx` | re-apply foldlevel and do "zV" |
\| `zz` | smart scroll |
\| `z<Left>` | scroll screen N characters to right |
### 自动保存
### 自动保存
### 搜索
@ -1091,8 +1091,8 @@ Notes:
- 如果使用源代码管理的话 `rg`, `ag``pt` 都会被忽略掉, 但是他们可以在任意目录中正常运行.
- 也可以通过将它们标记在联合缓冲区来一次搜索多个目录.
**注意** 如果你使用 `pt`, [TCL parser tools](https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/apps/pt.html)
同时也需要安装一个名叫 `pt` 的命令行工具.
**注意** 如果你使用 `pt`, [TCL parser tools](https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/apps/pt.html)
同时也需要安装一个名叫 `pt` 的命令行工具.
##### 常用按键绑定
@ -1206,7 +1206,7 @@ Notes:
FlyGrep 缓冲区的按键绑定:
Key Binding Description
\-----------\ | -----------
\-----------\\ | -----------
`<Esc>` | close FlyGrep buffer
`<Enter>` | open file at the cursor line
`<Tab>` | move cursor line down
@ -1226,6 +1226,7 @@ SPaceVim 使用 `g:spacevim_search_highlight_persist` 保持当前搜索结果
### 编辑
#### 粘贴文本
##### 粘贴文本自动缩进
#### 文本操作命令
@ -1382,9 +1383,9 @@ SpaceVim 中的工程通过 vim-projectionisst 和 vim-rooter 进行管理. 当
<!-- SpaceVim Achievements start -->
## 成就
## 成就
### 错误
### 错误
| Achievements | Account |
| --------------------------------------------------------------------- | ------------------------------------------- |
@ -1404,7 +1405,7 @@ SpaceVim 中的工程通过 vim-projectionisst 和 vim-rooter 进行管理. 当
## 特性
### 优雅的用户界面
### 优雅的用户界面
- outline + filemanager + checker
@ -1423,13 +1424,13 @@ SpaceVim 中的工程通过 vim-projectionisst 和 vim-rooter 进行管理. 当
| <kbd>SPC b</kbd> | +buffers |
| <kbd>SPC 1...9</kbd> | windows 1...9 |
## 特定语言模式
## 特定语言模式
## 按键导航
<iframe width='853' height='480' src='https://embed.coggle.it/diagram/WMlKuKS0uwABF2j1/a35e36df1d64e7b4f5fd7f956bf97a16b194cadb92d82d83e25aaf489349b0d8' frameborder='0' allowfullscreen></iframe>
### c/c++ 支持
### c/c++ 支持
1. 代码自动补全: 自动补全和模糊匹配.
![completion-fuzzy-match](https://cloud.githubusercontent.com/assets/13142418/22505960/df9068de-e8b8-11e6-943e-d79ceca095f1.png)
@ -1480,7 +1481,6 @@ Vim 的本地初始 leader 可以在任意模块中使用.
窗口函数 lea 只能在普通模式下使用
导航键列表在下面的链接中 [link](#窗口管理)
### 联合工作流程 leader
联合工作流程 learder 只能在普通模式下使用. 联合 leader 需要 联合组.
@ -1495,7 +1495,7 @@ Vim 的本地初始 leader 可以在任意模块中使用.
- 列出所有导航键及其描述: `f<space>`
![2017-02-01_1359x723](https://cloud.githubusercontent.com/assets/13142418/22507351/24af0d74-e8c0-11e6-985e-4a1404b629ed.png)
-列出所有 github.com 上已进行更新的插件, 模糊查找并打开对应的插件仓库. 默认按键为 `<leader>ls`
\-列出所有 github.com 上已进行更新的插件, 模糊查找并打开对应的插件仓库. 默认按键为 `<leader>ls`
![2017-02-01_1359x722](https://cloud.githubusercontent.com/assets/13142418/22506915/deb99caa-e8bd-11e6-9b80-316281ddb48c.png)
#### 插件亮点
@ -1813,6 +1813,7 @@ SpaceVim 拥有普通模式的导航键 <kbd>q</kbd> 作为智能关闭缓冲区
上面的列表是SpaceVim的书签列表导航键, 所以你不能使用`a`, `m`, `n`, `p` 或者 `i` 来标记当前位置寄存器,
但是其他的寄存器不受此限制. 如果你确实需要这些寄存器的话, 你可以添加 `nnoremap <leader>m m`
在你的默认配置文件中, 然后你就可以使用`a` 来管理 `\ma`.
##### Plugin: Gina/Gita
| Key | Mode | Action |

View File

@ -850,29 +850,29 @@ Similar to easymotion or `f` in vimperator for firefox, this mode allows one to
#### Unimpaired bindings
| Mappings | Description |
| -------- | -------------------------------- |
| `[ SPC` | Insert space above |
| `] SPC` | Insert space below |
| `[ b` | Go to previous buffer |
| `] b` | Go to next buffer |
| `[ f` | Go to previous file in directory |
| `] f` | Go to next file in directory |
| `[ l` | Go to the previous error |
| `] l` | Go to the next error |
| `[ c` | Go to the previous vcs hunk |
| `] c` | Go to the next vcs hunk |
| `[ q` | Go to the previous error |
| `] q` | Go to the next error |
| `[ t` | Go to the previous frame |
| `] t` | Go to the next frame |
| `[ w` | Go to the previous window |
| `] w` | Go to the next window |
| `[ e` | Move line up |
| `] e` | Move line down |
| `[ p` | Paste above current line |
| `] p` | Paste below current line |
| `g p` | Select pasted text |
| Mappings | Description |
| -------- | ------------------------------------------------------- |
| `[ SPC` | Insert space above |
| `] SPC` | Insert space below |
| `[ b` | Go to previous buffer |
| `] b` | Go to next buffer |
| `[ f` | Go to previous file in directory |
| `] f` | Go to next file in directory |
| `[ l` | Go to the previous error |
| `] l` | Go to the next error |
| `[ c` | Go to the previous vcs hunk (need VersionControl layer) |
| `] c` | Go to the next vcs hunk (need VersionControl layer) |
| `[ q` | Go to the previous error |
| `] q` | Go to the next error |
| `[ t` | Go to the previous frame |
| `] t` | Go to the next frame |
| `[ w` | Go to the previous window |
| `] w` | Go to the next window |
| `[ e` | Move line up |
| `] e` | Move line down |
| `[ p` | Paste above current line |
| `] p` | Paste below current line |
| `g p` | Select pasted text |
#### Jumping, Joining and Splitting

View File

@ -0,0 +1,53 @@
---
title: "SpaceVim VersionControl layer"
description: "This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc…"
---
# [SpaceVim Layers:](https://spacevim.org/layers) VersionControl
<!-- vim-markdown-toc GFM -->
- [Intro](#intro)
- [Features](#features)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
## Intro
This layer provides general function for version control. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc…
## Features
- Show a diff using Vim its sign column
- Show vcs info on statusline
## Key bindings
| Key Binding | Description |
| ----------- | ------------------------------- |
| `SPC g .` | version control transient-state |
**Version Control Transient-state**
| Key Binding | Description |
| ----------- | ---------------------------- |
| `w` | Stage file |
| `u` | Unstage file |
| `n` | next hunk |
| `N/p` | previous hunk |
| `t` | toggle diff signs |
| `l` | Show repo log |
| `D` | Show diffs of unstaged hunks |
| `f` | Fetch for repo with popup |
| `F` | Pull repo with popup |
| `P` | Push repo with popup |
| `c` | Commit with popup |
| `C` | Commit |
**Unimpaired bindings**
| Key Binding | Description |
| ----------- | --------------------------- |
| `[ c` | Go to the previous vcs hunk |
| `] c` | Go to the next vcs hunk |