Provide ignoring maps
Closes https://github.com/tpope/vim-fugitive/issues/235
This commit is contained in:
parent
2bfb6e9889
commit
d90e912e46
@ -1821,6 +1821,8 @@ function! fugitive#BufReadStatus() abort
|
||||
xnoremap <buffer> <silent> g<Bar> :<C-U>echoerr 'Changed to X'<CR>
|
||||
nnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line('.'), 0, v:count)<CR>
|
||||
xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"), line("'>"), v:count)<CR>
|
||||
nnoremap <buffer> <silent> gI :<C-U>execute <SID>StageIgnore(line('.'), line('.'), v:count)<CR>
|
||||
xnoremap <buffer> <silent> gI :<C-U>execute <SID>StageIgnore(line("'<"), line("'>"), v:count)<CR>
|
||||
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>
|
||||
@ -2854,6 +2856,23 @@ function! s:StageDelete(lnum1, lnum2, count) abort
|
||||
\ string('To restore, :Gedit ' . info.relative[0] . '|Gread ' . hash[0:6])
|
||||
endfunction
|
||||
|
||||
function! s:StageIgnore(lnum1, lnum2, count) abort
|
||||
let paths = []
|
||||
for info in s:Selection(a:lnum1, a:lnum2)
|
||||
call extend(paths, info.relative)
|
||||
endfor
|
||||
call map(paths, '"/" . v:val')
|
||||
exe 'Gsplit' (a:count ? '.gitignore' : '.git/info/exclude')
|
||||
let last = line('$')
|
||||
if last == 1 && empty(getline(1))
|
||||
call setline(last, paths)
|
||||
else
|
||||
call append(last, paths)
|
||||
exe last + 1
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:DoToggleHeadHeader(value) abort
|
||||
exe 'edit' s:fnameescape(s:Dir())
|
||||
call search('\C^index$', 'wc')
|
||||
@ -4881,6 +4900,7 @@ function! fugitive#MapJumps(...) abort
|
||||
nnoremap <buffer> <silent> cp :<C-U>echoerr 'Use gC'<CR>
|
||||
nnoremap <buffer> <silent> gC :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
||||
nnoremap <buffer> <silent> gc :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
||||
nnoremap <buffer> <silent> gi :<C-U>exe 'Gsplit' (v:count ? '.gitignore' : '.git/info/exclude')<CR>
|
||||
|
||||
nnoremap <buffer> c- :Gcommit -
|
||||
nnoremap <buffer> c<Space> :Gcommit<Space>
|
||||
|
@ -270,6 +270,10 @@ X Discard the change under the cursor. This uses
|
||||
*fugitive_<*
|
||||
< Remove the inline diff of the file under the cursor.
|
||||
|
||||
*fugitive_gI*
|
||||
gI Open .git/info/exclude in a split and add the file
|
||||
under the cursor. Use a count to open .gitignore.
|
||||
|
||||
P Invoke |:Git| add --patch or reset --patch on the file
|
||||
under the cursor. On untracked files, this instead
|
||||
calls |:Git| add --intent-to-add.
|
||||
@ -352,6 +356,10 @@ gP Jump to "Unpulled" section.
|
||||
*fugitive_gr*
|
||||
gr Jump to "Rebasing" section.
|
||||
|
||||
*fugitive_gi*
|
||||
gi Open .git/info/exclude in a split. Use a count to
|
||||
open .gitignore.
|
||||
|
||||
*fugitive_c*
|
||||
Commit mappings ~
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user