Skip to main content
vimhelp links
Source Link
Jake Grossman
  • 1.7k
  • 1
  • 5
  • 16

Use :h :wincmd:h :wincmd to go to the previous window with :h CTRL-W_p:h CTRL-W_p, leaving your cursor where you were before the split.

Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | wincmd p

Use :h :wincmd to go to the previous window with :h CTRL-W_p, leaving your cursor where you were before the split.

Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | wincmd p

Use :h :wincmd to go to the previous window with :h CTRL-W_p, leaving your cursor where you were before the split.

Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | wincmd p
Use wincmd
Source Link
Jake Grossman
  • 1.7k
  • 1
  • 5
  • 16

Use :h CTRL-W_p:wincmd to go to the previous window with :h CTRL-W_p, leaving your cursor where you were before the split. 

Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | exec "normal!wincmd \<c-w>p"p

Note that normal! must be wrapped in an exec command in order to use printable characters (\<c-w>) to represent special characters.

Use :h CTRL-W_p to go to the previous window, leaving your cursor where you were before the split. Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | exec "normal! \<c-w>p"

Note that normal! must be wrapped in an exec command in order to use printable characters (\<c-w>) to represent special characters.

Use :h :wincmd to go to the previous window with :h CTRL-W_p, leaving your cursor where you were before the split. 

Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | wincmd p
Source Link
Jake Grossman
  • 1.7k
  • 1
  • 5
  • 16

Use :h CTRL-W_p to go to the previous window, leaving your cursor where you were before the split. Following your example, to create a window 10 lines tall at the bottom of the tab, then return to the previous cursor position:

:botright 10new | exec "normal! \<c-w>p"

Note that normal! must be wrapped in an exec command in order to use printable characters (\<c-w>) to represent special characters.