如何在 Vim 中更改 quickfix 窗口的默认位置? [英] How to change the default position of quickfix window in Vim?

查看:17
本文介绍了如何在 Vim 中更改 quickfix 窗口的默认位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置: MacVim 与 MiniBufExplorer 插件窗口跨越整个顶部和右侧的 Taglist 插件窗口.

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

由于我将 Taglist 保持在右侧,因此每当我打开 quickfix 窗口时,它都位于最右侧,Taglist 窗口下方(与 Taglist 窗口宽度相同)

Due to the fact that I keep my Taglist on the right, whenever I open the quickfix window, it is positioned on the far right, below the Taglist window (with the same width as the Taglist window)

是否可以更改默认的打开位置逻辑,以便快速修复窗口将在我的主代码窗口下方(向下和向左)打开,或者可能跨越 Vim 视口底部的整个宽度?

Is it possible to change the default opening position logic, so that the quickfix window will open below my main code window (down and to the left) or maybe span the entire width at the bottom of the Vim viewport?

推荐答案

虽然无法更改默认的拆分窗口行为在 :copen 命令中,可以通过两种方式解决问题.

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. 使用直接改变窗口分割方向的命令(请参阅 :help :vertical 及以下直到关闭窗口"段落).

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

例如,考虑以下命令:

:botright copen

:botright cwindow

让quickfix窗口作为最底层的窗口打开,甚至:

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.

这些命令可以分别缩写为:bocop:bo cw:vert to cw.此外,当然,您可以创建一个简短的映射或用于快速调用的自定义命令.

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. 或者,将 quickfix 窗口移到窗口底部使用自动命令进行布局:

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

:autocmd FileType qf wincmd J

这个触发器利用了quickfix窗口可以可以通过其文件类型 qf 轻松区分.wincmd J 命令相当于[Ctrl+W,Shift+J]指示 Vim 将当前窗口移动到屏幕最底部(参见 :help :wincmd:help ^WJ).

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).

这篇关于如何在 Vim 中更改 quickfix 窗口的默认位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆