For many years after the untimely death of Word 5.0 for DOS around the year 1995 I’ve been using editors with graphical user interfaces but I always craved for the software that operates instantaneously and there was no way to get it anymore.
    For a totally different reason I dove into the world of Linux and surely enough I bumped into the ‘cult of Emacs’ but at first didn’t notice the much quieter crowd of Vim users. Yes, Vim! Here you are! I want to say a few words about my new friend.

Moving through texts

    Only the people who really write texts themself know what a problem a single screen is. When you write on paper - you have pages, you probably have a pile or several piles of drafts around you, maybe you have a notebook or a notepad and browse through its pages and leave it open on one of them… you have multiple parts of your composition that you can look at simultaneously (at least from the corner of your eye). Of course this in not true with screens, they are only a small part of your field of vision, and it’s even worse with a single screen that is just that - a single screen occupying 10% of your field of vision or so. At some point in time long ago I realised how much of my precious time is being spent on this idiotic routine of opening and closing files, scrolling through directory trees and the texts themself and, most importantly, on what I would call ‘aiming’ at some particular single point on the screen where you need to place your cursor in order to start making corrections. Let me remind you that this precious time is gone forever and it’s a big question whether you will be able to achieve the proverbial ‘economy of scale’ later by doing everything digitally and on the screen from the very beginning. It’s important to understand that there are three interconnected tasks in this battle with the singularity of the screen, namely:

  • making a part of text visible in the window. The trick is to keep the image of a very long ‘page’ that you can look at through a ordinary page size window. And this window is moving down/forward or up/backward along this very ‘tall’ page. In this process you don’t care where the cursor is, you are looking at the text and reading it or rearranging the big blocks of it;
  • ‘aiming’ at a point in text where you want to make a correction, insertion or deletion. By ‘aiming’ I mean making a particular part of text with the cursor visible in the window in order to be able to perform the surgery on it. This process in its turn consists of two parts:
    • reading the text that immediately precedes or/and follows the change that you have in mind;
    • puting the cursor into an exact position required for the surgical intervention.

    I’ve already used twice the metaphor that I’m using to think about it - the surgic procedure with the help of a cursor/’scalpel’.
    To the point. Here are the important things that I learned about Vim/Neovim.

Once you’ve opened a file you can instantly move to the end of it and back.

gg - beginning of the file; G - last line of the file.

Moving the frame through which you see the text.

Ctrl-f - forward full screen; Ctrl-b - backward full screen.

Ctrl-d - down half screen; Ctrl-u - up half screen.

Shift content inside the window together with the cursor.

zt = z + CR - so that the cursor would be at the top;

zb = z- - so that the cursor would be at the bottom;

zz = z. - so that the cursor would be in the middle.

Shift the cursor only, keep the content as it is.

H - move the cursor to the highest line in the window;

L - move the cursor to the lowest line in the window;

M - move the cursor to the middle line in the window.

The lousiest part of editors created by programmers (for the sole purpose of editing their own programs of course!) is that they ignore the fact that what is inside the window can be… surprise! a meaningful text written by humans in human language. It has words, sentences, paragraphs and sections. In Vim you can be a human.

words and WORDS

w - move cursor to the first letter of the next word or WORD;
b - move cursor to the first letter of the previous word or WORD;

Small w or b considers commas and periods to be ‘words’ too, but the big letter commands consider only what is delimeted by spaces from both sides to be a WORD.

3W or 3B work beautifully, moving the cursor three hops forward or back.

e and E move forward as w but to the end of the word or WORD; ge - move to the end of the previous word.

Sentences and blocks.

( - hop to the first letter of the next sentence;
) - hop to the first letter of the previous sentence;

{ and } - move the cursor to the next blank line / previous blank line where the paragraph or section begins or ends (if it does).

Windows.

The most important command for Vim’s windows is a Ctrl-w two-finger movement of your left hand, you type another letter after doing it and you get a window action.

Maximizing - minimizing.

Ctrl-w + _ - maximize the hight of the current window;

Ctrl-w + | - maximize the width of the current window;

Ctrl-w + = - make all the windows the same size.

Jumping between windows is done with the ordinary h, j, k, l preceded with Ctrl-w

Ctrl-w + <h, j, k, l> - move to the window: on the left, below, above, on the right.

Creation of new windows.

Besides that you only need to open a new window with another file in it by splitting the window horisontally:

:new filename.txt - open the filename.txt in a window split horisontally;

:vert new filename.txt - open the filename.txt in a window split vertically.

Closing of a window.

A separate important way to think about all the realities inside Vim - the quit command, which closes the current window if there are several of them.

:q - just quit;
:q! - quit without saving whatever changes you have made (probably by accident);
:wq - write the changes made in the current window into the file, then quit.

Registers.

Registers are one of the biggest achievements of Vim even if not so many people understand that they can joggle their contence with the help of :let @a=@b assignments between the registers, the system clipboard ”+ and the text selected in the operating system which is accessible in “*.

Numbered

From “0 to “9; “0 is separate “1 - “9 are a stack. Vim fills this stack of registers with text from delete-like commands without an address of a target register and pops up the contence when the undo command is issued.
“0 - the most recent yank command…
“1 - the most recent delete or change command…
      …unless another register was specified.
With each successive deletion 1 is moved down the stack to 2 etc.etc., 9 is purged (and lost).

Named

From “a to “z. The main bunch, where you store the important chunks that you are planning to insert somewhere but don’t know yet where it will go. As I’ve said, you can assign them to each other with the help of :let …

Read-only

These can be used with the put and Put commands only.
”: - the most recent executed command-line;
”. - the last inserted text;
”% - the name of the current file;

”# - bla-bla ‘alternate file’ and it is writable; //not for humans

Expression

”= - is a way to use an expression in commands which use a register;

Selection and drop

“* - in selection (in the system);
”+ - dropped to (system) clipboard;
”~ - read-only, the result o last drag-n-drop;

Search pattern

”/ - ;

Small delete

”- - the ‘small delete’ register; the delete goes here if it is less than one line.

Programmer perversions

”“ - text deleted with the “d”, “c”, “s”, “x” commands;
“_ - ‘black hole’ register;