comparison autoload/lawrencium.vim @ 146:33cc4af93b44

Use `HGPLAIN` for lawrencium buffers too.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 09 Apr 2019 08:15:22 -0700
parents 4d5f4233b04e
children 06f4d2c01fd6
comparison
equal deleted inserted replaced
145:78176bdfe0be 146:33cc4af93b44
349 349
350 " Runs a Mercurial command in the repo and reads its output into the current 350 " Runs a Mercurial command in the repo and reads its output into the current
351 " buffer. 351 " buffer.
352 function! s:HgRepo.ReadCommandOutput(command, ...) abort 352 function! s:HgRepo.ReadCommandOutput(command, ...) abort
353 function! s:PutOutputIntoBuffer(command_line) 353 function! s:PutOutputIntoBuffer(command_line)
354 let l:prev_hgplain = $HGPLAIN
355 let $HGPLAIN = 'true'
356
354 let l:was_buffer_empty = (line('$') == 1 && getline(1) == '') 357 let l:was_buffer_empty = (line('$') == 1 && getline(1) == '')
355 execute '0read!' . escape(a:command_line, '%#\') 358 execute '0read!' . escape(a:command_line, '%#\')
356 if l:was_buffer_empty " (Always true?) 359 if l:was_buffer_empty " (Always true?)
357 " '0read' inserts before the cursor, leaving a blank line which 360 " '0read' inserts before the cursor, leaving a blank line which
358 " needs to be deleted... but if there are folds in this thing, we 361 " needs to be deleted... but if there are folds in this thing, we
359 " must open them all first otherwise we could delete the whole 362 " must open them all first otherwise we could delete the whole
360 " contents of the last fold (since Vim may close them all by 363 " contents of the last fold (since Vim may close them all by
361 " default). 364 " default).
362 normal! zRG"_dd 365 normal! zRG"_dd
363 endif 366 endif
367
368 let $HGPLAIN = l:prev_hgplain
364 endfunction 369 endfunction
365 370
366 let l:all_args = [a:command] + a:000 371 let l:all_args = [a:command] + a:000
367 let l:hg_command = call(self['GetCommand'], l:all_args, self) 372 let l:hg_command = call(self['GetCommand'], l:all_args, self)
368 call lawrencium#trace("Running Mercurial command: " . l:hg_command) 373 call lawrencium#trace("Running Mercurial command: " . l:hg_command)