vim quickfix list: manipulate location?

vim location list
vim quickfix vs location list
vim quickfix python
vim quickfix plugin
vim quickfix navigation
vim quickfix format
vim toggle quickfix list
vim quickfix mappings

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.

Sadly Vim does not have a concept of a project drawer just windows (splits). After using a command to open the Quickfix list, e.g. :copen or :cwindow, it would probably be best to close then open NerdTree and Tagbar. Something like this:

command! Copen copen|NERDTreeToggle|TagbarClose|TagbarOpen

Note: I have not tested this command as I do not have NERDTree or Tagbar plugins. This also focuses the Tagbar window which is probably undesired.

Alternatively, you may want to look into simplifying your workflow by keeping both tagbar and nerdtree closed unless you are using them. This can make sense for some workflows as needing to see either the tags or file structure can be relatively uncommon (maybe 10% of the time). For tags you can just avoid tagbar entirely and use the :tag command directly or use <c-]> if you are on a symbol. Nerdtree can be used in the same manner as netrw to avoid this issue (See Oil and vinegar - split windows and the project drawer). I talk about these issues in the post: Files, Buffers, and Splits Oh My!

Personally I don't use NerdTree, Tagbar, or anything similar. I prefer to have 1-2 splits open at a time. I use projectionist.vim, a fuzzy finder like CtrlP, :find, or if I really must netrw.

quickfix, Last change: 2011 Feb 01 VIM REFERENCE MANUAL by Bram Moolenaar The location list commands are similar to the quickfix commands, replacing the 'c' � Populating the location list is done in the exact same way as the quickfix list, except that the built-in commands are prefixed with l. For example: :lvimgrep , :lmake , :lgrep e.t.c. Some third-party plugins also place their output in the location list by default, although it’s usually configurable in case you prefer the quickfix list.

You can force quickfix to open on full width with this code in your .vimrc:

augroup DragQuickfixWindowDown
    autocmd!
    autocmd FileType qf wincmd J
augroup end

It is now what was asked but it is as close to it as I could get.

File Navigation with the QuickFix List | by Alex R. Young, I usually work with location lists rather than quickfix lists ( :help location-list ). These are generated by the ag.vim Silver Searcher plugin. This has keyboard� The earlier quickfix and location lists can be accessed by using the :colder and :lolder commands respectively. This is always easiest to do while the quickfix or location windows are open, so the updated list is clearly visible. :cnewer and :lnewer navigate forward again through the quickfix/location list stack.

I found a good solution here, just put the text below in your vimrc. It will always move quickfix window to the bottom of your screen with full width and without affecting other quickfix stuff.

" Position the (global) quickfix window at the very bottom of the window
" (useful for making sure that it appears underneath splits)
"
" NOTE: Using a check here to make sure that window-specific location-lists
" aren't effected, as they use the same `FileType` as quickfix-lists.
autocmd FileType qf if (getwininfo(win_getid())[0].loclist != 1) | wincmd J | endif

A List of Vim's Lists, Here, we take a look at Vim's lists, which exhibit a certain amount of symmetry a buffer adds an entry to the change list, which records the cursor location. The quickfix list, generally speaking, provides a way of storing and� A location list can be associated with only one window. The location list is independent of the quickfix list. When a window with a location list is split, the new window gets a copy of the location list. When there are no references to a location list, the location list is destroyed. The following quickfix commands can be used.

How to copy quickfix list to a location list : vim, How to copy quickfix list to a location list. I have started using vimgrep and also a plug-in to use ag for searching but That can be seen in :help location-list . ( yank/change/delete) with text objects (helps you learn about text objects, yay!) location list. When there are no longer any references to alocation list, the location listisdestroyed. quickfix-changedtickEvery quickfixand location listhas aread-only changedtick variable that Every time the quickfixlistismodified, this countisincremented.

quickfix vs location list � Issue #696 � fatih/vim-go � GitHub, vim to use quickfix instead of location list . I've already refactored and laid out the foundation so it's pretty easy! The only change we need is to be� Unite-location. Make unite/denite replace quickfix list and lcoation list. TODO: implementation of refresh. Motivation. With denite.nvim, I can do more actions (like filter, convertor), and they're uniformed, no need to remember more key mapping for navigate or list toggle, for example, you can add followinng mapping to make your life with list much easier:

The quickfix and location lists in Vim, The quickfix list is useful for navigating to different locations in a project such as when reviewing linting warnings, compilation errors, or when� description Use this plugin to enable automatic updating of the selected location list item based on the current cursor position. The item selected is determined by the target type which by default selects the nearest item. Both window local, and global 'quickfix' location lists are supported.

Comments
  • Not sure if this is enforceable but I believe it may be selecting whichever buffer is in focus. Hence, if you are in the main window when you hit your key mapping, it should work.
  • No, unfortunately it does also happen when the main window/buffer is focused :/
  • have you tried :belo cw ?