mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-16 15:23:51 -05:00
Formatting fix
This commit is contained in:
@@ -108,7 +108,7 @@ function! fugitive#extract_git_dir(path) abort
|
|||||||
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
||||||
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
||||||
endif
|
endif
|
||||||
let root = s:shellslash(simplify(fnamemodify(a:path,':p:s?[\/]$??')))
|
let root = s:shellslash(simplify(fnamemodify(a:path, ':p:s?[\/]$??')))
|
||||||
let previous = ""
|
let previous = ""
|
||||||
while root !=# previous
|
while root !=# previous
|
||||||
let dir = s:sub(root, '[\/]$', '') . '/.git'
|
let dir = s:sub(root, '[\/]$', '') . '/.git'
|
||||||
@@ -126,7 +126,7 @@ function! fugitive#extract_git_dir(path) abort
|
|||||||
return root
|
return root
|
||||||
endif
|
endif
|
||||||
let previous = root
|
let previous = root
|
||||||
let root = fnamemodify(previous,':h')
|
let root = fnamemodify(root, ':h')
|
||||||
endwhile
|
endwhile
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
@@ -137,22 +137,22 @@ function! s:Detect(path)
|
|||||||
endif
|
endif
|
||||||
if !exists('b:git_dir')
|
if !exists('b:git_dir')
|
||||||
let dir = fugitive#extract_git_dir(a:path)
|
let dir = fugitive#extract_git_dir(a:path)
|
||||||
if dir != ''
|
if dir !=# ''
|
||||||
let b:git_dir = dir
|
let b:git_dir = dir
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if exists('b:git_dir')
|
if exists('b:git_dir')
|
||||||
silent doautocmd User Fugitive
|
silent doautocmd User Fugitive
|
||||||
cnoremap <buffer> <expr> <C-R><C-G> <SID>recall()
|
cnoremap <buffer> <expr> <C-R><C-G> <SID>recall()
|
||||||
nnoremap <buffer> <silent> y<C-G> :call setreg(v:register,<SID>recall())<CR>
|
nnoremap <buffer> <silent> y<C-G> :call setreg(v:register, <SID>recall())<CR>
|
||||||
let buffer = fugitive#buffer()
|
let buffer = fugitive#buffer()
|
||||||
if expand('%:p') =~# '//'
|
if expand('%:p') =~# '//'
|
||||||
call buffer.setvar('&path',s:sub(buffer.getvar('&path'),'^\.%(,|$)',''))
|
call buffer.setvar('&path', s:sub(buffer.getvar('&path'), '^\.%(,|$)', ''))
|
||||||
endif
|
endif
|
||||||
if stridx(buffer.getvar('&tags'),escape(b:git_dir.'/tags',', ')) == -1
|
if stridx(buffer.getvar('&tags'), escape(b:git_dir.'/tags', ', ')) == -1
|
||||||
call buffer.setvar('&tags',escape(b:git_dir.'/tags',', ').','.buffer.getvar('&tags'))
|
call buffer.setvar('&tags', escape(b:git_dir.'/tags', ', ').','.buffer.getvar('&tags'))
|
||||||
if &filetype != ''
|
if &filetype !=# ''
|
||||||
call buffer.setvar('&tags',escape(b:git_dir.'/'.&filetype.'.tags',', ').','.buffer.getvar('&tags'))
|
call buffer.setvar('&tags', escape(b:git_dir.'/'.&filetype.'.tags', ', ').','.buffer.getvar('&tags'))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -176,13 +176,13 @@ let s:repos = {}
|
|||||||
function! s:repo(...) abort
|
function! s:repo(...) abort
|
||||||
let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : fugitive#extract_git_dir(expand('%:p')))
|
let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : fugitive#extract_git_dir(expand('%:p')))
|
||||||
if dir !=# ''
|
if dir !=# ''
|
||||||
if has_key(s:repos,dir)
|
if has_key(s:repos, dir)
|
||||||
let repo = get(s:repos,dir)
|
let repo = get(s:repos, dir)
|
||||||
else
|
else
|
||||||
let repo = {'git_dir': dir}
|
let repo = {'git_dir': dir}
|
||||||
let s:repos[dir] = repo
|
let s:repos[dir] = repo
|
||||||
endif
|
endif
|
||||||
return extend(extend(repo,s:repo_prototype,'keep'),s:abstract_prototype,'keep')
|
return extend(extend(repo, s:repo_prototype, 'keep'), s:abstract_prototype, 'keep')
|
||||||
endif
|
endif
|
||||||
call s:throw('not a git repository: '.expand('%:p'))
|
call s:throw('not a git repository: '.expand('%:p'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user