Why I stopped using Vim

They say that once you try Vim, you won’t go back.

For a developer, Vim can be dangerous. Especially if colleagues insist on using it, or at least subtly hint at it. It’s as if you were Neo from The Matrix, and suddenly on an ordinary, unforeseen day…

Oops! Glitch in the matrix.

The choice is yours. Then there will be no turning back. If you take the blue pill, the story will end, you will wake up in your bed and believe that GUI is power. Take the red one and you’ll be left in Wonderland, and I’ll show you how deep the Vim rabbit hole goes. Remember, I offer only the truth and nothing more.

Red pill or blue?

Would you prefer red or should we leave it at that?

Click – and you are back in everyday illusions…

Click and you will enter Wonderland…

I accept red

Like many of us, I chose the red pill. If you’re a programmer, you’ve probably heard jokes about how hard it is to get out of Vim and how learning it is like a roller coaster ride.

I'm always amazed to see someone try to leave Vim for the first time.

I’m always amazed to see someone try to leave Vim for the first time.

Contrary to popular belief, there are many reasons to use Vim. If you’re the type of programmer who enjoys life in the terminal and can easily get by without a GUI, then Vim is a great choice for code editing.

The clear advantage of Vim becomes obvious when connecting via SSH to remote servers. In such scenarios, VS Code is not very convenient, while it only takes a couple of seconds to enter “vim” from the keyboard and start editing. You don’t have to deal with potential issues with updates failing or conflicting with extensions. In such situations, labor-intensive debugging is guaranteed. In addition, VSCode is owned by Microsoft, but being an open source product, it is potentially vulnerable to attackers. Thus, the risk associated with using VS Code exclusively will not be justified. On the other hand, Vim as an editor has a strong reputation and will likely remain relevant even in 20-30 years.

What is Vim?

Vim doesn’t have any magic behind it. It is aimed at programmers.

As I delved into the mysteries of Vim, I began to develop an idea about it. This diagram shows its operation in a simplified form.

More advanced readers will see in it the so-called machine with a finite number of states (Finite State Machine, FSM)but for simplicity I will call it a diagram.

Source: StackOverflow Community, Vi editor as a finite state machine (FSM)

Source: StackOverflow Community, Vi editor as a finite state machine (FSM)

From the above diagram you can clearly see how the command is entered, and then by pressing < i > transition to insert mode. Next < ESC > returns us to the original mode. Now press < : > and switch to another mode using the < key w > changes are recorded.

This can be compared to how Git works, when after a combination git add And git commit changes are moved to the repository.

A set of important VIM commands
# Выйти
:q!
# Сохранить и выйти
:wq
# Отменить последнее изменение
u
# Отобразить номера строк
:set number
# Убрать номера строк
:set nonumber
# Изменение текста внутри () {} [] '' открывающих и закрывающих скобок
ci(/{/[
# Перемещение в начало строки
_
# Перемещение в конец строки
$
# Перемещение курсора вверх/вниз
j/k
# Перемещение курсора на 10 строк вверх/вниз
10j/10k
# Перемещение курсора влево/вправо
h/l
# Перемещение курсора на 10 символов влево/вправо
10h/10l
# Перемещение в начало файла
:1
# Или
Нажмите gg
# Перемещение в конец файла
:$
# К последней строке
G
# Открыть файлы в разных окнах по вертикали/горизонтали
vim -o/O file1 file2
# Разделить окно по горизонтали/вертикали
:split/vpslit -
# Открыть файл вместо текущего
:edit PATH/file1
# Перемещение между областями разбиения файла
CTRL+W , → ↑←↓
# Удалить слово
:dw
# Удалить 2 слова
:d2w
# Удалить всю строку
:dd
# Удалить 3 строки
:3dd
# Удалить до символа «а»
:dta
# Удалить от символа 'a'
:dfa
# Копирование/вставка
y/p
# Найти
:/pattern
# Открытие новой пустой вкладки в Vim
:tabnew
# Открыть вкладку с заданным файлом
:tabnew PATH/file
# Закрыть вкладку
:tabclose
# Перейти на следующую вкладку
:gt
# Перейти к предыдущей вкладке
:gT
# Переключение на первую/последнюю вкладку
:tabfirst/tablast

Or maybe take both pills?

After being exposed to the “red pill” for a long time, are you missing something? To me, despite the intuitive key bindings, Vim still felt too limited. I decided to experiment with plugins such as NERDTree, VimBundle, Plug, fzf, NeoVim, etc. But even with numerous customization options and Vim’s claims to be at the top list of editors, I still couldn’t shake the feeling of a strange emptiness.

Source: Wikipedia - Matrix

Source: Wikipedia – Matrix

What am I missing? — I asked the Oracle.

You miss the feeling. For the ones you can’t reproduce. Stop deceiving yourself, because the path goes not only where you are now, but also where you have already been.

And an understanding came to me – I was trying to deny the fact that I like the visual approach to writing code. The clarity of the GUI helps me. From viewing Git conflicts to linting, highlighting lines and everything in between.

Learning Java in BlueJ As a child, I realized the importance of the graphic aspect. Despite the perception that Vim is elitist, I am convinced that programming is a multi-faceted field. People have different preferences, with some being more inclined towards visual, auditory or mathematical approaches.

If GUI-based editors didn’t have their advantages, we wouldn’t have the various plugins, icons, and other add-ons for Vim. In its simplicity, it would resemble a regular terminal. Web interface Jupyter Notebook would not have been created if the Python REPL were really easy to use. There would be no need for PyPI or Git Kraken. Ironically, the very concept of Vim uses a mathematical paradigm in the form of a finite state machine (FSM), which is closely related to the class of graphics models. Visual and mathematical ideologies cannot simply be separated from code; they go hand in hand.

There is a middle ground: using VS Code with Vim key bindings. It helped me. The speed and efficiency of Vim combines with the rich capabilities provided by Visual Studio Code. It’s the best of both worlds. I wonder how many people use editors like this just to look cool even though they hate the tool?

conclusions

In conclusion, I want to say that my acquaintance with Vim was like taking the red pill and traveling to the land of traditional programming environments. Although Vim initially won me over with its efficiency and powerful command line interface, I soon realized the value of finding balance. Regardless of which approach you lean towards, it is important to find a middle ground. In my opinion, VS Code with Vim keybindings brings together the best of everything. Let’s remember: in our pursuit of coding mastery, we must achieve harmony and balance between efficiency and ease of work!

Similar Posts

Leave a Reply

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