Mercurial > vim-lawrencium
comparison plugin/lawrencium.vim @ 68:7afcd4d37062
Added vertical `Hglog` commands.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 05 Mar 2013 21:01:05 -0800 |
parents | 1cf08e4a7947 |
children | 8c9aca0e4322 |
comparison
equal
deleted
inserted
replaced
67:1cf08e4a7947 | 68:7afcd4d37062 |
---|---|
1312 | 1312 |
1313 " }}} | 1313 " }}} |
1314 | 1314 |
1315 " Hglog, Hglogthis {{{ | 1315 " Hglog, Hglogthis {{{ |
1316 | 1316 |
1317 function! s:HgLog(...) abort | 1317 function! s:HgLog(vertical, ...) abort |
1318 " Get the file or directory to get the log from. | 1318 " Get the file or directory to get the log from. |
1319 " (empty string is for the whole repository) | 1319 " (empty string is for the whole repository) |
1320 let l:repo = s:hg_repo() | 1320 let l:repo = s:hg_repo() |
1321 if a:0 > 0 | 1321 if a:0 > 0 |
1322 let l:path = l:repo.GetRelativePath(expand(a:1)) | 1322 let l:path = l:repo.GetRelativePath(expand(a:1)) |
1325 endif | 1325 endif |
1326 | 1326 |
1327 " Get the Lawrencium path for this `hg log`, | 1327 " Get the Lawrencium path for this `hg log`, |
1328 " open it in a preview window and jump to it. | 1328 " open it in a preview window and jump to it. |
1329 let l:log_path = l:repo.GetLawrenciumPath(l:path, 'log', '') | 1329 let l:log_path = l:repo.GetLawrenciumPath(l:path, 'log', '') |
1330 execute 'pedit ' . l:log_path | 1330 if a:vertical |
1331 execute 'vertical pedit ' . l:log_path | |
1332 else | |
1333 execute 'pedit ' . l:log_path | |
1334 endif | |
1331 wincmd P | 1335 wincmd P |
1332 | 1336 |
1333 " Add some other nice commands and mappings. | 1337 " Add some other nice commands and mappings. |
1334 let l:is_file = (l:path != '' && filereadable(l:repo.GetFullPath(l:path))) | 1338 let l:is_file = (l:path != '' && filereadable(l:repo.GetFullPath(l:path))) |
1335 command! -buffer -nargs=* Hglogdiff :call s:HgLog_Diff(<f-args>) | 1339 command! -buffer -nargs=* Hglogdiff :call s:HgLog_Diff(<f-args>) |
1401 call s:throw("Can't parse revision number from line: " . l:line) | 1405 call s:throw("Can't parse revision number from line: " . l:line) |
1402 endif | 1406 endif |
1403 return l:rev | 1407 return l:rev |
1404 endfunction | 1408 endfunction |
1405 | 1409 |
1406 call s:AddMainCommand("Hglogthis :call s:HgLog('%:p')") | 1410 call s:AddMainCommand("Hglogthis :call s:HgLog(0, '%:p')") |
1407 call s:AddMainCommand("-nargs=? -complete=customlist,s:ListRepoFiles Hglog :call s:HgLog(<f-args>)") | 1411 call s:AddMainCommand("Hgvlogthis :call s:HgLog(1, '%:p')") |
1412 call s:AddMainCommand("-nargs=? -complete=customlist,s:ListRepoFiles Hglog :call s:HgLog(0, <f-args>)") | |
1413 call s:AddMainCommand("-nargs=? -complete=customlist,s:ListRepoFiles Hgvlog :call s:HgLog(1, <f-args>)") | |
1408 | 1414 |
1409 " }}} | 1415 " }}} |
1410 | 1416 |
1411 " Hgannotate {{{ | 1417 " Hgannotate {{{ |
1412 | 1418 |