Contents:

Learn: Profession Java Developer
Learn MoreOver 16 lessons, we'll cover all the essentials you need to get started with the Vim editor. Each lesson covers key features and techniques for effectively using Vim for text editing and programming. You'll master navigation, editing, file management, and plugins, helping you become a confident Vim user. Start your Vim journey with us and improve your code editing skills.
- the history of text editors;
- working in insert mode, command mode, command line mode, and visual mode;
- using regular expressions and creating macros;
- plugins and plugin package managers;
- Vim configuration, working with the .vimrc file (in particular, using the author's .vimrc file as an example);
- working with Neovim;
- setting up autocompletion.
Today we will present five video tutorials that will take a detailed look at how to effectively use the various modes of the Vim editor. You will learn the differences between the modes, as well as commands that will help increase your productivity and simplify your work in this powerful tool. Join us to master Vim's key features and improve your text editing skills.
How the course is structured
We offer video tutorials and text transcripts, allowing you to learn the theory in a convenient format. You can choose to watch videos or read text material, which makes it easy to absorb information.

The course author is a key figure with experience and knowledge in their field. Their professional path and achievements serve as the basis for creating high-quality educational content. The author shares unique methods and approaches that will help students achieve their goals. Course participants have the opportunity to learn from an expert who is ready to share not only theoretical knowledge but also practical skills. Importantly, the author constantly updates the material, taking into account current trends and market needs. This allows students to stay one step ahead and effectively apply their acquired knowledge in practice.
Team lead at Purple Magic, video producer at Red Magic, co-host of the IT Way podcast, and author of programming courses. Specializes in Ruby.
Overview of Vim Modes
A professional Vim editor doesn't use edit mode to change text. They use Insert mode exclusively to add new text, and can use the Backspace key to delete characters.
Many videos and articles about Vim in Russian claim that the editor has three modes. This statement is not without basis, as there are indeed three basic modes that every user should master: Normal mode (command mode), Visual mode (visual mode), and Insert mode (insert mode). However, in reality, Vim has more modes, each offering unique capabilities for working with text. Understanding all the modes will allow users to use the editor more effectively and significantly increase their productivity.
To get a list of the modes available in the version of Vim installed on your computer, open the Vim editor and enter the command :help vim-modes. This command will provide you with complete information about all the modes in Vim. Try using this command to better understand the functionality of the editor and optimize the process of editing text.

On the screen What you see here is my working Vim, which may differ from your version. For information about modes, enter the command :help vim-modes. You will immediately see a message informing you that "Vim has 7 main modes." Information about 7 additional modes is also available. In total, Vim has 14 different modes.
Let's look at the main points.
Normal mode, known to Russian-speaking users as command mode, is the mode that is active by default when you open the Vim editor. This setting can be changed depending on your preferences. In command mode, both standard and additional commands are available, allowing you to effectively edit text.
Visual mode, or Visual mode, allows you to select text and apply both standard and additional editor commands to it. In this course, we will explore the visual mode functionality and how to use it for effective content editing. Insert mode, also known as input mode, is a feature where the user can directly enter text. In this course, we will explore the features and uses of input mode in detail so you can use it effectively in your work. Select mode in Vim is similar to visual mode, but it is more convenient for mouse control. However, using a mouse in Vim can be questionable, as it violates the advantages of the ten-finger input method. In my Vim, this mode is disabled in the preferences. Command-line mode, or command line mode, is an essential part of working in the Vim editor. It is often overlooked when discussing Vim's capabilities. This mode is activated when the user begins entering commands in the line at the bottom of the editor screen. In command mode, you can execute various commands for editing text, managing files, and customizing Vim settings, making it an indispensable tool for working efficiently. Understanding and using the command line significantly increases your productivity when working with Vim.

Ex mode is a mode for working with the ex editor. The previous video didn't mention that Bill Joy, before developing vi, was creating line-based text editors. One of these editors he developed was called ex. It is a modification of the em editor, which in turn is an adaptation of the ed editor. In Vim, it was decided to retain the ability to use the ex editor in one of the basic modes, which allows you to use most of the features of ed. Some specialists prefer to use ex instead of sed in the terminal directly from Vim, as this is more convenient for them.
Terminal mode is a terminal mode in Vim that allows you to execute commands directly without having to open a separate terminal for your operating system. In this mode, you can enter any command, and Vim will automatically open a terminal, displaying the command's results. This significantly simplifies the process of working with the terminal and increases the efficiency of using Vim.
Let's look at the most frequently used additional modes in Vim. These modes significantly expand the editor's functionality and allow you to work more efficiently with text.
Replace mode, also known as Replace mode, functions similarly to Insert mode. However, in this mode, each new character replaces the one already in the text as you type. This behavior is reminiscent of standard text editors after activating the Insert key. Replace mode is useful for quickly editing text, allowing you to easily replace characters without having to delete them manually.
Visual Replace mode is a visual replacement mode that offers advanced features and granular control over the replacement process. This mode provides a more intuitive interaction with content, allowing the user to easily edit text and make changes visually. With these additional options, Visual Replace mode becomes an indispensable tool for those who value precision and ease of editing.
Insert Normal mode provides the ability to execute a single command directly in Insert mode. This simplifies the text editing process, allowing users to make changes quickly and efficiently without having to switch between different modes. This functionality is especially useful for programmers and editors who work with large amounts of information and require increased command execution speed. Using Insert Normal mode significantly streamlines the workflow, making it more intuitive and convenient.
If you want to execute a command, for example, move the cursor five lines down, use the keyboard shortcut Ctrl + o to switch to Insert Normal mode. This method significantly speeds up your work.
Note that you can familiarize yourself with the capabilities of the different modes in the Vim documentation. Each mode contains Help topics that describe commands and functions in detail. For example, entering :help Select-mode will give you information about Select mode. Studying these topics will help you better understand and use the features of the Vim editor.
Various articles and videos about Vim often mention three main modes: command, insert, and visual. These modes are the foundation of working in the editor, as most other modes are combinations or minor variations of these three. However, knowing additional modes can significantly improve task efficiency and speed up your workflow.
Command Mode
If you're just starting out with Vim, we recommend printing out the Vim cheat sheet. This cheat sheet will help you quickly master the editor's basic commands and functions, significantly simplifying the learning process. With the Vim Cheatsheet, you can work with text efficiently and quickly memorize keyboard shortcuts and commands. This will be a great support at the initial stage of your acquaintance with Vim.

Print the material, laminate it for durability to avoid wear and tear, like with GTA cheat code slips, and place it on your desk. If you have any questions, check out the Russian translation of this cheat sheet for better understanding.
There are many commands available in this mode, and it's difficult to find a specialist who can remember them all. Every Vim user has their own familiar commands that they use regularly. Even experienced users who have been working with Vim for many years sometimes come across commands they didn't know about while watching others work. In this video, we will focus exclusively on the basic commands that will help you improve your efficiency in the editor.
I came across a video that explains all the commands in command mode in detail. The video is 2 hours and 57 minutes long. It is important to note that plugins often add new commands to both command mode and command line mode. These add-ons can significantly expand the program's functionality and usability.
This is a file with Ruby code and syntax highlighting settings. This text presents the basic commands for working in command mode. These commands will help you effectively interact with Ruby and optimize the development process.

Navigation in Vim's command mode is controlled by the hjkl keys, which allows the user to remain focused on the text input area without having to move their hands to the arrow keys. Although Vim has arrow key navigation enabled by default, it is recommended to disable this feature. This will help you avoid the temptation to use the arrow keys and focus on the efficient navigation using the hjkl keys, which will help you learn the editor faster and be more productive.
There are two additional methods for basic text navigation. To move down 5 lines, use the 5j command. To move up 5 lines, press 5k. For more convenient use of these functions, it is recommended to display line numbers on the screen. This will allow you to see the current line number and track your movement up and down, eliminating the need to do mental calculations.
A second way to navigate through code is using the line number. Most compilers, interpreters, and code analyzers display the file and indicate the line number where the error was detected. To quickly jump to a specific line, for example, 145, simply enter :145. This method allows you to effectively find and fix problems in your code, which is especially important for developers striving to improve the quality of their software.
To quickly jump to the beginning of a file, use the gg command, and to move to the end of a file, use Shift + g (or capital G). These commands allow you to effectively navigate through text documents, significantly speeding up the process of editing and viewing content.
Centering the screen is a convenient navigation method that allows you to focus on the current line. To do this, enter the zz command. This will center the line you are on on the screen, making it more comfortable to view and edit text. This method helps you quickly find the sections of code you need and improves overall work efficiency.
The keyboard shortcut Shift + H moves the cursor to the first line on the screen, and Shift + L moves to the last line. These combinations are useful for quickly navigating through text, allowing you to effectively manage editing and viewing content. Using these keyboard shortcuts increases productivity when working with text editors and makes it easier to access the parts of a document you need.
To move forward one word, press w. To move back one word, use b. If the cursor is in the middle of a word, pressing w will move it to the end of that word, and pressing b will move it to the beginning.
You can move through the text using the find function. To do this, press f (find), and then type the character you want to move the cursor to. To move to the next occurrence, press n, and to backspace, press Shift + n. To move to the second occurrence, you can use 2fw. Shift + f works similarly, but in this case the search will be performed from the current cursor position to the beginning of the file. This method significantly simplifies navigation and speeds up working with text.
The U key in the Vim editor functions as an undo. It allows you to easily undo any changes, such as pasting text, applying regular expressions, calling plugin commands, or running macros. Using the U key greatly simplifies editing and increases your efficiency in Vim, giving you the ability to quickly correct mistakes and revert to previous document states.
The . (period) key in Vim allows you to redo almost any action you've performed, including pasting and running commands. However, it cannot redo the undo action performed with the u key. It is important to note that redo may not work correctly in some cases, especially when using plugins that format or modify code on their own.
The X key deletes the character under the cursor. This feature is useful for editing text, allowing you to quickly and efficiently remove unwanted elements. Using the X key makes editing easier and improves the speed of working with text.
The d key is used for deletion, but it requires arguments, which are specified using other keystrokes. Pressing d again deletes the current line. To delete three lines down from the cursor, enter d3j, and to delete three lines up, enter d3k. To delete text up to a specific character, use the d + f combination. For example, to delete everything up to the closing parenthesis, enter df. To delete text up to the second closing parenthesis, use the d2f command. To delete the current word to the end, enter dw, and to delete the current word to the beginning, enter db. These combinations allow you to effectively manage text and significantly speed up the editing process.
The d key in text editing not only deletes but also cuts the selected fragment. After using this key, if we press p (paste), the cut text will be pasted at the current cursor location. This function applies not only to lines, but also to any other text fragments that were cut using the d key and its arguments. Thus, cutting text provides a convenient way to move and edit content.
Copying in the Vim editor is done with the yank command, which is activated by the y key. To copy a line, press yy. You can then navigate to the desired location in the file and paste the copied fragment by pressing p. Copying uses the same arguments as the delete command, allowing you to delete multiple lines, individual words, and other text elements.
To successfully promote your content in search engines, it is important to consider several key aspects. First, use relevant keywords that match the interests of your target audience. This will help improve the visibility of your site in search results. Second, make sure your text is structured and easy to read. Divide it into paragraphs, use subheadings, and highlight important points.
Don't forget about meta tags and descriptions, which help search engines understand the content of your page. Optimize images by adding alt attributes with descriptions to improve accessibility and SEO. Regularly updating content will also positively impact your search engine rankings.
Finally, consider adding internal and external links to improve navigation and your site's authority. Following these recommendations will significantly improve the effectiveness of your online promotion.
- We can change the case of the letter the cursor is on using the Shift + ~ combination. Pressing this key combination will change the case of the character you want to use and automatically move the cursor forward one step.
- If your cursor is on a number, the key combination Ctrl + a will increase the number by 1, and Ctrl + x will decrease it by 1. This works not only for single-digit numbers, but also for any numbers in this range - from -18446744073709551615 to 18446744073709551615.
In the next video, we will discuss the command line mode, its functions and capabilities. You will learn how to effectively use the command line to perform various tasks and manage the operating system. We will cover the basic commands and their applications, which will help you increase your productivity on your computer. Don't miss out on helpful tips and tricks for optimizing your command-line experience.
Command Line Mode
In this video, we'll take a closer look at the command line mode in the Vim editor. The command line is located at the bottom of the editor and takes up one line, which is enough for running common commands. We'll quickly introduce you to the basic command line features in Vim that will help improve your productivity and simplify your work with text.
In command mode, you can quickly switch to the command line by simply starting to type a command. Typically, all commands begin with a slash, colon, or question mark. To exit the command line, press the Esc key. This simple control allows you to effectively interact with the system and perform necessary actions.
In command mode, the f key searches for individual characters, but using the command line, you can find words and any other character sequences. To do this, type / followed by the search word. Then, to move to the next or previous occurrences of the word in the file, use the n and Shift + n keys, respectively. This approach significantly simplifies working with text and increases editing efficiency.

Search by slash is performed from the current cursor position to the end of the file. Searching from the cursor to the beginning of a file uses the same logic as in command mode. In this case, use a question mark instead of a slash.
Regular expressions can be used to search and process text on the command line. It's important to remember that all special characters in Vim are interpreted as regular expression elements, not as ordinary text characters. If you want to search specifically for these characters, rather than their functional meaning in regular expressions, they must be escaped with a backslash. This knowledge is key to using regular expressions effectively in Vim, which can significantly simplify working with text and increase productivity.

To highlight all occurrences of a word in Vim, type /word and then :set hlsearch. To disable highlighting, use :set nohlsearch. While this may seem inconvenient, you can bind these commands to keys or key combinations in Vim's preferences. It is also possible to enable highlighting by default in Vim. We will cover Vim configuration in future videos.
Going to a specific line in a file is an important feature in command-line mode. We mentioned this feature in the previous video. To jump to a specific line, you need to enter a colon and a line number. This command allows you to quickly navigate through a file, which significantly speeds up the editing process and improves your efficiency.
Vim has the ability to execute standard terminal commands. To do this, simply type :! and then specify the desired command. After pressing Enter, you will see the result of this command right in the Vim window. This functionality is especially useful when you need to quickly execute a single command without the need to open a separate terminal. Vim thus allows you to work more efficiently by integrating terminal functions directly into the text editor.
Vim offers a standard set of commands that can be used from the command line. One of the most commonly used commands is search and replace. For example, if you need to replace the name of a variable, you can use the following command: :%s/old_variable/new_variable/g. Here, : denotes the command prompt, % indicates that the action will be performed on all lines, and s indicates that the replacement will be performed. /old_variable is the word to replace, and /new_variable is the new name of the variable. The letter g at the end of the command tells Vim to replace all occurrences of the specified word on each line. This command is a powerful tool for quickly editing code and optimizing your workflow in the Vim editor.

If you run this command without With the g flag, it will replace only the first occurrence on each line. It's important to remember that this function works differently than variable substitution in regular editors. It will replace all the words it finds. So, if you replace the word user with admin, and the word user also appears in the names of other variables and functions, Vim will replace it in all instances. Be careful when using this function to avoid unwanted changes to your code.
To perform substitutions within a single line, use a similar syntax, but exclude the percent signs.
Regular expressions can be useful here as well. For example, if you need to replace words that appear only once in a line, you can use the ^$ construct with the :s/^old_variable$/new_variable/g command. This allows you to precisely target the words you're looking for and replace them with the desired values without affecting other words. Regular expressions are a powerful tool for text processing, allowing you to perform complex operations with minimal effort.
One of the common functions in text editors is the g (global) command. It allows you to edit all lines that match a given regular expression. For example, the command :g/user/d allows you to delete all lines containing the word "user". In this case, the letter d at the end of the command stands for the delete operation. Using this function greatly simplifies the process of working with text files, allowing you to effectively manage their contents and make changes quickly.
To open a file in a new window, use the command :new filepath. To open a file in the current window, use :e filepath. By default, new windows are opened with a horizontal split. To open a file in vertical mode, enter :vs filepath. Note that the relative path to the file is determined from the directory in which the Vim editor was started.
In a standard terminal, you can view the command history using the up and down keys. There is also a feature to display a complete list of all previously entered commands. To do this, enter the command :his, which is short for :history. This allows you to effectively manage and repeat commands, improving your productivity in the terminal.
The :q command in the Vim editor is designed to close the current window. At the beginning, we mentioned that to exit Vim, you only need to use the :q command. However, it is worth noting that this command only closes the active window. To close all open windows in Vim, you need to use the :qa command, where the letter a stands for «all». This will help you effectively exit the editor and avoid having to close each window individually.
To save the file open in the current window, use the :w command. If you want to save all open files, enter :wa. To save changes and exit the current window, use the :wq command. To save all files and exit all windows, use :wqa. These commands are the basic ones for managing files in a text editor.

I recommend binding the :q and :wq commands to keys or key combinations for more convenient work. I have these commands assigned to F3 and F4. In the following video tutorials, we will look at how to do this in detail.
Insert Mode
In this video, we will discuss Insert Mode and start coding. We will take a detailed look at how to properly use Insert Mode in programming. Join us to learn practical tips and tricks that will help you better understand this topic and improve your coding skills.
Important point: In Insert Mode, a real vimer is limited to text entry only. The process of editing text is carried out using the features of other modes.
Staying in Insert Mode all the time while editing text leads to inefficient use of time. In this mode, your main task is to enter text. The only additional thing you can do is use the Backspace key to correct typos. All other changes are best made in other editing modes. When navigating through a document, you should also use Command or another appropriate mode, not Insert mode. This will significantly increase your productivity and simplify the editing process.
There are several methods for switching from Command mode to Insert mode. The easiest way is to press the i key. This will allow you to enter text at the cursor's location. To return to Command mode, simply press the Esc key. This process is the basis for working with text editors such as Vim and allows you to edit documents efficiently.

- If you want to start To start typing at the next character after the cursor, type a.
- To replace the current character and enter Insert mode, press s.
- To start typing on a new line below, press o; to start typing on a new line above, press Shift + o.
- To enter Insert mode and immediately move the cursor to the end of the line, press Shift + a.
- To delete everything from the cursor to the end of the line and enter Insert mode, press Shift + c.
- To delete a line and immediately enter Insert mode, press cc.
When using the formatting settings for a specific programming language in Vim, the cursor does not move to the beginning of the line, but remains in the position corresponding to the beginning of the code. This helps preserve correct indentation and code structure, which greatly simplifies the editing process and makes it more convenient for developers.
To start typing from the beginning of the current line, press Shift + i. This simple trick will help you quickly return to the beginning of the line and continue typing without extra effort. Use this feature to improve your text workflow and make editing easier.
Edit mode is a simple interface where users can enter text. All entered characters are processed as normal text without any additional actions. However, it is worth noting that formatting is provided in edit mode. If you have configured the editor for a specific programming language, it will automatically apply the appropriate formatting rules. For example, when you press Enter, the editor will create the necessary indentation, which significantly simplifies the process of writing code and makes it more structured.
In this mode, the hjkl keys cannot be used for navigation, since only the arrow keys are available, which we have disabled. Therefore, in insert mode, the cursor can only be moved using the Backspace key. However, this is not a problem, since other commands can be performed using other modes.
Visual mode
In this video, we'll discuss visual mode in Vim and look at the key differences between visual mode and selection mode. Visual mode lets you conveniently select text for later editing, while selection mode is designed for working with text in a more limited scope. Understanding these differences will help you improve your productivity in Vim.
Visual mode is a convenient tool for editing large amounts of text. To enter visual mode from command mode, press v. To exit this mode, use the Esc key. Visual mode allows you to use the navigation keys to select text. In this mode, not only the hjkl keys work, but other navigation methods also work. For example, pressing 10j will select 10 lines down from the current cursor position. Once the text is selected, you can execute commands available in command mode.
To change the variable user to admin, press v to enter selection mode. Then, move to the end of the function and use the command :s/user/admin/g to perform the replacement. Note that this replacement will only occur within the selected section of code. If you have commands for commenting and uncommenting, you can also use them in this mode. These commands will act exclusively on the selected fragment of code.

Selection mode functions similarly, but in visual mode entire lines are selected. With this mode, you can control the selection of rectangular blocks of code, which greatly simplifies working with text and code structure. This allows you to edit and format content more efficiently, improving overall readability and organization.
This method is ideal for certain unique cases. For example, when you have a CSV file containing names, phone numbers, and an unknown ID. In such situations, you can efficiently extract only the names and phone numbers, ignoring the rest of the data. This approach allows you to optimize information processing and focus on the necessary data.
In command mode, I can execute commands, and to enter selection mode, I use the keyboard shortcut Ctrl + V. Then I select the ID on the first line and enter 10000j. After that, I press the x key, and all unnecessary data is removed. This method is simple, effective, and does not require creating regular expressions.
Visual mode and selection mode in Vim can be replaced with other modes or macros, which we will cover in subsequent videos. However, these modes significantly simplify and speed up many specific operations, making working with text more efficient. By mastering these features, you can significantly improve your productivity when editing and managing text in Vim.
Reading is an important aspect of our lives, providing us with the opportunity to immerse ourselves in new ideas and expand our horizons. It not only develops our thinking but also helps improve our communication skills. It's important to choose a variety of sources to enrich your experience and knowledge. Reading books, articles, and scientific research helps develop critical thinking and the ability to analyze information. Furthermore, regular reading can be a great way to relax and unwind from the daily grind. Don't miss the opportunity to discover new worlds through books and other materials.
- GNU Emacs: How a 1980s Text Editor Teaches Programmers the Value of Free Software
- "I Was Surprised When I Wrote the Code, and It Worked": The Life of a Beginning Python Developer
- What is Software Testing and Why Do We Need It?
Java Developer Profession
You will learn Java programming from scratch and create web applications using the Spring framework. In six months, you will gain fundamental skills and build a portfolio, and we will help you find a job.
Find out more
