On Saturday, November 30, 2013 8:41:11 PM UTC-6, Thiago de Arruda wrote:
> I managed to accomplish what I wanted with the following:
>
>
>
> au! BufWinEnter quickfix nnoremap <silent> <buffer> q :cclose<cr>:lclose<cr>
>
>
>
> Since there seems to be no way to distinguish a quickfix from a
>
> location-list I just execute both commands and it works as
>
> expected(the other one is just silently ignored)
>
>
>
> In any case thanks for your help
>
>
>
Well, you never mentioned wanting to tell the difference.
You're right, there's no easy way. What I've done for that, is a multi-step process:
1. save the current number of windows from winnr('$') to a variable
2. save the current window number from winnr()
2. open the quickfix window with :copen
3. detect whether the window changed. If the window changed, it was a location list window, not quickfix. If the window number did not change, you were already in the (only) quickfix window.
4. If location list, additionally detect whether the total number of open windows changed. If it did, close the newly opened quickfix window.
5. Jump back to the previous window if needed.
--
--
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/groups/opt_out.
Sunday, December 1, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment