1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2018-07-30 23:18:16 +02:00
parent 46f1a1bd52
commit 587a185a98
89 changed files with 2619 additions and 1634 deletions

File diff suppressed because it is too large Load Diff

View File

@ -199,11 +199,7 @@ that are part of Git repositories).
*fugitive-:Gmove*
:Gmove {destination} Wrapper around git-mv that renames the buffer
afterward. The destination is relative to the current
directory except when started with a /, in which case
it is relative to the work tree. (This is a holdover
from before |:Grename| and will be removed.) Add a !
to pass -f.
afterward. Add a ! to pass -f.
*fugitive-:Grename*
:Grename {destination} Like |:Gmove| but operates relative to the parent
@ -234,12 +230,11 @@ that are part of Git repositories).
<CR> q, then open commit
o open commit in horizontal split
O open commit in new tab
p open commit in preview window
- reblame at commit
~ reblame at [count]th first grandparent
P reblame at [count]th parent (like HEAD^[count])
:[range]Gblame [flags] Run git-blame on the given range.
*fugitive-:Gbrowse*
:Gbrowse Open the current file, blob, tree, commit, or tag
in your browser at the upstream hosting provider.
@ -251,12 +246,6 @@ that are part of Git repositories).
supported by installing rhubarb.vim, available at
<https://github.com/tpope/vim-rhubarb>.
The hosting provider is determined by looking at the
remote for the current or specified branch and falls
back to "origin". In the special case of a "."
remote, a local instance of git-instaweb will be
started and used.
:Gbrowse {revision} Like :Gbrowse, but for a given |fugitive-revision|. A
useful value here is -, which ties the URL to the
latest commit rather than a volatile branch.
@ -334,19 +323,19 @@ refs/heads/x .git/refs/heads/x
@ The commit referenced by @ aka HEAD
master^ The parent of the commit referenced by master
master: The tree referenced by master
/master The file named master in the work tree
./master The file named master in the work tree
Makefile The file named Makefile in the work tree
@^:Makefile The file named Makefile in the parent of HEAD
:Makefile The file named Makefile in the index (writable)
@:% The current file in HEAD
- The current file in HEAD
^ The current file in the previous commit
~3 The current file 3 commits ago
: .git/index (Same as |:Gstatus|)
:0 The current file in the index
:1 The current file's common ancestor during a conflict
:2 The current file in the target branch during a conflict
:3 The current file in the merged branch during a conflict
:/foo The most recent commit with "foo" in the message
:% The current file in the index
:1:% The current file's common ancestor during a conflict
:2:% The current file in the target branch during a conflict
:3:% The current file in the merged branch during a conflict
STATUSLINE *fugitive-statusline*

View File

@ -16,6 +16,18 @@ function! s:shellslash(path) abort
endif
endfunction
function! FugitiveGitDir(...) abort
if !a:0 || a:1 ==# -1
return get(b:, 'git_dir', '')
elseif type(a:1) == type(0)
return getbufvar(a:1, 'git_dir')
elseif type(a:1) == type('')
return substitute(s:shellslash(a:1), '/$', '', '')
else
return ''
endif
endfunction
function! FugitiveIsGitDir(path) abort
let path = substitute(a:path, '[\/]$', '', '') . '/'
return getfsize(path.'HEAD') > 10 && (
@ -25,8 +37,8 @@ endfunction
let s:worktree_for_dir = {}
let s:dir_for_worktree = {}
function! FugitiveTreeForGitDir(git_dir) abort
let dir = substitute(s:shellslash(a:git_dir), '/$', '', '')
function! FugitiveWorkTree(...) abort
let dir = substitute(s:shellslash(a:0 ? a:1 : get(b:, 'git_dir', '')), '/$', '', '')
if dir =~# '/\.git$'
return len(dir) ==# 5 ? '/' : dir[0:-6]
endif
@ -57,6 +69,73 @@ function! FugitiveTreeForGitDir(git_dir) abort
endif
endfunction
function! FugitiveReal(...) abort
let file = a:0 ? a:1 : @%
if file =~? '^fugitive:' || a:0 > 1
return call('fugitive#Real', [file] + a:000[1:-1])
elseif file =~# '^/\|^\a\+:\|^$'
return file
else
return fnamemodify(file, ':p' . (file =~# '[\/]$' ? '' : ':s?[\/]$??'))
endif
endfunction
function! FugitivePath(...) abort
if a:0 > 1
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
else
return FugitiveReal(a:0 ? a:1 : @%)
endif
endfunction
function! FugitiveGenerate(...) abort
if a:0 && s:shellslash(a:0) =~# '^\%(\a\a\+:\)\=\%(a:\)\=/\|^[~$]'
return a:1
endif
return fugitive#repo(FugitiveGitDir(a:0 > 1 ? a:2 : -1)).translate(a:0 ? a:1 : '', 1)
endfunction
function! FugitiveRoute(...) abort
return call('FugitiveGenerate', a:000)
endfunction
function! FugitiveParse(...) abort
let path = s:shellslash(a:0 ? a:1 : @%)
let vals = matchlist(path, '\c^fugitive:\%(//\)\=\(.\{-\}\)\%(//\|::\)\(\x\{40\}\|[0-3]\)\(/.*\)\=$')
if len(vals)
return [(vals[2] =~# '^.$' ? ':' : '') . vals[2] . substitute(vals[3], '^/', ':', ''), vals[1]]
endif
let v:errmsg = 'fugitive: invalid Fugitive URL ' . path
throw v:errmsg
endfunction
function! FugitiveConfig(key, ...) abort
return fugitive#Config(a:key, FugitiveGitDir(a:0 ? a:1 : -1))
endfunction
function! FugitiveRemoteUrl(...) abort
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1))
endfunction
function! FugitiveHead(...) abort
let dir = FugitiveGitDir(a:0 > 1 ? a:2 : -1)
if empty(dir)
return ''
endif
return fugitive#repo(dir).head(a:0 ? a:1 : 0)
endfunction
function! FugitiveStatusline(...) abort
if !exists('b:git_dir')
return ''
endif
return fugitive#Statusline()
endfunction
function! FugitiveTreeForGitDir(path) abort
return FugitiveWorkTree(a:path)
endfunction
function! FugitiveExtractGitDir(path) abort
let path = s:shellslash(a:path)
if path =~# '^fugitive:'
@ -66,6 +145,10 @@ function! FugitiveExtractGitDir(path) abort
else
let path = fnamemodify(path, ':p:h:s?/$??')
endif
let pre = substitute(matchstr(path, '^\a\a\+\ze:'), '^.', '\u&', '')
if len(pre) && exists('*' . pre . 'Real')
let path = s:shellslash({pre}Real(path))
endif
let root = resolve(path)
if root !=# path
silent! exe haslocaldir() ? 'lcd .' : 'cd .'
@ -82,7 +165,7 @@ function! FugitiveExtractGitDir(path) abort
return simplify(fnamemodify($GIT_DIR, ':p:s?[\/]$??'))
endif
if FugitiveIsGitDir($GIT_DIR)
call FugitiveTreeForGitDir(simplify(fnamemodify($GIT_DIR, ':p:s?[\/]$??')))
call FugitiveWorkTree(simplify(fnamemodify($GIT_DIR, ':p:s?[\/]$??')))
if has_key(s:dir_for_worktree, root)
return s:dir_for_worktree[root]
endif
@ -124,66 +207,50 @@ function! FugitiveDetect(path) abort
endif
endfunction
function! FugitiveStatusline(...) abort
if !exists('b:git_dir')
return ''
endif
return fugitive#Statusline()
endfunction
function! FugitiveHead(...) abort
if !exists('b:git_dir')
return ''
endif
return fugitive#repo().head(a:0 ? a:1 : 0)
endfunction
function! FugitivePath(...) abort
let file = fnamemodify(a:0 ? a:1 : @%, ':p')
if file =~? '^fugitive:'
return fugitive#Path(file)
else
return file
endif
endfunction
function! FugitiveReal(...) abort
return call('FugitivePath', a:000)
endfunction
augroup fugitive
autocmd!
autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand('%:p'))
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', @%), ':p'))
autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand('<amatch>:p'))
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<amatch>')), ':p'))
autocmd User NERDTreeInit,NERDTreeNewRoot
\ if exists('b:NERDTree.root.path.str') |
\ call FugitiveDetect(b:NERDTree.root.path.str()) |
\ endif
autocmd VimEnter * if expand('<amatch>')==''|call FugitiveDetect(getcwd())|endif
autocmd VimEnter * if empty(expand('<amatch>'))|call FugitiveDetect(getcwd())|endif
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#MapJumps() |
\ call fugitive#MapCfile() |
\ endif
autocmd FileType gitcommit
\ if exists('b:git_dir') |
\ call fugitive#MapCfile('fugitive#StatusCfile()') |
\ endif
autocmd FileType gitrebase
\ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' |
\ if exists('b:git_dir') |
\ let &l:includeexpr = 'v:fname =~# ''^\x\{4,40\}$'' ? FugitiveGenerate(v:fname) : ' .
\ (len(&l:includeexpr) ? &l:includeexpr : 'v:fname') |
\ endif |
\ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc='
autocmd BufReadCmd index{,.lock}
autocmd BufReadCmd index{,.lock}
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
\ let b:git_dir = s:shellslash(expand('<amatch>:p:h')) |
\ exe fugitive#BufReadStatus() |
\ elseif filereadable(expand('<amatch>')) |
\ read <amatch> |
\ 1delete |
\ 1delete_ |
\ endif
autocmd FileReadCmd fugitive://**//[0-3]/** exe fugitive#FileRead()
autocmd BufReadCmd fugitive://**//[0-3]/** exe fugitive#BufReadIndex()
autocmd BufWriteCmd fugitive://**//[0-3]/** exe fugitive#BufWriteIndex()
autocmd BufReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe fugitive#BufReadObject()
autocmd FileReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe fugitive#FileRead()
autocmd BufReadCmd fugitive://*//* exe fugitive#BufReadCmd()
autocmd BufWriteCmd fugitive://*//[0-3]/* exe fugitive#BufWriteCmd()
autocmd FileReadCmd fugitive://*//* exe fugitive#FileReadCmd()
autocmd FileWriteCmd fugitive://*//[0-3]/* exe fugitive#FileWriteCmd()
if exists('##SourceCmd')
autocmd SourceCmd fugitive://*//* nested exe fugitive#SourceCmd()
endif
autocmd User Flags call Hoist('buffer', function('FugitiveStatusline'))
augroup END