" Plugin: https://github.com/mhinz/vim-signify " Description: show a diff from a version control system via the signcolumn " Maintainer: Marco Hinz " Version: 1.9 if exists('g:loaded_signify') || !has('signs') || &cp finish endif let g:loaded_signify = 1 " Init: values {{{1 let g:sy = {} " Init: autocmds {{{1 augroup signify autocmd! autocmd VimEnter * call sy#highlight#setup() autocmd BufRead,BufEnter * let g:sy_path = resolve(expand(':p')) autocmd BufRead,BufWritePost * call sy#start(g:sy_path) autocmd BufDelete * \ let path = resolve(expand(':p')) | \ call sy#stop(path) | \ if has_key(g:sy, path) | \ call remove(g:sy, path) | \ endif if get(g:, 'signify_update_on_bufenter') autocmd BufEnter * nested \ if has_key(g:sy, g:sy_path) && g:sy[g:sy_path].active && &modified | \ write | \ endif endif if get(g:, 'signify_cursorhold_normal') autocmd CursorHold * nested \ if has_key(g:sy, g:sy_path) && g:sy[g:sy_path].active && &modified | \ write | \ endif endif if get(g:, 'signify_cursorhold_insert') autocmd CursorHoldI * nested \ if has_key(g:sy, g:sy_path) && g:sy[g:sy_path].active && &modified | \ write | \ endif endif if get(g:, 'signify_update_on_focusgained') && !has('gui_win32') autocmd FocusGained * call sy#start(g:sy_path) endif augroup END " Init: commands {{{1 com! -nargs=0 -bar SignifyToggle call sy#toggle() com! -nargs=0 -bar SignifyToggleHighlight call sy#highlight#line_toggle() com! -nargs=0 -bar SyDebug call sy#debug#list_active_buffers() " Init: mappings {{{1 nnoremap (signify-next-hunk) &diff ? ']c' : ":\call sy#jump#next_hunk(v:count1)\" nnoremap (signify-prev-hunk) &diff ? '[c' : ":\call sy#jump#prev_hunk(v:count1)\" nnoremap (signify-toggle-highlight) :call sy#highlight#line_toggle() nnoremap (signify-toggle) :call sy#toggle() if exists('g:signify_mapping_next_hunk') execute 'nmap '. g:signify_mapping_next_hunk .' (signify-next-hunk)' elseif !hasmapto('(signify-next-hunk)') && !maparg('gj', 'n') nmap gj (signify-next-hunk) endif if exists('g:signify_mapping_prev_hunk') execute 'nmap '. g:signify_mapping_prev_hunk .' (signify-prev-hunk)' elseif !hasmapto('(signify-prev-hunk)') && !maparg('gk', 'n') nmap gk (signify-prev-hunk) endif if exists('g:signify_mapping_toggle_highlight') execute 'nmap '. g:signify_mapping_toggle_highlight .' (signify-toggle-highlight)' elseif !hasmapto('(signify-toggle-highlight)') && !maparg('gh', 'n') nmap gh (signify-toggle-highlight) endif if exists('g:signify_mapping_toggle') execute 'nmap '. g:signify_mapping_toggle .' (signify-toggle)' elseif !hasmapto('(signify-toggle)') && !maparg('gt', 'n') nmap gt (signify-toggle) endif if !maparg(']c', 'n') nmap ]c (signify-next-hunk) endif if !maparg('[c', 'n') nmap [c (signify-prev-hunk) endif " vim: et sw=2 sts=2