3 Commits

Author SHA1 Message Date
Tama McGlinn
eb5268c7fa Merge 29075ed079 into b068eaf1e6 2025-02-06 20:44:55 +08:00
Tim Pope
b068eaf1e6 Drop */# maps in visual mode
Resolves: https://github.com/tpope/vim-fugitive/issues/2374
2025-02-02 23:33:54 -05:00
Tama McGlinn
29075ed079 Allow X on section headers
This reversibly throws away the changes.

Fixes #2063
2022-10-13 08:27:58 +02:00

View File

@@ -5079,7 +5079,17 @@ function! s:StageDelete(lnum1, lnum2, count) abort
let did_conflict_err = 0
let reset_commit = matchstr(getline(a:lnum1), '^Un\w\+ \%(to\| from\) \zs\S\+')
try
for info in s:Selection(a:lnum1, a:lnum2)
let selection=s:Selection(a:lnum1, a:lnum2)
if empty(selection)
" if empty, check if we were on a section header
let first_line = getline(a:lnum1)
if first_line =~# '^\(\|Staged\|Unstaged\|Untracked\) ([0-9]*)$'
let end_of_section = search('^$', 'n')
" if so, select the whole section
let selection=s:Selection(a:lnum1+1, end_of_section)
endif
endif
for info in selection
if empty(info.paths)
if len(info.commit)
let reset_commit = info.commit . '^'
@@ -8030,8 +8040,8 @@ function! fugitive#MapJumps(...) abort
call s:MapMotion(']]', 'exe <SID>NextSection(v:count1)')
call s:MapMotion('[]', 'exe <SID>PreviousSectionEnd(v:count1)')
call s:MapMotion('][', 'exe <SID>NextSectionEnd(v:count1)')
call s:Map('nxo', '*', '<SID>PatchSearchExpr(0)', '<expr>')
call s:Map('nxo', '#', '<SID>PatchSearchExpr(1)', '<expr>')
call s:Map('no', '*', '<SID>PatchSearchExpr(0)', '<expr>')
call s:Map('no', '#', '<SID>PatchSearchExpr(1)', '<expr>')
endif
call s:Map('n', 'S', ':<C-U>echoerr "Use gO"<CR>', '<silent><unique>')
call s:Map('n', 'dq', ":<C-U>call fugitive#DiffClose()<CR>", '<silent>')