Vim Tips Wiki
m (Quickfix show entire contents of multiline error in cwindow on cn, cp and cc moved to Show entire multiline error in quickfix: Page moved by JohnBot to improve title)
(Change <tt> to <code>, perhaps also minor tweak.)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=444
 
|id=444
  +
|previous=443
|title=quickfix show entire contents of multiline error in cwindow on cn, cp and cc
 
  +
|next=445
|created=March 17, 2003 13:32
+
|created=2003
 
|complexity=basic
 
|complexity=basic
 
|author=eric sherman
 
|author=eric sherman
 
|version=5.7
 
|version=5.7
 
|rating=7/10
 
|rating=7/10
  +
|category1=Compiler
|text=
 
  +
|category2=
Put this in your .vimrc if you use the cwindow
 
 
}}
 
Put this in your [[vimrc]] if you use the cwindow:
  +
<pre>
 
" \cc
  +
map <Leader>cc :cwindow<CR>:cc<CR><c-w>bz<CR><CR>
 
" \cn
  +
map <Leader>cn :cwindow<CR>:cn<CR><c-w>bz<CR><CR>
 
" \cp
  +
map <Leader>cp :cwindow<CR>:cp<CR><c-w>bz<CR><CR>
  +
</pre>
   
 
and when you use <code>\cc</code> (or whatever your leader character is + cc), <code>\cn</code> or <code>\cp</code>, it will do what :cc, :cn and :cp usually did, with the added bonus of showing the entire contents of multiline errors. this is especially useful for javac via ant, and it's obnoxious to keep typing <c-w>b<CR> every time i do a :cn, so i mapped this.
" \cc
 
map &lt;Leader&gt;cc :cwindow&lt;cr&gt;:cc&lt;cr&gt;&lt;c-w&gt;bz&lt;cr&gt;&lt;cr&gt;
 
" \cn
 
map &lt;Leader&gt;cn :cwindow&lt;cr&gt;:cn&lt;cr&gt;&lt;c-w&gt;bz&lt;cr&gt;&lt;cr&gt;
 
" \cp
 
map &lt;Leader&gt;cp :cwindow&lt;cr&gt;:cp&lt;cr&gt;&lt;c-w&gt;bz&lt;cr&gt;&lt;cr&gt;
 
   
 
Detailed explanation:
and when you use \cc (or whatever your leader character is + cc), \cn or \cp, it will do what :cc, :cn and :cp usually did, with the added bonus of showing the entire contents of multiline errors. this is especially useful for javac via ant, and it's obnoxious to keep typing &lt;c-w&gt;b&lt;cr&gt; every time i do a :cn, so i mapped this.
 
 
*":cwindow<CR>" ensures that the quickfix window is shown.
   
 
*":cc" (:cn, and :cp) actually do the operation
Detailed explaination:
 
*":cwindow&lt;cr&gt;" ensures that the quickfix window is shown.
 
   
  +
*"<c-w>b" go to the bottom window (which cwindow will be if it's shown) which will magically center on the error
*":cc" (:cn, and :cp) actually do the operation
 
   
*"&lt;c-w&gt;b" go to the bottom window (which cwindow will be if it's shown) which will magically center on the error
+
*"z<CR>" will reposition the buffer in the window so that the current line becomes the top line in the window
   
 
*"<CR>" carriage-return on the error line, taking you back to the code with the error
*"z&lt;cr&gt;" will reposition the buffer in the window so that the current line becomes the top line in the window
 
   
 
==Comments==
*"&lt;cr&gt;" carriage-return on the error line, taking you back to the code with the error
 
 
I know it probably seems superfluous if you haven't been personally affected by this particular annoyance.
 
 
thanks to freenode &#35;vim for inspiration.
 
}}
 
 
== Comments ==
 
 
Another solution to this problem is to "set cmdheight=2" which will provide two lines at the bottom of the screen for quickfix error lines instead of the default one.
 
Another solution to this problem is to "set cmdheight=2" which will provide two lines at the bottom of the screen for quickfix error lines instead of the default one.
   
garyjohn--AT--spk.agilent.com
 
, March 17, 2003 23:03
 
----
 
awesome tip! It works just like it says for java ant output
 
 
avanham--AT--mac.com
 
, October 29, 2005 8:29
 
 
----
 
----
<!-- parsed by vimtips.py in 0.494240 seconds-->
 
[[Category:Compiler]]
 

Latest revision as of 05:31, 13 July 2012

Tip 444 Printable Monobook Previous Next

created 2003 · complexity basic · author eric sherman · version 5.7


Put this in your vimrc if you use the cwindow:

" \cc
map <Leader>cc :cwindow<CR>:cc<CR><c-w>bz<CR><CR>
" \cn
map <Leader>cn :cwindow<CR>:cn<CR><c-w>bz<CR><CR>
" \cp
map <Leader>cp :cwindow<CR>:cp<CR><c-w>bz<CR><CR>

and when you use \cc (or whatever your leader character is + cc), \cn or \cp, it will do what :cc, :cn and :cp usually did, with the added bonus of showing the entire contents of multiline errors. this is especially useful for javac via ant, and it's obnoxious to keep typing <c-w>b<CR> every time i do a :cn, so i mapped this.

Detailed explanation:

  • ":cwindow<CR>" ensures that the quickfix window is shown.
  • ":cc" (:cn, and :cp) actually do the operation
  • "<c-w>b" go to the bottom window (which cwindow will be if it's shown) which will magically center on the error
  • "z<CR>" will reposition the buffer in the window so that the current line becomes the top line in the window
  • "<CR>" carriage-return on the error line, taking you back to the code with the error

Comments[]

Another solution to this problem is to "set cmdheight=2" which will provide two lines at the bottom of the screen for quickfix error lines instead of the default one.