Neovim: How to use Buffers, Windows and Tabs ver. 2

Last Updated on July 28, 2022 by shibatau

I. Buffers, Windows and Tabs

Now suppose you have four files in the current directory:

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:

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

:ls

Run the following command to split the window:

:split

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

Run the following command:

:buffer2

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

Run the following command:

:vsplit sample3.txt

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

To be continued.

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

:tabnew sample4.txt

Let’s show all the tabs:

:tabs

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

II. The commands

Buffers

: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

: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

Windows

: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

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

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