mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -320,6 +320,8 @@ function! s:repo_translate(spec) dict abort
|
||||
return 'fugitive://'.self.dir().'//'.ref
|
||||
elseif a:spec =~# '^:'
|
||||
return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1]
|
||||
elseif a:spec ==# '@'
|
||||
return self.dir('HEAD')
|
||||
elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(self.dir(a:spec))
|
||||
return self.dir(a:spec)
|
||||
elseif filereadable(self.dir('refs/'.a:spec))
|
||||
@ -1258,7 +1260,7 @@ function! s:Grep(cmd,bang,arg) abort
|
||||
try
|
||||
execute cd.'`=s:repo().tree()`'
|
||||
let &grepprg = s:repo().git_command('--no-pager', 'grep', '-n', '--no-color')
|
||||
let &grepformat = '%f:%l:%m,%f'
|
||||
let &grepformat = '%f:%l:%m,%m %f match%ts,%f'
|
||||
exe a:cmd.'! '.escape(matchstr(a:arg,'\v\C.{-}%($|[''" ]\@=\|)@='),'|')
|
||||
let list = a:cmd =~# '^l' ? getloclist(0) : getqflist()
|
||||
for entry in list
|
||||
@ -1406,6 +1408,7 @@ function! s:Edit(cmd,bang,...) abort
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
endtry
|
||||
let file = s:sub(file, '/$', '')
|
||||
if a:cmd ==# 'read'
|
||||
return 'silent %delete_|read '.s:fnameescape(file).'|silent 1delete_|diffupdate|'.line('.')
|
||||
else
|
||||
@ -2175,7 +2178,7 @@ call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete G
|
||||
|
||||
function! s:Browse(bang,line1,count,...) abort
|
||||
try
|
||||
let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]*\%(://.\{-\}\)\=$','','') : ''
|
||||
let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]\w\+\%(://.\{-\}\)\=$','','') : ''
|
||||
if rev ==# ''
|
||||
let expanded = s:buffer().rev()
|
||||
elseif rev ==# ':'
|
||||
@ -2218,7 +2221,7 @@ function! s:Browse(bang,line1,count,...) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]*\%(://.\{-\}\)\=$'
|
||||
if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]\+\%(://.\{-\}\)\=$'
|
||||
let remote = matchstr(join(a:000, ' '),'@\zs[[:alnum:]_-]\+\%(://.\{-\}\)\=$')
|
||||
elseif path =~# '^\.git/refs/remotes/.'
|
||||
let remote = matchstr(path,'^\.git/refs/remotes/\zs[^/]\+')
|
||||
@ -2319,27 +2322,21 @@ function! s:github_url(opts, ...) abort
|
||||
return root . '/commits/' . branch
|
||||
endif
|
||||
elseif path =~# '^\.git/refs/tags/'
|
||||
return root . '/releases/tag/' . matchstr(path,'[^/]\+$')
|
||||
elseif path =~# '^\.git/refs/.'
|
||||
return root . '/commits/' . matchstr(path,'[^/]\+$')
|
||||
return root . '/releases/tag/' . path[15:-1]
|
||||
elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
|
||||
return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
|
||||
elseif path =~# '.git/\%(config$\|hooks\>\)'
|
||||
return root . '/admin'
|
||||
elseif path =~# '^\.git\>'
|
||||
return root
|
||||
endif
|
||||
if a:opts.revision =~# '^[[:alnum:]._-]\+:'
|
||||
let commit = matchstr(a:opts.revision,'^[^:]*')
|
||||
elseif a:opts.commit =~# '^\d\=$'
|
||||
let local = matchstr(a:opts.repo.head_ref(),'\<refs/heads/\zs.*')
|
||||
let commit = a:opts.repo.git_chomp('config','branch.'.local.'.merge')[11:-1]
|
||||
if commit ==# ''
|
||||
let commit = local
|
||||
endif
|
||||
if a:opts.commit =~# '^\d\=$'
|
||||
let commit = a:opts.repo.rev_parse('HEAD')
|
||||
else
|
||||
let commit = a:opts.commit
|
||||
endif
|
||||
if a:opts.type == 'tree'
|
||||
let url = s:sub(root . '/tree/' . commit . '/' . path,'/$','')
|
||||
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
|
||||
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
|
||||
elseif a:opts.type == 'blob'
|
||||
let url = root . '/blob/' . commit . '/' . path
|
||||
if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2
|
||||
@ -2372,10 +2369,8 @@ function! s:instaweb_url(opts) abort
|
||||
endif
|
||||
let url .= ';h=' . a:opts.repo.rev_parse(a:opts.commit . (a:opts.path == '' ? '' : ':' . a:opts.path))
|
||||
else
|
||||
if a:opts.type ==# 'blob'
|
||||
let tmp = tempname()
|
||||
silent execute 'write !'.a:opts.repo.git_command('hash-object','-w','--stdin').' > '.tmp
|
||||
let url .= ';h=' . readfile(tmp)[0]
|
||||
if a:opts.type ==# 'blob' && empty(a:opts.commit)
|
||||
let url .= ';h='.a:opts.repo.git_chomp('hash-object', '-w', a:opts.path)
|
||||
else
|
||||
try
|
||||
let url .= ';h=' . a:opts.repo.rev_parse((a:opts.commit == '' ? 'HEAD' : ':' . a:opts.commit) . ':' . a:opts.path)
|
||||
@ -2855,7 +2850,7 @@ function! s:cfile() abort
|
||||
elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW')
|
||||
let type = getline('.')[0]
|
||||
let lnum = line('.') - 1
|
||||
let offset = -1
|
||||
let offset = 0
|
||||
while getline(lnum) !~# '^@@ -\d\+,\d\+ +\d\+,'
|
||||
if getline(lnum) =~# '^[ '.type.']'
|
||||
let offset += 1
|
||||
|
Reference in New Issue
Block a user