Mercurial > vim-lawrencium
comparison plugin/lawrencium.vim @ 47:edc43c59b3b8
avoid conflicts with plugins like minibufexplorer that might open a buffer when a new one is created
author | Sylvain Soliman <Sylvain.Soliman@m4x.org> |
---|---|
date | Sun, 04 Nov 2012 16:13:23 +0100 |
parents | ea0ae8f6af81 |
children | 85e39bdd7089 |
comparison
equal
deleted
inserted
replaced
45:ea0ae8f6af81 | 47:edc43c59b3b8 |
---|---|
312 endif | 312 endif |
313 if a:bang | 313 if a:bang |
314 " Open the output of the command in a temp file. | 314 " Open the output of the command in a temp file. |
315 let l:temp_file = s:tempname('hg-output-', '.txt') | 315 let l:temp_file = s:tempname('hg-output-', '.txt') |
316 execute 'pedit ' . l:temp_file | 316 execute 'pedit ' . l:temp_file |
317 wincmd p | 317 wincmd P |
318 call append(0, split(l:output, '\n')) | 318 call append(0, split(l:output, '\n')) |
319 else | 319 else |
320 " Just print out the output of the command. | 320 " Just print out the output of the command. |
321 echo l:output | 321 echo l:output |
322 endif | 322 endif |
395 let l:temp_file = s:tempname('hg-status-', '.txt') | 395 let l:temp_file = s:tempname('hg-status-', '.txt') |
396 let l:preview_height = &previewheight | 396 let l:preview_height = &previewheight |
397 let l:status_lines = split(l:status_text, '\n') | 397 let l:status_lines = split(l:status_text, '\n') |
398 execute "setlocal previewheight=" . (len(l:status_lines) + 1) | 398 execute "setlocal previewheight=" . (len(l:status_lines) + 1) |
399 execute "pedit " . l:temp_file | 399 execute "pedit " . l:temp_file |
400 wincmd p | 400 wincmd P |
401 call append(0, l:status_lines) | 401 call append(0, l:status_lines) |
402 call cursor(1, 1) | 402 call cursor(1, 1) |
403 " Make it a nice size. | 403 " Make it a nice size. |
404 execute "setlocal previewheight=" . l:preview_height | 404 execute "setlocal previewheight=" . l:preview_height |
405 " Make sure it's deleted when we exit the window. | 405 " Make sure it's deleted when we exit the window. |
895 | 895 |
896 " Open a new temp buffer in the preview window, jump to it, | 896 " Open a new temp buffer in the preview window, jump to it, |
897 " and paste the `hg log` output in there. | 897 " and paste the `hg log` output in there. |
898 let l:temp_file = s:tempname('hg-log-', '.txt') | 898 let l:temp_file = s:tempname('hg-log-', '.txt') |
899 execute "pedit " . l:temp_file | 899 execute "pedit " . l:temp_file |
900 wincmd p | 900 wincmd P |
901 execute "read !" . escape(l:log_command, '%#\') | 901 execute "read !" . escape(l:log_command, '%#\') |
902 | 902 |
903 " Setup the buffer correctly: readonly, and with the correct repo linked | 903 " Setup the buffer correctly: readonly, and with the correct repo linked |
904 " to it, and deleted on close. | 904 " to it, and deleted on close. |
905 let b:mercurial_dir = l:repo.root_dir | 905 let b:mercurial_dir = l:repo.root_dir |