Mercurial > vim-lawrencium
comparison autoload/lawrencium/annotate.vim @ 140:652a6f5df0f3
Fixed for broken things after the reorganization.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 13 Jun 2016 21:55:40 -0700 |
parents | 065625e1bb31 |
children | fb65725f2872 |
comparison
equal
deleted
inserted
replaced
139:065625e1bb31 | 140:652a6f5df0f3 |
---|---|
96 | 96 |
97 " Make the annotate buffer a Lawrencium buffer. | 97 " Make the annotate buffer a Lawrencium buffer. |
98 let b:mercurial_dir = l:repo.root_dir | 98 let b:mercurial_dir = l:repo.root_dir |
99 let b:lawrencium_annotated_path = l:path | 99 let b:lawrencium_annotated_path = l:path |
100 let b:lawrencium_annotated_bufnr = l:bufnr | 100 let b:lawrencium_annotated_bufnr = l:bufnr |
101 call s:DefineMainCommands() | 101 call lawrencium#define_commands() |
102 | 102 |
103 " Add some other nice commands and mappings. | 103 " Add some other nice commands and mappings. |
104 command! -buffer Hgannotatediffsum :call s:HgAnnotate_DiffSummary() | 104 command! -buffer Hgannotatediffsum :call s:HgAnnotate_DiffSummary() |
105 command! -buffer Hgannotatelog :call s:HgAnnotate_DiffSummary(1) | 105 command! -buffer Hgannotatelog :call s:HgAnnotate_DiffSummary(1) |
106 if g:lawrencium_define_mappings | 106 if g:lawrencium_define_mappings |
108 nnoremap <buffer> <silent> <leader><cr> :Hgannotatelog<cr> | 108 nnoremap <buffer> <silent> <leader><cr> :Hgannotatelog<cr> |
109 endif | 109 endif |
110 | 110 |
111 " Clean up when the annotate buffer is deleted. | 111 " Clean up when the annotate buffer is deleted. |
112 let l:bufobj = lawrencium#buffer_obj() | 112 let l:bufobj = lawrencium#buffer_obj() |
113 call l:bufobj.OnDelete('call s:HgAnnotate_Delete(' . l:bufobj.nr . ')') | 113 call l:bufobj.OnDelete('call lawrencium#annotate#HgAnnotate_Delete(' . l:bufobj.nr . ')') |
114 endfunction | 114 endfunction |
115 | 115 |
116 function! s:HgAnnotate_Delete(bufnr) abort | 116 function! lawrencium#annotate#HgAnnotate_Delete(bufnr) abort |
117 if g:lawrencium_auto_close_buffers | 117 if g:lawrencium_auto_close_buffers |
118 call s:delete_dependency_buffers('lawrencium_diff_for', a:bufnr) | 118 call lawrencium#delete_dependency_buffers('lawrencium_diff_for', a:bufnr) |
119 endif | 119 endif |
120 endfunction | 120 endfunction |
121 | 121 |
122 function! s:HgAnnotate_DiffSummary(...) abort | 122 function! s:HgAnnotate_DiffSummary(...) abort |
123 " Get the path for the diff of the revision specified under the cursor. | 123 " Get the path for the diff of the revision specified under the cursor. |
134 let l:path = l:repo.GetLawrenciumPath(b:lawrencium_annotated_path, 'diff', l:rev_hash) | 134 let l:path = l:repo.GetLawrenciumPath(b:lawrencium_annotated_path, 'diff', l:rev_hash) |
135 endif | 135 endif |
136 let l:annotate_buffer = lawrencium#buffer_obj() | 136 let l:annotate_buffer = lawrencium#buffer_obj() |
137 | 137 |
138 " Find a window already displaying diffs for this annotation. | 138 " Find a window already displaying diffs for this annotation. |
139 let l:diff_winnr = s:find_buffer_window('lawrencium_diff_for', l:annotate_buffer.nr) | 139 let l:diff_winnr = lawrencium#find_buffer_window('lawrencium_diff_for', l:annotate_buffer.nr) |
140 if l:diff_winnr == -1 | 140 if l:diff_winnr == -1 |
141 " Not found... go back to the main source buffer and open a bottom | 141 " Not found... go back to the main source buffer and open a bottom |
142 " split with the diff for the specified revision. | 142 " split with the diff for the specified revision. |
143 execute bufwinnr(b:lawrencium_annotated_bufnr) . 'wincmd w' | 143 execute bufwinnr(b:lawrencium_annotated_bufnr) . 'wincmd w' |
144 execute 'rightbelow split ' . fnameescape(l:path) | 144 execute 'rightbelow split ' . fnameescape(l:path) |