How to change the default position of quickfix window in Vim?

后端 未结 2 566
孤独总比滥情好
孤独总比滥情好 2020-12-28 16:04

Setup: MacVim with MiniBufExplorer plugin window spanning the entire top and Taglist plugin window on the right.

Due to the fact that I keep my Tagli

相关标签:
2条回答
  • 2020-12-28 16:16

    While it is not possible to change the default split-window behavior of the :copen command, one can approach the issue in two ways.

    1. Use the commands that directly alter window splitting directions (see :help :vertical and below until the “Closing a window” paragraph).

    For instance, consider the commands:

    :botright copen
    

    or

    :botright cwindow
    

    to make the quickfix window open as the bottommost one, or even:

    :vertical topleft cwindow
    

    to open it to the top left of the current window.

    These commands can be shortened to :bo cope, :bo cw, and :vert to cw, respectively. Also, one can, of course, create a short mapping or a custom command for their quick invocation.

    2. Alternatively, move the quickfix window to the bottom of the window layout using an auto-command:

    :autocmd FileType qf wincmd J
    

    This trigger takes advantage of the fact that the quickfix window can be easily distinguished by its file-type, qf. The wincmd J command is equivalent to the [Ctrl+W, Shift+J] shortcut sequence instructing Vim to move the current window to the very bottom of the screen (see :help :wincmd and :help ^WJ).

    0 讨论(0)
  • 2020-12-28 16:17

    By default, Vim opens the new window above the current one for horizontal splits, and to the left of the current one for vertical splits (:help opening-window). You can customize this behavior like most other things in Vim:

    make the new window appear below the current window.

    :set splitbelow
    

    make the new window appear on the right.

    :set splitright
    
    0 讨论(0)
提交回复
热议问题