`
If you find these tutorials useful, Please consider making a donation.

TheFrugalComputerLinuxLogo.png
TheFrugalComputerGuy.png
Vim 8
Buffers







Video 23 - Buffers

From the PHP script, we jump to the mark in the Perl program, then answer the question where did the PHP script go? It went into a buffer.

A buffer is just a place in memory, so we can say the PHP script is in a buffer or the PHP script is still in the computers memory.

To see what is in the buffers we can type
:buffers and the shortcut for that is
:ls (LiSt what is in the buffers)

To see what is int the next buffer we would type
:bn (buffer next) and to go to the previous buffer we can type
:bp (for buffer previous)

If you make changes in a buffer, you will need to add a bang/exclaimation point or
:set hidden to move between your documents with unsaved changes.

If you have made changes and want to go back to the last saved document (or when you opened the document if you have not pressed save yet) type
:e!

To jump to a specific buffer type
:b(buffer number)

To close a single buffer type
:bd (for buffer delete)





 






Video 24 - Split Windows

Using Vim, you can split a window and look at and edit a file in two different places at the same time with the :sp command. :vsp will split the window vertically.

Holding down ctrl-w and then w will move the cursor to the next window.

ctrl-w s can also be used the split a window and ctrl-w v will split the window vertically

:q will close the window you are currently in.

You can open a different window into a vertical split window with :vsp filename
And you can exchange two windows using ctrl-w x

Ctrl-w r will rotate my open windows and ctrl-w R will rotation the windows in the opposite direction.

Other shortcuts:
ctrl-w t = go to top left window
ctrl-w b = go to bottom right window
ctrl-w h = go one window to the left
ctrl-w k = go one window up
ctrl-w l = go one window to the right
ctrl-w j = go one window down

The windows can be resized horizontally and vertically using :resize

ctrl=w o = show only this window

buffers can be opened into split windows with :ba

see all the things you can do with ctrl-w type
:help ctrl-w





 






Video 25 - Window Tabs

To open a file in a new window tab you would type
:tabedit filename and the shortcut is
:tabe filename.

The tab you are in will not be underlined

tabn, gt, and control page down takes you to the next tab
tabp, gT and control page up takes you to the previous tab

tabnew will open a new empty tab

:tabm will move the tab you are in to the far right
:tabm 0 will move the tab you are in to the far left

:q and :tabclose will close a single tab

:tab ball - will open all buffers each in it's own tab

:tabonly will close all tabs (leaving only the tab you are in open)

drop filename will go to that filename (if open in another window tab) or open that filename in that tab

Splitting windows works in tabs

:tab split will open the split you are in, in a new tab (Keeping it open it the split window)
ctrl-w, T will open the split you are in, in a new tab (removing it from the split window)