Friday, December 5, 2014

Re: The window to be chosen for quickfix

On Thursday, December 4, 2014 12:58:33 PM UTC-6, Christian Brabandt wrote:
> Hi Gary!
>
> On Mi, 03 Dez 2014, Gary Johnson wrote:
>
> > nnoremap <buffer> <CR> :call QfEnter()<CR>
> >
> > function! QfEnter()
> > let l:lnum = line('.')
> > wincmd p
> > exe 'cc' l:lnum
> > endfunction
> >
> > I put that in ~/.vim/after/ftplugin/qf.vim. The map will therefor
> > apply only to the quickfix window.
>
> Thanks for that.
>
> >
> > Someone commented in another thread a while back that the quickfix
> > error number was not always the same as the quickfix window line
> > number, but that assumption has always worked for me.
>
> I suppose this could happen for multi-line errorlists? But I have never
> used them, so it should be okay for me.
>


Unfortunately, I often have quickfix lists with "cruft" lines, from my gcc-based compiler. Probably the cause is actually my makefile echoing out each command that runs. Example:

|| gcc -c -O2 -fno-builtin -Wall -s -UVARIOUS_UNDEFINED_THINGS -DVARIOUS_DEFINED_THINGS -I./various/include/paths src/main.c -o src/main.o
|| src/main.c: In function `ProcessIO':
src/main.c|363 warning| unused variable `CurrentTime'
src/main.c|355 warning| unused variable `CurrentTimeInMs'
src/main.c|354 warning| unused variable `NextBroadcastTime'
|| src/main.c: In function `main':
src/main.c|1545 warning| implicit declaration of function `set_callback'
|| gcc -c -O2 -fno-builtin -Wall -s -UWIN_AGS -D__true_false_are_keywords -DM145 -UDEBUG -DWRAPPER_DEBUG_DISABLED -UCANNED_DATA -UTEST_STUB -M -I./various/include/paths src/main.c > src/main.d.tmp
|| sed -e 's|.*:|src/main.o:|' < src/main.d.tmp > src/main.d
|| sed -e 's/.*://' -e 's/\\$//' < src/main.d.tmp | \
|| sed -e 's/\(.\)$/\1:/' >> src/main.d
|| rm -f src/main.d.tmp

Only the lines not starting with "||" are actually error list positions.

I do have a ftplugin set up to add the error number of the cursor line to the statusline...I'll see if I can use that for a similar mapping and post the result.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment