我知道你可以使用 ctrl-w + enter 在一个新的横向窗口中打开 quickfix 项。
是否有一种方法可以在垂直分割中打开 quickfix 窗口中的项目?
注:无需更改任何 HTML 标签。我知道你可以使用 ctrl-w + enter 在一个新的横向窗口中打开 quickfix 项。
是否有一种方法可以在垂直分割中打开 quickfix 窗口中的项目?
注:无需更改任何 HTML 标签。这里是一个快速而且不完美的尝试:
autocmd! FileType qf nnoremap <buffer> <leader><Enter> <C-w><Enter><C-w>L
<leader><Enter>
映射仅在 quickfix 和 location 窗口中启用。它会在一个水平窗口中打开错误/位置 (<C-w><Enter>
),并将其转换为垂直窗口 (<C-w>L
)。
QFEnter插件看起来对你很有帮助。 它可以让你在选定的窗口、新的垂直分割窗口、新的分割窗口或新的标签页中打开一个快速修复项目。
vimrc
片段。它使用我从QFEnter插件学到的相同技术,虽然方式简化了很多,但只提供使用CtrlP提供的相同快捷键(<C-v>
和<C-x>
)来提供垂直和水平拆分。" This is only availale in the quickfix window, owing to the filetype
" restriction on the autocmd (see below).
function! <SID>OpenQuickfix(new_split_cmd)
" 1. the current line is the result idx as we are in the quickfix
let l:qf_idx = line('.')
" 2. jump to the previous window
wincmd p
" 3. switch to a new split (the new_split_cmd will be 'vnew' or 'split')
execute a:new_split_cmd
" 4. open the 'current' item of the quickfix list in the newly created buffer
" (the current means, the one focused before switching to the new buffer)
execute l:qf_idx . 'cc'
endfunction
autocmd FileType qf nnoremap <buffer> <C-v> :call <SID>OpenQuickfix("vnew")<CR>
autocmd FileType qf nnoremap <buffer> <C-x> :call <SID>OpenQuickfix("split")<CR>
内置设置:set switchbuf=vsplit
也应该可以工作(至少在较新的vim版本中)。
<C-w>L
或<C-w>H
将当前打开的窗口变为纵向窗口。 - romainl<C-w><Enter>
和<Enter>
。在这里,你真的无法避免创建自定义映射。 - romainl:vert copen
并调整大小(请参见此线程上的说明)。 - toraritte