Last Updated on March 27, 2023 by mishou

I. Buffers, Windows and Tabs

Now suppose you have four files in the current directory:

image of thefour sampl texts

Run the following command in the terminal:

nvim sample1.txt sample2.txt sample3.txt sample4.txt

You can see the buffer 1 in a window:

fuffer 1

Run the following command and you can see a list of the four buffers opened.

list of buffers

Run the following command to split the window:


Now you have created two windows and the buffer 1 is shown in each of the windows.

vertically separated

Run the following command:


Now you have shown the buffer 2 in the second window.

fuffer 1 abeve fuffer 2

Run the following command:

:vsplit sample3.txt

You have created the third window and shown the buffer 3 in the window.

fuffer 1 above buffer 2 and 3

To be continued.

Now run the following command to create a new tab for sample4.txt:

:tabnew sample4.txt
new tab

Let’s show all the tabs:


Now you have two tabs. One of them is of three windows and the other has one window:

list of tabs shown

II. The commands


:ls Show all the buffers

:buffer filename To open a file in the list of buffers (you can use Tab key)

:edit filename To open a file in a new buffer

:bufferN (N is buffer number)

:bnext To go to next buffer

:bprev To go back to the previous buffer


:tabs Show all the tabs

:tabnew file.txt Open file.txt in a new tab

:tabclose Close current tab

:tabnext Go to next tab

:tabprev Go to previous tab


:split filename Sprit window horizontally

:vsplit filename Split window vertically

:new filename Create new window

<Ctrl-w>+c Close a window

<Ctrl-w>+h/j/k/l Moves the cursor to left/bottom/top/right

By mishou

Leave a Reply

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