Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 20, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 20, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 20, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 20, 2025

      Helldivers 2: Heart of Democracy update is live, and you need to jump in to save Super Earth from the Illuminate

      May 20, 2025

      Qualcomm’s new Adreno Control Panel will let you fine-tune the GPU for certain games on Snapdragon X Elite devices

      May 20, 2025

      Samsung takes on LG’s best gaming TVs — adds NVIDIA G-SYNC support to 2025 flagship

      May 20, 2025

      The biggest unanswered questions about Xbox’s next-gen consoles

      May 20, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      HCL Commerce V9.1 – The Power of HCL Commerce Search

      May 20, 2025
      Recent

      HCL Commerce V9.1 – The Power of HCL Commerce Search

      May 20, 2025

      Community News: Latest PECL Releases (05.20.2025)

      May 20, 2025

      Getting Started with Personalization in Sitecore XM Cloud: Enable, Extend, and Execute

      May 20, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Helldivers 2: Heart of Democracy update is live, and you need to jump in to save Super Earth from the Illuminate

      May 20, 2025
      Recent

      Helldivers 2: Heart of Democracy update is live, and you need to jump in to save Super Earth from the Illuminate

      May 20, 2025

      Qualcomm’s new Adreno Control Panel will let you fine-tune the GPU for certain games on Snapdragon X Elite devices

      May 20, 2025

      Samsung takes on LG’s best gaming TVs — adds NVIDIA G-SYNC support to 2025 flagship

      May 20, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Absolute Essentials You Need to Know to Survive Vi Editor

    Absolute Essentials You Need to Know to Survive Vi Editor

    December 24, 2024

    Absolute Essentials You Need to Know to Survive Vi Editor

    Vi is on almost every Unix and Linux distribution, so why not take advantage of it?

    VI, pronounced as distinct letters /ˌviːˈaɪ/ it’s a terminal-based text editor. One of the most common tools in Unix, VI is extremely powerful for text manipulation. Although it could be a little bit challenging. And that’s why I am listing the absolute basics of the Vi editor commands in this article.

    📋
    Vim is a popular fork/clone of VI. It includes additional features like syntax highlighting, mouse support (yes, you read that right) and more. Basic commands and keyboard shortcuts remain the same in both VI and Vim. So if you learn Vi, you are automatically learning the basics of Vim and other descendants of Vi.

    Why you should learn Vi?

    Here are five reasons why I recommend learning Vi and Vim:

    1. Vi/Vim is free and open source. And remember this is it’s foss!!
    2. Vi is always available since it’s required by POSIX.
    3. Vi/Vim is well documented. And it also has its own user manual; you only need to type :h in command mode. I’ll discuss command mode later in this guide.
    4. Vi/Vim has a lot of plugins. Vim Awesome is one of the most popular websites to download extensions.
    5. It does not consume a lot of system resources, and you could do a lot of tasks, even write novels in Vim.
    ✋
    It is not uncommon for some distributions to replace Vi with Vim. Even if you are using Vi commands, it runs Vim.

    Launch Vi

    To execute the program, you must type vi:

    vi
    Absolute Essentials You Need to Know to Survive Vi Editor

    Also, you could open a file by providing its name. It will open the file for editing if it exists, or create a new one if it does not exist.

    vi your_file.txt
    Absolute Essentials You Need to Know to Survive Vi Editor

    Vi modes

    You must understand that Vi has 2 different modes:

    • Normal or command mode: This is the mode you use for navigating and copy-pasting
    • Insert mode: This is the editing mode where you actually type text

    Using Normal mode in Vi

    💡
    This is the default mode when VI/Vim opens.

    The Normal mode is used for actions like navigation, copy, paste, delete, text substitution (not editing), etc. You always could go back to this mode by pressing <Esc>.

    1. Movement commands

    These are the movement keys:

    • h: Left.
    • j: Down.
    • k: Up.
    • l: Right.

    2. Deletion commands

    • x: It’s like the delete key. Delete the character under the cursor.
    • dd: Deletes the current line.

    3. Copy and paste

    • y: Yarn (Copy) command. Copies the selected text.
    • yy: Yarn (Copy) command. Copies the current line.
    • p: Paste. After using a copy command, it pastes the content after the cursor.

    (Command Mode)

    💡
    In fact, this is not a different mode (that’s why parentheses are used), but it’s important to separate it because it’s where you could type orders and commands

    In normal mode, you could use commands by typing :.

    For example, if you want to save your text and exit Vi, you can type:

    :wq

    Absolute Essentials You Need to Know to Survive Vi Editor

    Other common Vi commands you can use in normal/command mode:

    • :h: Help
    • :%: Means all the lines
    • :s: Used for search (and substitutions)
    • :/foo/ : Regex to find items to replace
    • :/bar/: Regex to replace items with
    • :u: Undo last action
    • :w: Save
    • :q: Quit
    • !: Forces order

    I have added : in front of each command so that it is easier to note that you have to use : to use the commands.

    Insert mode

    💡
    In this mode, you could edit and manipulate the text.

    You could enter this mode by pressing the letter i in Normal Mode and start typing whatever you want.

    Absolute Essentials You Need to Know to Survive Vi Editor
    Look at the bottom left to check insert mode
    • i: Enter in Insert mode. Lets you insert, before the current cursor position.
    • I: Lets you insert at the beginning of the line.
    • a: Lets you append after the cursor.
    • A: Lets you append at the end of the line.

    Visual Mode (only in Vim)

    💡
    In this mode, you could select text visually, which is very useful when working with large paragraphs.

    You could enter this mode by pressing the letter:

    • v: Character mode
    • V: Line Mode
    • Ctrl+V: Block mode

    Learn more about the visual mode in Vim here.

    Visual Mode in Vim [Beginner’s Guide]
    There are three modes in Vim and the least popular and yet quite interesting is the Visual mode. Learn more about it.
    Absolute Essentials You Need to Know to Survive Vi EditorLinux HandbookPratham Patel
    Absolute Essentials You Need to Know to Survive Vi Editor

    A “vi” bit of history and trivia

    💡
    Did you know Vi is tiny, with just 160 kB in size?

    It was developed in 1976 by Bill Joy as a visual mode of the ex line editor, also cowritten by Bill Joy.

    A 2009 survey of Linux Journal readers found that vi was the most widely used text editor, beating the second Gedit, by nearly a factor of two (36% to 19%).

    It was not until 2002 that VI was released as an open-source program under the BSD-style license.

    Vim (VI Improved) it’s a free and open-source clone of Stevie (ST Editor for VI Enthusiasts), developed in 1991 by Bram Moolenaar. It has a huge number of extensions.

    Conclusion

    Among all the terminal based text editors, I prefer the Vi ecosystem.

    VI/Vim is omnipresent in Unix-like operating systems due to its POSIX syntax, and when you invest a little time to unwrap its real power, you could master one of the best text-editor.

    Also, you could keep growing; you could use NeoVim and its myriad of extensions and add-ons to arrive at a full IDE. The sky (and your Lua programming knowledge) is the limit.

    📜
    BTW, this article has been fully written in (Neo)Vim. 🙂

    Author Info

    Absolute Essentials You Need to Know to Survive Vi Editor

    Jose Antonio Tenés
    A Communication engineer by education, and Linux user by passion. In my spare time, I play chess, do you dare?

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleAMD leaks reveal an RX 9070 XT as the RDNA 4 flagship GPU — but have we already been looking at this for weeks?
    Next Article Tracking Time

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 21, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-5011 – MoonlightL Hexo-Boot Cross-Site Scripting Vulnerability

    May 21, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Despite its impressive output, generative AI doesn’t have a coherent understanding of the world

    Artificial Intelligence

    Developer Spotlight: Max Barvian

    News & Updates

    Empowering Businesses Online: How Globaliweb Is Simplifying Website Creation

    Web Development

    Get Ashampoo Office on up to 5 devices for $20

    Development
    GetResponse

    Highlights

    Development

    Dutch DPA Fines Netflix €4.75 Million for GDPR Violations Over Data Transparency

    December 20, 2024

    The Dutch Data Protection Authority (DPA) on Wednesday fined video on-demand streaming service Netflix €4.75…

    Ignore everything else, this is the true “objective” list of the best Xbox and PC games of 2024

    January 1, 2025

    Latest Multi-Stage Attack Scenarios with Real-World Examples

    November 27, 2024

    How Travelers Insurance classified emails with Amazon Bedrock and prompt engineering

    January 31, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.