Coqtail icon indicating copy to clipboard operation
Coqtail copied to clipboard

Inconsistent options in auxiliary buffers

Open Tuplanolla opened this issue 2 years ago • 2 comments

Versions

Coq 8.15.0

Coqtail 1.6.2

Vim 8.2

Equations 1.3

Python 3.7.4

Description

There are various options that are intended to be used in the script view, but also appear as distractions in the proof and message views. I have noticed this with at least relative line numbers (due to rnu), highlighted margins (due to cc), highlighted cursor column (due to cuc) and double line breaks (perhaps due to enc with the output of coq-equations). It would be nice if these options were turned off in auxiliary buffers.

Tuplanolla avatar Apr 14 '22 13:04 Tuplanolla

Thanks for reporting this. I agree some of these options probably don't make sense in the Goal and Info panels, but I'll need to think a bit about which ones to turn off by default. There are reasons you might want to navigate those buffers (e.g., to scroll or copy something), so I'd hesitate to turn off options that people might feel make that easier. Actually I'm noticing that we currently disable 'cursorline' in those panels, which I'm rethinking.

Maybe what would work best is to disable visually distracting options only when the window isn't focused using autocmds, like what :h 'cuc' describes.

As a workaround you can set/unset whatever options you like with a autocmd FileType like the following:

augroup coqtail_panels
  autocmd! *
  autocmd FileType coq-goals,coq-infos setlocal nornu
augroup END

whonore avatar Apr 14 '22 15:04 whonore

Thanks for the clues. While it is true that it would probably be wise to only highlight the cursor in the active buffer, this is not necessarily the case with line numbers. Luckily, the following settings work very well indeed.

augroup coqtail_panels
  autocmd!
  autocmd FileType coq-goals,coq-infos setlocal colorcolumn=
  \ nocursorcolumn nocursorline nonumber norelativenumber
augroup END

Here is the other option.

function! SetOnEnter()
  setlocal colorcolumn=+1,73,81 cursorcolumn cursorline
  if &number
    setlocal relativenumber
  endif
endfunction
function! SetOnLeave()
  setlocal colorcolumn= nocursorcolumn nocursorline
  if &number
    setlocal norelativenumber
  endif
endfunction
augroup enter_leave
  autocmd!
  autocmd BufEnter,VimEnter,WinEnter * call SetOnEnter()
  autocmd BufLeave,VimLeave,WinLeave * call SetOnLeave()
augroup END

Tuplanolla avatar Apr 14 '22 16:04 Tuplanolla