Support "." in visual mode

This commit is contained in:
Tim Pope
2019-02-18 17:28:49 -05:00
parent 26cf153e76
commit 654f7f5432

View File

@@ -1562,7 +1562,8 @@ function! fugitive#BufReadStatus() abort
xnoremap <buffer> <silent> g<Bar> :<C-U>execute <SID>StageDelete(line("'<"),line("'>")-line("'<")+1)<CR> xnoremap <buffer> <silent> g<Bar> :<C-U>execute <SID>StageDelete(line("'<"),line("'>")-line("'<")+1)<CR>
nnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line('.'),v:count)<CR> nnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line('.'),v:count)<CR>
xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"),line("'>")-line("'<")+1)<CR> xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"),line("'>")-line("'<")+1)<CR>
nnoremap <buffer> . : <C-R>=<SID>fnameescape(get(<SID>StatusCfile(),0,''))<CR><Home> nnoremap <buffer> . :<C-U> <C-R>=<SID>StageArgs(0)<CR><Home>
xnoremap <buffer> . :<C-U> <C-R>=<SID>StageArgs(1)<CR><Home>
nnoremap <buffer> <silent> <F1> :help fugitive-mappings<CR> nnoremap <buffer> <silent> <F1> :help fugitive-mappings<CR>
set filetype=fugitive set filetype=fugitive
@@ -2165,6 +2166,21 @@ function! s:Selection(arg1, ...) abort
return results return results
endfunction endfunction
function! s:StageArgs(visual) abort
let commits = []
let paths = []
for record in s:Selection(a:visual ? 'v' : 'n')
if len(record.commit)
call add(commits, record.commit)
endif
call extend(paths, record.paths)
endfor
if s:cpath(s:Tree(), getcwd())
call map(paths, 'fugitive#Path(v:val, "./")')
endif
return join(map(commits + paths, 's:fnameescape(v:val)'), ' ')
endfunction
function! s:Do(action, visual) abort function! s:Do(action, visual) abort
let line = getline('.') let line = getline('.')
if !a:0 && !v:count && line =~# '^[A-Z][a-z]' if !a:0 && !v:count && line =~# '^[A-Z][a-z]'
@@ -4225,7 +4241,8 @@ function! fugitive#MapJumps(...) abort
nnoremap <buffer> <silent> rs :<C-U>Grebase --skip<CR> nnoremap <buffer> <silent> rs :<C-U>Grebase --skip<CR>
nnoremap <buffer> <silent> re :<C-U>Grebase --edit-todo<CR> nnoremap <buffer> <silent> re :<C-U>Grebase --edit-todo<CR>
nnoremap <buffer> <silent> ra :<C-U>Grebase --abort<CR> nnoremap <buffer> <silent> ra :<C-U>Grebase --abort<CR>
nmap <buffer> . <SID>: <Plug><cfile><Home> nnoremap <buffer> . :<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>
xnoremap <buffer> . :<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>
nnoremap <buffer> <silent> g? :help fugitive-mappings<CR> nnoremap <buffer> <silent> g? :help fugitive-mappings<CR>
endif endif
endfunction endfunction