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

Updated plugins

This commit is contained in:
Amir Salihefendic
2018-06-14 12:31:12 +02:00
parent 7288aee801
commit 3e3297af67
273 changed files with 11821 additions and 5377 deletions

View File

@ -16,6 +16,7 @@ endfunction
" Finds the file's path relative to the repo root.
function! gitgutter#init_buffer(bufnr)
if gitgutter#utility#is_active(a:bufnr)
call s:setup_maps()
let p = gitgutter#utility#repo_path(a:bufnr, 0)
if type(p) != s:t_string || empty(p)
call gitgutter#utility#set_repo_path(a:bufnr)
@ -81,6 +82,42 @@ endfunction
" }}}
function! s:setup_maps()
if !g:gitgutter_map_keys
return
endif
if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
nmap <buffer> [c <Plug>GitGutterPrevHunk
endif
if !hasmapto('<Plug>GitGutterNextHunk') && maparg(']c', 'n') ==# ''
nmap <buffer> ]c <Plug>GitGutterNextHunk
endif
if !hasmapto('<Plug>GitGutterStageHunk') && maparg('<Leader>hs', 'n') ==# ''
nmap <buffer> <Leader>hs <Plug>GitGutterStageHunk
endif
if !hasmapto('<Plug>GitGutterUndoHunk') && maparg('<Leader>hu', 'n') ==# ''
nmap <buffer> <Leader>hu <Plug>GitGutterUndoHunk
endif
if !hasmapto('<Plug>GitGutterPreviewHunk') && maparg('<Leader>hp', 'n') ==# ''
nmap <buffer> <Leader>hp <Plug>GitGutterPreviewHunk
endif
if !hasmapto('<Plug>GitGutterTextObjectInnerPending') && maparg('ic', 'o') ==# ''
omap <buffer> ic <Plug>GitGutterTextObjectInnerPending
endif
if !hasmapto('<Plug>GitGutterTextObjectOuterPending') && maparg('ac', 'o') ==# ''
omap <buffer> ac <Plug>GitGutterTextObjectOuterPending
endif
if !hasmapto('<Plug>GitGutterTextObjectInnerVisual') && maparg('ic', 'x') ==# ''
xmap <buffer> ic <Plug>GitGutterTextObjectInnerVisual
endif
if !hasmapto('<Plug>GitGutterTextObjectOuterVisual') && maparg('ac', 'x') ==# ''
xmap <buffer> ac <Plug>GitGutterTextObjectOuterVisual
endif
endfunction
function! s:has_fresh_changes(bufnr) abort
return getbufvar(a:bufnr, 'changedtick') != gitgutter#utility#getbufvar(a:bufnr, 'tick')
endfunction

View File

@ -1,5 +1,5 @@
function! gitgutter#utility#supports_overscore_sign()
if s:windows()
if gitgutter#utility#windows()
return &encoding ==? 'utf-8'
else
return &termencoding ==? &encoding || &termencoding == ''
@ -11,7 +11,7 @@ function! gitgutter#utility#setbufvar(buffer, varname, val)
let needs_setting = empty(dict)
let dict[a:varname] = a:val
if needs_setting
call setbufvar(a:buffer, 'gitgutter', dict)
call setbufvar(+a:buffer, 'gitgutter', dict)
endif
endfunction
@ -114,7 +114,7 @@ function! gitgutter#utility#set_repo_path(bufnr) abort
" * -2 - not tracked by git
call gitgutter#utility#setbufvar(a:bufnr, 'path', -1)
let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -- '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
if g:gitgutter_async && gitgutter#async#available()
if has('lambda')
@ -161,7 +161,7 @@ function! s:set_path(bufnr, path)
endfunction
function! gitgutter#utility#cd_cmd(bufnr, cmd) abort
let cd = s:unc_path(a:bufnr) ? 'pushd' : (s:windows() ? 'cd /d' : 'cd')
let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() ? 'cd /d' : 'cd')
return cd.' '.s:dir(a:bufnr).' && '.a:cmd
endfunction
@ -205,6 +205,6 @@ function! s:strip_trailing_new_line(line) abort
return substitute(a:line, '\n$', '', '')
endfunction
function! s:windows()
function! gitgutter#utility#windows()
return has('win64') || has('win32') || has('win16')
endfunction