11

I often want a new empty vertical pane (vim window / viewport ...) in my current Vim tab.

I know I can get a new empty horizontal pane by doing control+w n.

I know I can split the current pane into two identical vertical copies with control+w v, but then I always resort to the awkward workaround of opening a new empty horizontal pane within this vertical pane and then closing the duplicate view of the original pane which I didn't want.

Is there a built in way to just get a blank vertical pane?

2 Answers 2

18

From :help vnew:

    Like |:new|, but split vertically.  If 'equalalways' is set
    and 'eadirection' isn't "ver" the windows will be spread out
    horizontally, unless a width was specified.

However, it seems like Vim does not provide a mapping for :vnew which creates a new blank vertical split. It's easy to create this mapping yourself. For instance:

nnoremap <leader>v :vnew<CR>
0

I found this solution:

  1. ctrl-w v Create a vertical copy of your current window
  2. ctrl-w ctrl-w Move to new pane
  3. ctrl-w n Create a new horizontal white pane above the second
  4. ctrl-w ctrl-w Return to second pane
  5. ctrl-w c Close second pane

This can be made into a mapping if desired:

nnoremap <leader>v <C-w>v<C-w>w<C-w>n<C-w>w<C-w>c
1
  • 1
    Welcome to Vi and Vim! I made some edits to your post, though I would agree that :vnew is simpler.
    – D. Ben Knoble
    May 12, 2021 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.