[LINUX] VIM is good to use — at least a sneak peek

VIM is a text editor mainly used under the LINUX environment. It is very quirky and looks like a product of another world to an inexperienced person, but after using it to some extent, you will be able to operate it smoothly so that you can learn how to ride a bicycle.

The good thing about VIM

-Reading and writing is very fast (usually, processing fails when reading and writing a huge amount of JSON etc.) -Since the range of key touch is narrow, the burden on the finger is small. -You can make some nice customs just by rewriting .vimrc (customization of next dream is troublesome because widgets may be involved and it becomes heavy depending on things)

That can be mentioned.

Recently, it seems that there are quite a few people who move to VS Code etc. and leave VIM, and people who do not use VIM from the beginning, but even if you do not code, I remember thinking about opening and editing files in Linux. It's best to keep it.

Below, I will explain the intro part for those who say that they have no experience with VIM, but who want to use it. If you remember this much, you will be able to do a little text processing other than coding without difficulty.

0. It is impossible to use all the functions suddenly

VIM has a lot of features, and I've been using it for less than a year now, and probably not even one-third of its potential. There is an article "Gachi VIMMER in a month" at the link destination, but at least it has not reached this area.

How to make newcomers vimmer in a month

Well, what kind of customization is convenient and what kind of command you want to use depends on the person, so it is important to gradually increase the commands that can be used by each person.

1. 1. Command rudimentary rudimentary

For the time being, let's work hard while using only the following commands at first. If possible, you can increase the number of other commands you use, but I think you can take the stance of "trying to use only this thoroughly for a month."

・ "I or o" and "ESC" Switching between edit mode and command mode. You can't do anything without it.

・ ": W" and ": q" Save and command to exit VIM. I can't do anything without this

・ "Hjkl" Move up, down, left and right. It seems that using the arrow keys is a bad idea, but I think it's unavoidable that the hand goes there a little. Thorough tied-up play will speed up your progress.

・ "Yy" "dd" "p" Copy, cut and paste. It corresponds to the whole line. You should be able to master this even if you force it. By the way, it copies the number of lines specified by "number + yy" (same for dd)

・ "Gg" "G" Warp to the last line or the first line.

・ "Shift + v" or "ctrl + v" Select any number of characters on multiple lines or one line. Then it can be yy or dd. There is a slight habit in the position to attach.

・ "/ (Character string)" and "n" If you enter a character string from "/" and press enter, it will warp to the location of the character string. After that, if you keep pressing n, you will jump to the next candidate.

For the time being, try using the above commands thoroughly. After that, I will increase what I can do at my own pace.

2. vimrc settings

Create a file called ".vimrc" in your root directory and write your favorite settings in it. Since each person's favorite settings are really different, you can select them by referring to the links below. However, for the time being, I think that it is very inconvenient if you do not make it possible to move the cursor to the right of the end of the line with "set virtual edit = onemore".

Write this in ~ / .vimrc without thinking! ~ Introduction to vim for beginners by vim ~

Recommended Posts

VIM is good to use — at least a sneak peek
Is R's do.call () a classical higher-order function? Learn how to use
It is convenient to use Layers when putting a library on Lambda
Django TemplateDoesNotExist at / is out! (Simple but addicted to half a day!)
Is it deprecated to use pip directly?
Emacs perspective.el workspace is easier to use
[Pandas] What is set_option [How to use]
How to use is and == in Python
It is more convenient to use csv-table when writing a table with python-sphinx
Creating a Python document generation tool because it is difficult to use sphinx