Retool :Gblame close map
This commit is contained in:
parent
1260de3b7d
commit
206b54a147
@ -2077,7 +2077,7 @@ function! s:SetupTemp(file) abort
|
|||||||
setlocal buftype=nowrite
|
setlocal buftype=nowrite
|
||||||
setlocal nomodeline
|
setlocal nomodeline
|
||||||
if empty(mapcheck('q', 'n'))
|
if empty(mapcheck('q', 'n'))
|
||||||
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
|
nnoremap <buffer> <silent> q :<C-U>bdelete<Bar>echohl WarningMsg<Bar>echo "Temp file q is deprecated in favor of the built-in <Lt>C-W>q"<Bar>echohl NONE<CR>
|
||||||
endif
|
endif
|
||||||
exe 'nnoremap <buffer> <silent>' s:nowait "gq :<C-U>bdelete<CR>"
|
exe 'nnoremap <buffer> <silent>' s:nowait "gq :<C-U>bdelete<CR>"
|
||||||
if getline(1) !~# '^diff '
|
if getline(1) !~# '^diff '
|
||||||
@ -4568,9 +4568,30 @@ function! s:linechars(pattern) abort
|
|||||||
return chars
|
return chars
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort
|
function! s:BlameLeave() abort
|
||||||
if exists('b:fugitive_blamed_bufnr')
|
let bufwinnr = bufwinnr(get(b:, 'fugitive_blamed_bufnr', -1))
|
||||||
|
if bufwinnr > 0
|
||||||
|
let bufnr = bufnr('')
|
||||||
|
exe bufwinnr . 'wincmd w'
|
||||||
|
return bufnr . 'bdelete'
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:BlameQuit() abort
|
||||||
|
let cmd = s:BlameLeave()
|
||||||
|
if empty(cmd)
|
||||||
return 'bdelete'
|
return 'bdelete'
|
||||||
|
elseif len(s:DirCommitFile(@%)[1])
|
||||||
|
return cmd . '|Gedit'
|
||||||
|
else
|
||||||
|
return cmd
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort
|
||||||
|
if exists('b:fugitive_blame_arguments')
|
||||||
|
return substitute(s:BlameLeave(), '^$', 'bdelete', '')
|
||||||
endif
|
endif
|
||||||
exe s:DirCheck()
|
exe s:DirCheck()
|
||||||
try
|
try
|
||||||
@ -4656,18 +4677,17 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
|||||||
setlocal norelativenumber
|
setlocal norelativenumber
|
||||||
endif
|
endif
|
||||||
execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1)
|
execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1)
|
||||||
let nowait = v:version >= 704 ? '<nowait>' : ''
|
|
||||||
nnoremap <buffer> <silent> <F1> :help fugitive-:Gblame<CR>
|
nnoremap <buffer> <silent> <F1> :help fugitive-:Gblame<CR>
|
||||||
nnoremap <buffer> <silent> g? :help fugitive-:Gblame<CR>
|
nnoremap <buffer> <silent> g? :help fugitive-:Gblame<CR>
|
||||||
if empty(mapcheck('q', 'n'))
|
if mapcheck('q', 'n') =~# '^$\|bdelete'
|
||||||
nnoremap <buffer> <silent> q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>'.bufnr('').'bdelete','^-1','','')<CR>
|
nnoremap <buffer> <silent> q :exe <SID>BlameQuit()<Bar>echohl WarningMsg<Bar>echo ":Gblame q is deprecated in favor of gq"<Bar>echohl NONE<CR>
|
||||||
endif
|
endif
|
||||||
exe 'nnoremap <buffer> <silent>' s:nowait "gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>'.bufnr('').'bdelete<Bar>if expand(''%:p'') =~# ''^fugitive:[\\/][\\/]''<Bar>Gedit<Bar>endif','^-1','','')<CR>"
|
exe 'nnoremap <buffer> <silent>' s:nowait "gq :exe <SID>BlameQuit()<CR>"
|
||||||
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>BlameCommit("exe 'norm gq'<Bar>edit")<CR>
|
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>
|
||||||
nnoremap <buffer> <silent> - :<C-U>exe <SID>BlameJump('')<CR>
|
nnoremap <buffer> <silent> - :<C-U>exe <SID>BlameJump('')<CR>
|
||||||
nnoremap <buffer> <silent> P :<C-U>exe <SID>BlameJump('^'.v:count1)<CR>
|
nnoremap <buffer> <silent> P :<C-U>exe <SID>BlameJump('^'.v:count1)<CR>
|
||||||
nnoremap <buffer> <silent> ~ :<C-U>exe <SID>BlameJump('~'.v:count1)<CR>
|
nnoremap <buffer> <silent> ~ :<C-U>exe <SID>BlameJump('~'.v:count1)<CR>
|
||||||
nnoremap <buffer> <silent> i :<C-U>exe <SID>BlameCommit("exe 'norm q'<Bar>edit")<CR>
|
nnoremap <buffer> <silent> i :<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>
|
||||||
nnoremap <buffer> <silent> o :<C-U>exe <SID>BlameCommit((&splitbelow ? "botright" : "topleft")." split")<CR>
|
nnoremap <buffer> <silent> o :<C-U>exe <SID>BlameCommit((&splitbelow ? "botright" : "topleft")." split")<CR>
|
||||||
nnoremap <buffer> <silent> O :<C-U>exe <SID>BlameCommit("tabedit")<CR>
|
nnoremap <buffer> <silent> O :<C-U>exe <SID>BlameCommit("tabedit")<CR>
|
||||||
nnoremap <buffer> <silent> p :<C-U>exe <SID>Open((&splitbelow ? "botright" : "topleft").' pedit', 0, '', matchstr(getline('.'), '\x\+'), [matchstr(getline('.'), '\x\+')])<CR>
|
nnoremap <buffer> <silent> p :<C-U>exe <SID>Open((&splitbelow ? "botright" : "topleft").' pedit', 0, '', matchstr(getline('.'), '\x\+'), [matchstr(getline('.'), '\x\+')])<CR>
|
||||||
|
Loading…
Reference in New Issue
Block a user