Search code examples
vim

Position a Quickfix window to the bottom down globally


I setup my vim with amix/vimrc. The Quickfix window is below NERDTree, as shown below.

enter image description here

How do I move it to the bottom down? I followed this thread, and added the following codes to my_configs.vim

augroup DragQuickfixWindowDown
    autocmd!
    autocmd FileType qf wincmd J
augroup end

However, the Quickfix window is still on the bottom right.

My desired behaviour like this,

  • Open Quickfix window automatically after running :make
  • The Quickfix window is on the bottom with full width

enter image description here

My related settings are,

"a global quickfix window on the bottom down
augroup DragQuickfixWindowDown
    autocmd!
    autocmd FileType qf wincmd J
augroup end

" Open Quickfix window automatically after running :make
augroup OpenQuickfixWindowAfterMake
        autocmd QuickFixCmdPost [^1]* nested cwindow
        autocmd QuickFixCmdPost    1* nested lwindow
augroup END


"compile and run
" Quick compile and run kinds of files via ,p
nmap <F10> :call <SID>compile_and_run()<CR>

function! s:compile_and_run()
    exec 'w'
    exec 'vertical rightbelow copen 80'
    exec 'wincmd w'
    if &filetype ==# 'c'
        exec 'AsyncRun! gcc % -o %<; time ./%<'
    elseif &filetype ==# 'cpp'
       exec 'AsyncRun! g++ -std=c++11 % -o %<; time ./%<'
    elseif &filetype ==# 'rust'
       exec 'AsyncRun! rustc %; time ./%<'
    elseif &filetype ==# 'java'
       exec 'AsyncRun! javac %; time java %<; rm -f *.class'
    elseif &filetype ==# 'sh'
       exec 'AsyncRun! time bash %'
    elseif &filetype ==# 'python'
       exec 'AsyncRun! time python3 "%"'

Solution

  • Put this command in a file stored in this path ~/.vim/after/ftplugin/qf.vim :

    wincmd J " Forces QFW to go to bottom of screen across all windows
    

    Reload vim and the quickfix window should be at the bottom.