(Change <tt> to <code>, perhaps also minor tweak.)
Line 3:
Line 3:
|previous=1535
|previous=1535
|next=1538
|next=1538
−
|created=December 3, 2007
+
|created=2007
|complexity=basic
|complexity=basic
|author=AOYAMA Shotaro
|author=AOYAMA Shotaro
Line 11:
Line 11:
|category2=
|category2=
}}
}}
−
When I do <tt>:cw</tt>, a quickfix window opens with a 10-line height, even when the number of errors is 1 or 2. I think it's a waste of window space.
+
When I do <code>:cw</code>, a quickfix window opens with a 10-line height, even when the number of errors is 1 or 2. I think it's a waste of window space.
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).
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).
Line 24:
Line 24:
Of course, this function can be applied to other windows besides the quickfix window.
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 <tt>line("$")</tt> with <tt>line("$")+1</tt>.
+
If you feel it's too tight, you may want to replace <code>line("$")</code> with <code>line("$")+1</code>.