So I wrote the following code in my vimrc. With it, a quickfix window height is automatically adjusted to fit its contents (maximum 10 lines). au FileType qf call AdjustWindowHeight(3, 10) function! AdjustWindowHeight(minheight, maxheight) exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _" endfunction Of course, this function can be applied to other windows besides the quickfix window. If you feel it's too tight, you may want to replace line("$") with line("$")+1.
Attributes | Values |
---|
rdfs:label
| - Automatically fitting a quickfix window height
|
rdfs:comment
| - So I wrote the following code in my vimrc. With it, a quickfix window height is automatically adjusted to fit its contents (maximum 10 lines). au FileType qf call AdjustWindowHeight(3, 10) function! AdjustWindowHeight(minheight, maxheight) exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _" endfunction Of course, this function can be applied to other windows besides the quickfix window. If you feel it's too tight, you may want to replace line("$") with line("$")+1.
|
Version
| |
dbkwik:vim/property/wikiPageUsesTemplate
| |
Previous
| |
Category
| |
Author
| |
Subpage
| |
Complexity
| |
Created
| |
ID
| |
NEXT
| |
abstract
| - So I wrote the following code in my vimrc. With it, a quickfix window height is automatically adjusted to fit its contents (maximum 10 lines). au FileType qf call AdjustWindowHeight(3, 10) function! AdjustWindowHeight(minheight, maxheight) exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _" endfunction Of course, this function can be applied to other windows besides the quickfix window. If you feel it's too tight, you may want to replace line("$") with line("$")+1.
|