vim windows

I tend to want to work with three windows side by side. Two have the code I am working with, often production code on the left, test code on the right. The third window is the output from running commands to test the code.

I recently have decide to go all-in on vim, and it is progressing nicely. Thank you the Jake Worth for inspiring this. In Vim, the meta key for for doing windows operations is Ctrl-W. Here are a few commands I have gathered up from the internet. I will collect up the links where I get them at the bottom

To split and add new vertial window,

Ctrl-W vsplit <filename>

If you leave off the filename, it will open it with the existing file.

To Cycle between windows, use

Ctrl-W Ctrl-W

To move to the window to the left

Ctrl-W <left-arrow>

To move to the window to the right

 Ctrl-W <right-arrow>

To close the current window: :hide

 :hide

https://profkuperman.com/help/vim/windows.html

I want my windows 8 columns across. To do that, lead with the size.

80 Ctrl-W |

https://vi.stackexchange.com/questions/514/how-do-i-change-the-current-splits-width-and-height

An alternative is to use the :vertical command, which might be easier to remember

:vertical resize 80

https://vim.fandom.com/wiki/Resize_splits_more_quickly

To open a terminal in a window, use

:term

https://vi.stackexchange.com/questions/16903/show-external-command-output-in-preview-window

To navigate in the terminal window, first “disable it with”

Ctrl-w  Shift-n

Reenable it with

i

https://superuser.com/questions/1439330/scroll-up-to-in-vim-term

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.