vimtricks.wiki Concise Vim tricks, one at a time.

How do I make Vim always open new splits below and to the right instead of above and to the left?

Answer

:set splitright splitbelow

Explanation

By default, :split opens a new window above the current one and :vsplit opens to the left — the opposite of most modern IDEs and editors. Adding set splitright and set splitbelow to your vimrc reverses this, so splits behave in a more intuitive direction.

How it works

  • splitbelow — when set, :split and <C-w>s open the new window below the current one
  • splitright — when set, :vsplit and <C-w>v open the new window to the right

Both options only affect where the new window appears; the focus moves to the new window in both cases (unless nosplitbelow/nosplitright is combined with other options).

Example

Without these settings, running :vsplit file.txt in a single-window layout pushes the new window to the left, making the current file jump to the right side. With splitright set, the new window opens on the right and your current file stays in place.

Add to your ~/.vimrc or ~/.config/nvim/init.vim:

set splitright
set splitbelow

Or set both in one line:

set splitright splitbelow

Tips

  • Temporarily override per command: :topleft vsplit opens to the left regardless of splitright
  • Use :botright split to always open at the very bottom of the screen
  • These settings also affect :help, :terminal, and any plugin that opens a split window
  • Neovim users can set these in Lua: vim.opt.splitright = true; vim.opt.splitbelow = true

Next

How do I select an entire code block from opening brace to closing brace in visual mode?