justinmk / vim-dirvish

Directory viewer for Vim :zap:
Other
1.18k stars 64 forks source link

Open preview-window below and not to the right #201

Closed astier closed 3 years ago

astier commented 3 years ago

Right now if I press p to preview the file/dir under the cursor a preview-window opens to the right side of the dirvish-buffer. Is it possible to open it below? Thank you.

idbrii commented 3 years ago

Look at the definition of p and you can remap it locally:

:Verbose map p

n  p           *@:<C-U>.call dirvish#open("p", 1)<CR>
    Last set from ~\.vim\bundle\dirvish\ftplugin\dirvish.vim line 33

As noted in :help dirvish-options, you can use the dirvish Filetype to customize.

~/.vim/after/ftplugin/dirvish.vim:

nnoremap <buffer> p :<C-U>.call dirvish#open("p", 1)<CR>:wincmd K<Bar>wincmd =<CR>

That replaces the default p with your own that also adjusts the window layout to your liking. You could also use resize 100 instead of wincmd = to give your dirvish window height 100.

astier commented 3 years ago

Thank you!