Which are the four navigation keys in vi
Last Updated :
25 Sep, 2023
In this article, we will cover how to efficiently navigate in the vi editor along with the basic four navigation keys we will look into some additional navigation keys to navigate seamlessly within the vi editor. First, we look at what Linux and VI editors and why we use them, what are its features and how can we use them.
Linux
Linux was developed by Linus Torvalds in 1991 as a hobby project. It is an open-source (source code that can be used by anyone freely) kernel that is most popular and widely used in the industry as well as in personal systems. There are various operating systems based on Linux kernel, some of the popular Linux distributions are Ubuntu, Cent OS, Red Hat, Debian, and Kali Linux.
VI Editor
Vi Editor is a widely used text editor in Unix/Linux systems and is known for its efficiency and flexibility. Vi editor was developed in 1976 by Bill Joy and later in 1991, an improved version of Vi editor was released which is known as VI IMproved (VIM). There are two modes in Vi Editor:
Navigation in Vi Editor
Vi editor provides a lot to commands/keys to navigates seamlessly within the editor but you must have to be in the command mode to navigate, to enter in command mode if you are in insert mode press Esc.
Basic 4 navigation keys
There are four basic navigation keys in vi editor to navigate in cardinal directions (up/down/left/right) which are as follow:
|
k
| Moves the cursor up one line
|
j
| Moves the cursor down one line
|
h
| Moves the cursor to the left one-character position.
|
l
| Moves the cursor to the right one-character position.
|
Examples:
We have discussed about the basic four navigation keys to move the cursor in four cardinal directions we have attached screenshots for each navigation key to demonstrate its moves:
1. To move cursor one line up (k)

2. To move cursor one line down (j)

3. To move cursor one character left (h)

4. To move cursor one character right (l)

Additional Navigation Keys
Apart from the basic navigation keys vi editor provides a lot commands/keys to navigate which are as follows:
|
0
| Positions cursor at beginning of line
|
$
| Positions cursor at end of line
|
W
| Positions cursor to the next word
|
B
| Positions cursor to previous work
|
(
| Positions cursor to beginning of current sentence
|
)
| Positions cursor to beginning of next sentence
|
H
| Move to top of screen
|
nH
| Moves to nth line from the top of the screen
|
M
| Move to middle of screen
|
L
| Move to bottom of screen
|
nL
| Moves to nth line from the bottom of the screen
|
Colon followed by a number position
| The cursor on the line number is represented by the number after the colon. For example, “:10” positions the cursor on line 10
|
Basic Vi Editor Guide
1. Create/Edit a file using Vi editor
vi filename
2. Insert Mode
To make any changes in the file first you need to enter in the insert mode to modify the file. To get into insert mode press button 'i' to enter in insert mode.
3. Command Mode
To run any command in the vi editor you have to first enter in the command mode if you are currently in the insert mode then press Esc and then ':' colon followed by your command to run your command in the editor.
Conclusion
In this article we have covered how to effectively navigate in the vi editor using basic four navigation keys and additional navigation keys along with an example, later we discuss a basic vi editor guide. If you want to deep dive into vi editor you can checkout this GFG article.
Similar Reads
How to define where to navigate when using the arrow keys in CSS ?
In this article, we will learn how to define where to navigate when using the arrow keys in CSS. Approach: We can do this task by using nav-up, nav-down, nav-right, and nav-up CSS properties together. These properties are used to navigate through the navigation key from the keyboard. The properties
2 min read
Chakra UI Navigation Link
Chakra UI Navigation Link are accessible elements used primarily for navigation and a versatile component designed to improve the navigation experience within web applications. Integrated seamlessly into Chakra UI, a popular React component library, this feature empowers developers to create interac
2 min read
Navigation in vi
Vi, a powerful and venerable text editor, is renowned for its efficiency and flexibility. However, to truly harness its power, you must become proficient at navigating through your text efficiently. In this comprehensive guide, we'll explore the art of efficient navigation in Vi, covering a wide ran
5 min read
Common iOS Navigation Techniques in Cisco
An IOS mode is a collection of commands used to customize a set of related features or to manage a specific area of the device. IOS modes are also referred to as IOS access modes and IOS command modes. There are five IOS modes: Â global configuration mode, privileged EXEC mode, user EXEC mode, setup
8 min read
Creating New Text Documents with the VI Editor
VI, short for "Visual Editor," is a modal text editor that operates in different modes: command mode, insert mode, and visual mode. Command mode is used for navigation and executing commands, insert mode is for inserting and editing text, and visual mode is for selecting and manipulating text. Creat
3 min read
What are Macro Keys and How to Use Them?
Nowadays computers are not only used to gather information, but also it is being used for entertainment purposes. From playing games to watching movies, these can be done with the help of computers. Sometimes there is a need to perform a series of tasks every moment of time on the computer. It seems
7 min read
File System Navigation Commands in Linux
Linux offers an alternative to the usual Windows and icons. The terminal might seem different at first, relying on text commands instead of a mouse. Unlike Windows, which relies heavily on a graphical interface, Linux gives you direct access to the core of your computer through text-based commands.A
7 min read
Overview of Navigation in Android Architecture Components
Navigation basically in mobile development refers to the interaction between different screens or pieces of contents within the application. Android Jetpack's architecture Component the Navigation is so powerful, providing a consistent and predictable user experience. The navigation component helps
5 min read
Navigation Drawer in Java Android
A Navigation Drawer is the UI panel that can show the app's main navigation menu. When the user swipes from the left edge of the screen or touches the app icon in the action bar and the drawer appears. It can provide a simple way to navigate between the different sections of the application. This ar
5 min read
Flutter - NavigationRail Widget
NavigationRail is a Flutter widget that allows creating a navigation bar at the left or right location of the screen. Like the bottom navigation bar which sticks to the bottom, we have a navigation rail that stays on one of the sides. NavigationRail is suitable for large viewports like on desktop or
3 min read