mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
Fix load order issue setting up maps
References https://github.com/tpope/vim-fugitive/issues/1044
This commit is contained in:
@@ -2526,7 +2526,7 @@ function! fugitive#BufReadStatus() abort
|
|||||||
if &bufhidden ==# ''
|
if &bufhidden ==# ''
|
||||||
setlocal bufhidden=delete
|
setlocal bufhidden=delete
|
||||||
endif
|
endif
|
||||||
call s:JumpInit()
|
call fugitive#MapJumps()
|
||||||
nunmap <buffer> P
|
nunmap <buffer> P
|
||||||
nunmap <buffer> ~
|
nunmap <buffer> ~
|
||||||
nnoremap <buffer> <silent> <C-N> :<C-U>execute <SID>StageNext(v:count1)<CR>
|
nnoremap <buffer> <silent> <C-N> :<C-U>execute <SID>StageNext(v:count1)<CR>
|
||||||
@@ -2707,7 +2707,7 @@ function! fugitive#BufReadObject() abort
|
|||||||
nnoremap <buffer> <silent> a :<C-U>let b:fugitive_display_format += v:count1<Bar>exe <SID>BufReadObject()<CR>
|
nnoremap <buffer> <silent> a :<C-U>let b:fugitive_display_format += v:count1<Bar>exe <SID>BufReadObject()<CR>
|
||||||
nnoremap <buffer> <silent> i :<C-U>let b:fugitive_display_format -= v:count1<Bar>exe <SID>BufReadObject()<CR>
|
nnoremap <buffer> <silent> i :<C-U>let b:fugitive_display_format -= v:count1<Bar>exe <SID>BufReadObject()<CR>
|
||||||
else
|
else
|
||||||
call s:JumpInit()
|
call fugitive#MapJumps()
|
||||||
endif
|
endif
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
@@ -2721,14 +2721,6 @@ endfunction
|
|||||||
|
|
||||||
augroup fugitive_files
|
augroup fugitive_files
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType git
|
|
||||||
\ if exists('b:git_dir') |
|
|
||||||
\ call s:JumpInit() |
|
|
||||||
\ endif
|
|
||||||
autocmd FileType git,gitcommit,gitrebase
|
|
||||||
\ if exists('b:git_dir') |
|
|
||||||
\ call s:GFInit() |
|
|
||||||
\ endif
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Section: Temp files
|
" Section: Temp files
|
||||||
@@ -2753,7 +2745,7 @@ augroup END
|
|||||||
" Section: Go to file
|
" Section: Go to file
|
||||||
|
|
||||||
nnoremap <SID>: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
nnoremap <SID>: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
||||||
function! s:GFInit(...) abort
|
function! fugitive#MapCfile(...) abort
|
||||||
cnoremap <buffer> <expr> <Plug><cfile> fugitive#Cfile()
|
cnoremap <buffer> <expr> <Plug><cfile> fugitive#Cfile()
|
||||||
if !exists('g:fugitive_no_maps')
|
if !exists('g:fugitive_no_maps')
|
||||||
call s:map('n', 'gf', '<SID>:find <Plug><cfile><CR>', '<silent><unique>')
|
call s:map('n', 'gf', '<SID>:find <Plug><cfile><CR>', '<silent><unique>')
|
||||||
@@ -2764,7 +2756,7 @@ function! s:GFInit(...) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:JumpInit(...) abort
|
function! fugitive#MapJumps(...) abort
|
||||||
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>GF("edit")<CR>
|
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>GF("edit")<CR>
|
||||||
if !&modifiable
|
if !&modifiable
|
||||||
nnoremap <buffer> <silent> o :<C-U>exe <SID>GF("split")<CR>
|
nnoremap <buffer> <silent> o :<C-U>exe <SID>GF("split")<CR>
|
||||||
|
|||||||
@@ -156,6 +156,15 @@ augroup fugitive
|
|||||||
autocmd VimEnter * if expand('<amatch>')==''|call FugitiveDetect(getcwd())|endif
|
autocmd VimEnter * if expand('<amatch>')==''|call FugitiveDetect(getcwd())|endif
|
||||||
autocmd CmdWinEnter * call FugitiveDetect(expand('#:p'))
|
autocmd CmdWinEnter * call FugitiveDetect(expand('#:p'))
|
||||||
|
|
||||||
|
autocmd FileType git
|
||||||
|
\ if exists('b:git_dir') |
|
||||||
|
\ call fugitive#MapJumps() |
|
||||||
|
\ endif
|
||||||
|
autocmd FileType git,gitcommit,gitrebase
|
||||||
|
\ if exists('b:git_dir') |
|
||||||
|
\ call fugitive#MapCfile() |
|
||||||
|
\ endif
|
||||||
|
|
||||||
autocmd BufReadCmd index{,.lock}
|
autocmd BufReadCmd index{,.lock}
|
||||||
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
|
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
|
||||||
\ exe fugitive#BufReadStatus() |
|
\ exe fugitive#BufReadStatus() |
|
||||||
|
|||||||
Reference in New Issue
Block a user