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= |
+ | |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= |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | <pre> |
||
⚫ | |||
+ | map <Leader>cc :cwindow<CR>:cc<CR><c-w>bz<CR><CR> |
||
⚫ | |||
+ | map <Leader>cn :cwindow<CR>:cn<CR><c-w>bz<CR><CR> |
||
⚫ | |||
+ | 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. |
||
⚫ | |||
− | map <Leader>cc :cwindow<cr>:cc<cr><c-w>bz<cr><cr> |
||
⚫ | |||
− | map <Leader>cn :cwindow<cr>:cn<cr><c-w>bz<cr><cr> |
||
⚫ | |||
− | 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" 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 |
⚫ | |||
− | *"z<cr>" will reposition the buffer in the window so that the current line becomes the top line in the window |
||
⚫ | |||
⚫ | |||
− | |||
− | I know it probably seems superfluous if you haven't been personally affected by this particular annoyance. |
||
− | |||
− | thanks to freenode #vim for inspiration. |
||
⚫ | |||
− | |||
⚫ | |||
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.