motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit d90e912e46b4a294576dd2187a560e22cbdb306a (tree)
parent 2bfb6e98899f5efc133f5162d254f0b6ee817599
Author: Tim Pope <code@tpope.net>
Date:   Tue, 23 Jul 2019 20:42:34 -0400

Provide ignoring maps

Closes https://github.com/tpope/vim-fugitive/issues/235

Diffstat:
Mautoload/fugitive.vim | 20++++++++++++++++++++
Mdoc/fugitive.txt | 8++++++++
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -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> diff --git a/doc/fugitive.txt b/doc/fugitive.txt @@ -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 ~