More weirdo Vim hacks dealing with Windows

OK, normally, I don’t use vim windows, they are really tiles, so I normally use separate windows and tools like Divvy and Hammerspoon to move windows around. Still, it is sometimes good to be able to see multiple windows particularly if you want to copy and paste between them. I haven’t spent much time learning the various window commands with Ctrl-W or the Window command. So if here are the commands I’ve used. Note that many of the commands have a : equivalent so you can say :vsplit a_new_file.py and it splits and opens at the same time

  1. CTRL-W CTRL-S or Ctrl-W s. :split horizontally split with the current buffer so that you can look at two parts of the file
  2. Ctrl-W v or CTRL-W, CTRL-V. :vsplit vertically and you can look at two parts of the same file
  3. Ctrl-W n or CTRL-W CTRL-N:new horizontal split with an empty buffer so you can :e a new file
  4. Ctrl-W Ctrl-W or Ctrl-W w. This switch between the windows that are open, The Ctrl-W, Ctrl-W is nice because then you don’t need to release the control key.
  5. Ctrl-W CTRL-P or Ctrl-W p. Go to previous window
  6. Ctrl-W <arrow key>. To go to the left, right, above or lower windows

Then to get rid of windows

  1. Ctrl-W c. Close the window although :bd or buffer destroy also works
  2. Ctrl-W o. Only leave the current windows open, close everything else

Here are some less used command that are helpful:

  1. Ctrl-W n. A new split for horizontally and then open a blank window
  2. Ctrl-W p. Previous

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect

Recent posts

Loading Mastodon feed…