-
Notifications
You must be signed in to change notification settings - Fork 0
/
signify.vim
43 lines (34 loc) · 1.7 KB
/
signify.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function UpdateVcsCmds()
let s:git_commit = printf('HEAD~%d', g:target_commit)
let g:signify_vcs_cmds.git = 'git diff --no-color --no-ext-diff -U0 -w ' .. s:git_commit .. ' -- %f'
let g:signify_vcs_cmds_diffmode.git = 'git show ' .. s:git_commit .. ':./%f'
let s:hg_commit = printf('.~%d', g:target_commit)
let g:signify_vcs_cmds.hg = 'hg diff --config extensions.color=! --config defaults.diff= --nodates -U0 --rev ' .. s:hg_commit .. ' -- %f'
let g:signify_vcs_cmds_diffmode.hg = 'hg cat --config extensions.color=! --rev ' .. s:hg_commit .. ' -- %f'
let s:jj_commit = printf('roots(ancestors(@, %d))', g:target_commit + 2)
let g:signify_vcs_cmds.jj = 'jj diff --git --context=0 --from "' .. s:jj_commit .. '" --to "@" -- %f'
let g:signify_vcs_cmds_diffmode.jj = 'jj cat -r "' .. s:jj_commit .. '" -- %f'
endfunction
function ChangeTargetCommit(older_or_younger)
if a:older_or_younger ==# 'older'
let g:target_commit += 1
elseif g:target_commit==#0
echom 'No timetravel! Cannot diff against HEAD~-1'
return
else
let g:target_commit -= 1
endif
call UpdateVcsCmds()
let l:output_msg = printf('%s%d', 'Now diffing against HEAD~', g:target_commit)
echom l:output_msg
endfunction
let g:target_commit = 0
command! SignifyOlder call ChangeTargetCommit('older')
command! SignifyNewer call ChangeTargetCommit('younger')
nnoremap [r :SignifyOlder<CR>
nnoremap ]r :SignifyNewer<CR>
let g:signify_sign_add = '▏' " '+'
let g:signify_sign_delete = '▁' " '_'
let g:signify_sign_delete_first_line = '▔' " '‾'
let g:signify_sign_change = '▏' " '!'
let g:signify_sign_change_delete = g:signify_sign_change . g:signify_sign_delete_first_line