mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Try split instead of preview window for :G
This commit is contained in:
@@ -1544,8 +1544,6 @@ function! fugitive#BufReadStatus() abort
|
||||
nnoremap <buffer> <silent> ds :<C-U>execute <SID>StageDiff('Gsdiff')<CR>
|
||||
nnoremap <buffer> <silent> dp :<C-U>execute <SID>StageDiffEdit()<CR>
|
||||
nnoremap <buffer> <silent> dv :<C-U>execute <SID>StageDiff('Gvdiff')<CR>
|
||||
nnoremap <buffer> <silent> p :<C-U>echoerr 'Use P'<CR>
|
||||
xnoremap <buffer> <silent> p :<C-U>echoerr 'Use P'<CR>
|
||||
nnoremap <buffer> <silent> P :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR>
|
||||
xnoremap <buffer> <silent> P :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
|
||||
nnoremap <buffer> <silent> q :<C-U>if bufnr('$') == 1<Bar>quit<Bar>else<Bar>bdelete<Bar>endif<CR>
|
||||
@@ -1557,6 +1555,7 @@ function! fugitive#BufReadStatus() abort
|
||||
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>
|
||||
nnoremap <buffer> . : <C-R>=<SID>fnameescape(get(<SID>StatusCfile(),0,''))<CR><Home>
|
||||
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
|
||||
nnoremap <buffer> <silent> g? :help fugitive-:Gstatus<CR>
|
||||
nnoremap <buffer> <silent> <F1> :help fugitive-:Gstatus<CR>
|
||||
|
||||
@@ -1890,10 +1889,29 @@ augroup END
|
||||
|
||||
function! s:Status(bang, count, mods) abort
|
||||
try
|
||||
exe (a:mods ==# '<mods>' ? '' : a:mods) 'Gpedit :'
|
||||
wincmd P
|
||||
setlocal foldmethod=syntax foldlevel=1 buftype=nowrite
|
||||
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
|
||||
let dir = b:git_dir
|
||||
let mods = a:mods ==# '<mods>' || empty(a:mods) ? 'leftabove' : a:mods
|
||||
let file = fugitive#Find(':')
|
||||
for winnr in range(1, winnr('$'))
|
||||
if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p'))
|
||||
exe winnr . 'wincmd w'
|
||||
let w:fugitive_status = dir
|
||||
return s:ReloadStatus()
|
||||
endif
|
||||
endfor
|
||||
let wide = winwidth(0) >= 160
|
||||
if a:count ==# 0
|
||||
exe mods 'Gedit :'
|
||||
elseif a:bang
|
||||
exe mods (a:count ==# -1 && wide ? 'vert' : '') 'Gpedit :'
|
||||
wincmd P
|
||||
elseif a:count ==# -1 && wide
|
||||
exe mods 'Gvsplit :'
|
||||
else
|
||||
exe mods a:count > 0 ? a:count : '' 'Gsplit :'
|
||||
endif
|
||||
let w:fugitive_status = dir
|
||||
setlocal foldmethod=syntax foldlevel=1
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
endtry
|
||||
@@ -2817,6 +2835,7 @@ endfunction
|
||||
|
||||
function! s:UsableWin(nr) abort
|
||||
return a:nr && !getwinvar(a:nr, '&previewwindow') &&
|
||||
\ empty(getwinvar(a:nr, 'fugitive_status')) &&
|
||||
\ index(['gitrebase', 'gitcommit'], getbufvar(winbufnr(a:nr), '&filetype')) < 0 &&
|
||||
\ index(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0
|
||||
endfunction
|
||||
@@ -2840,15 +2859,13 @@ function! s:EditParse(args) abort
|
||||
endfunction
|
||||
|
||||
function! s:BlurStatus() abort
|
||||
if &previewwindow && get(b:,'fugitive_type', '') ==# 'index'
|
||||
if &previewwindow && get(b:,'fugitive_type', '') ==# 'index' || exists('w:fugitive_status')
|
||||
let winnrs = filter([winnr('#')] + range(1, winnr('$')), 's:UsableWin(v:val)')
|
||||
if len(winnrs)
|
||||
exe winnrs[0].'wincmd w'
|
||||
elseif winnr('$') == 1
|
||||
let tabs = (&go =~# 'e' || !has('gui_running')) && &stal && (tabpagenr('$') >= &stal)
|
||||
execute 'rightbelow' (&lines - &previewheight - &cmdheight - tabs - 1 - !!&laststatus).'new'
|
||||
else
|
||||
rightbelow new
|
||||
let wide = winwidth(0) >= 160
|
||||
exe 'rightbelow' (winwidth(0) >= 160 ? 'vert' : '') 'new'
|
||||
endif
|
||||
if &diff
|
||||
let mywinnr = winnr()
|
||||
|
||||
Reference in New Issue
Block a user