When I am working with vim, I occasionally end up with a split menu setup like this:
###############################################
# | | #
# | | #
# NERDTree | main window | tagbar #
# | | #
# | | #
###############################################
Even when tagbar is closed, I may end up with a comparable setup, for example when I compare different files.
However, when I do a vimgrep command the results (displayed in a quickfix list) are only displayed below the main window, when tagbar (or other splits at the right) are closed.
Hence, this setup works correctly every time:
###############################################
# | #
# | #
# NERDTree | main window #
# | #
# | #
# |__________________________________#
# | #
# | quickfix list: vimgrep results #
# | #
###############################################
...while this does not:
###############################################
# | | #
# | | #
# NERDTree | main window | tagbar #
# | | #
# | |________#
# | | quick- #
# | | fix #
# | | list: #
# | | vimgrep#
# | | results#
###############################################
How can I enforce the quickfix list to always open (containing the vimgrep results) below the main window?
At the moment it just opens up correctly (below the main window) if - and only if - there is no other split window right to the main window. If any split exists right to the main window, the vimgrep command always opens quickfix there :/
I've bound searching for the word currently under the cursor with a vimgrep command (to search for this word in the entire file):
nnoremap some-key :execute "vimgrep /\\<" . expand("<cword>") . "\\>/j ".expand("%") <Bar> cw<CR>
...just to show what I am doing with vimgrep.