- **Epistemic status:** #evergreen Vim is an open-source text editor tool authored by Bram Moolenaar that can be used both in the command-line and as a standalone application. It has been in development since 1988 with its first public release in 1991. It was derived from [[Vi]] as an improvement to that software. Vim is highly customizable and extensible, with a variety of plugins that can be found in [Vim Awesome](https://vimawesome.com/) and available on all major platforms ([[Linux]], Mac, Windows). One of the major attractive points is text inputs are facilitated by a variety of features, increasing keyboard efficiency. Users can customize and extend keyboard mappings. They can create macros to automate sequences of keystrokes. An example of how it can increase the keyboard efficiency is let's say you want to move to the third word and copy that word, you will type `3wyw`. In 4 keystrokes you can get it done and quickly. Meanwhile, in a normal editor, you either can move your mouse to the word, highlight it and then `control+c` taking more time. You start thinking about how to achieve your goal faster with fewer keystrokes, pushing creativity. I often ask myself what could I do faster and consult the <a href="https://vim.rtorr.com" rel="noopener" target="_blank">Vim Cheatsheet</a> for quick reference. ## Modes Unlike most editors, Vim is modal. Each mode changes the behavior, shortcuts, and the functionality of the keys. A good example is that when you open Vim for the first time, the keys do separate things. You can't type any words until you type **i** going into insert mode, and then you can start typing sentences. When you type **ESC** and come back to normal mode. The following are the different modes that Vim offers: - **Normal**: For navigation and manipulation of text. This is the mode that vim will usually start in, which you can usually get back to with **ESC**. - **Insert**: For inserting new text. The main difference from [[Vi]] is that many important “normal” commands are also available in insert mode – provided you have a keyboard with enough meta keys (such as Ctrl, Alt, Windows-key, etc.). - **Visual**: For navigation and manipulation of text selections, this mode allows you to perform most normal commands, and a few extra commands, on the selected text. - **Select**: Similar to visual, but with a more MS Windows-like behavior. - **Command-line mode**: For entering editor commands - **Ex mode**: Similar to the command-line mode but optimized for batch processing. ## Learning Vim ![[Pasted image 20220427085727.png]] Photo retrieved from [Terminally Incoherent](http://www.terminally-incoherent.com/blog/2012/03/21/why-vim/) Vim has a steep learning curve, but that complexity is what makes it powerful with the sheer number of commands. Vim if associated as a language can improve the flow of learning it, making you gain a lot of speed with your editor. Some guidelines to help you associate it as a language: - Learn some verbs: **v** (visual), **c** (change), **d** (delete), **y** (yank/copy). These are the most important. There are others. - Learn some modifiers: **i** (inside), **a** (around), **t** (till...finds a character), **f** (find...like till except including the char), **/** (search...find a string/regex) - Learn some text objects: **w** (word), **s** (sentence) **p** (paragraph) **b** (block/parentheses), **t** (tag, works for [[HTML (HyperText Markup Language)]]/XML) there are others. Taken from [Yan Pritzer blog post](https://yanpritzker.com/learn-to-speak-vim-verbs-nouns-and-modifiers-d7bfed1f6b2d) Vim has a built-in tutorial called `vimtutor` that typically comes installed with the tool. You can type it on the terminal, taking you through the basics of Vim. The following are additional resources to help you learn Vim: - [Vim Adventures](https://vim-adventures.com) - [Open Vim](https://www.openvim.com) - [Vim Cheatsheet](https://vim.rtorr.com) --- ## References - “10 Reasons to Learn the Vim Editor | Linux Training Academy.” Accessed April 27, 2022. <https://www.linuxtrainingacademy.com/10-reasons-to-learn-the-vim-editor/>. - “Your Problem with Vim Is That You Don’t Grok Vi.” Gist. Accessed April 27, 2022. <https://gist.github.com/nifl/1178878>. - “Learn VIM While Playing a Game - VIM Adventures.” Accessed April 27, 2022. <https://vim-adventures.com/>. - “Learning the vi Editor/Vim/Modes - Wikibooks, Open Books for an Open World.” Accessed April 27, 2022. <https://en.wikibooks.org/wiki/Learning_the_vi_Editor/Vim/Modes>. - Pritzker, Yan. “Learn to Speak Vim — Verbs, Nouns, and Modifiers!” Medium, February 25, 2020. <https://yanpritzker.com/learn-to-speak-vim-verbs-nouns-and-modifiers-d7bfed1f6b2d>. - “Vim (Text Editor).” In _Wikipedia_, April 23, 2022. <https://en.wikipedia.org/w/index.php?title=Vim_(text_editor)&oldid=1084346994>.