Vimtex: quickfix window height

Created on 25 May 2018  路  3Comments  路  Source: lervag/vimtex

This is a request for a small change.
I'd like the quickfix window height to be len(getqflist()) when it is less than ten.

could you maybe change:

https://github.com/lervag/vimtex/blob/f4c8a98c23fdf3c385d0a653d44ac22b0256cf36/autoload/vimtex/qf.vim#L82-L92

to something like this?

  if a:force || (g:vimtex_quickfix_mode > 0 && l:errors_or_warnings)
    call s:window_save()
    let s:qf_errors = len(getqflist())
    if s:qf_errors < 10
      execute 'botright cwindow' s:qf_errors
    else
      botright cwindow
    endif
    ...

Most helpful comment

I don't want to enforce this, sorry. I think this should be a user setting. I personally use the following myself in a personal ftplugin/qf.vim file:

augroup quickfix_autocmds
  autocmd!
  autocmd BufReadPost quickfix call AdjustWindowHeight(2, 30)
augroup END

function! AdjustWindowHeight(minheight, maxheight)
  execute max([a:minheight, min([line('$') + 1, a:maxheight])])
        \ . 'wincmd _'
endfunction

This sets the minimum and maximum height of the quickfix window in a general
manner that works everywhere, not only for LaTeX projects.

All 3 comments

I don't want to enforce this, sorry. I think this should be a user setting. I personally use the following myself in a personal ftplugin/qf.vim file:

augroup quickfix_autocmds
  autocmd!
  autocmd BufReadPost quickfix call AdjustWindowHeight(2, 30)
augroup END

function! AdjustWindowHeight(minheight, maxheight)
  execute max([a:minheight, min([line('$') + 1, a:maxheight])])
        \ . 'wincmd _'
endfunction

This sets the minimum and maximum height of the quickfix window in a general
manner that works everywhere, not only for LaTeX projects.

indeed. thanks for the tip!

No problem :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

David-Fu picture David-Fu  路  5Comments

andregpss picture andregpss  路  5Comments

benutzer193 picture benutzer193  路  4Comments

Davidnet picture Davidnet  路  4Comments

lervag picture lervag  路  3Comments