NERDBUDE

[ code. keyboards. terminals. cyber. ]

[HOWTO] [WHOAMI] [PODCAST] [FRANKENSWITCHES] [GERMAN]

VIM



It was bound to happen. At some point Vim had to show up here and since Vim has just turned 30 years old it justifies it all the more.
I thought, let's start a small series in which I (try to) explain what Vim is and how it is used.
The good thing is I will also learn a lot in the process. :D
Who wants to have all parts clearly together uses [VIM] as sorting.
This first part is about what Vim is, where Vim comes from and how it is used.
The later parts of the series will then go into more detail about usage, configuration and modification.
So let's start with the (in my opinion) best editor there is.

What IS VIM

Vim is basically a text editor and is based on "vi" and stands for "Vi IMproved". However, not a simple one like Notepad but a highly customizable and extensible editor.
Vim can be used to edit simple files (the NERDBUDE HTML files are completely edited in Vim), to create local wikis for own structuring, to read RSS feeds and many many more.
Vim is available for almost every operating system and is usually even pre-installed.
Vim was developed by Bram Moolenar and released on 02.11.1991.
Vim was originally developed for the terminal, but now also offers a GUI version with extended mouse support - but that's not what we're here for. I stay with the terminal version. That should be it in history - let's go with Vim.

Vim can do everything you can find in modern editors and IDEs:

Syntaxhighlighting
Linenumbers
Diff Checks
Git support
Colorscheming
Markdownsupport
Filemanagment
....


Not all of these features are usable out of the box, but must be reloaded via plugin.

START VIM

To start Vim is enough a simple:

TERMINAL
vim


When Vim is started for the first time, you will see the following startup screen:



To debunk the myth here in advance that it would be difficult to close Vim again - it even says in the startup screen how to close Vim again:

TERMINAL
:q


So if you type ":" and "q" and confirm with ENTER, Vim is gone.
Now we want to use Vim and not immediately shoot down again.
So open Vim again and start typing. However, not much happens.
What is the reason for this? Quite simply. Vim has basically 3 different modes in which it can be operated. The individual modes are activated by a simple keystroke:

I   - Insert Mode
V   - Visual Mode
ESC - Normal Mode


The modes are relatively self-explanatory.
INSERT mode is used for inserting, i.e. writing. In VISUAL mode the content of the file is manipulated or changed and the NORMAL mode offers the possibility to use commands, copy and paste text and various other possibilities.

The only special feature here has the VISUAL mode. This can be used in three different variants:

v   // Character Mode
V   // Line Mode
CTRL + v   // Block Mode


How the VISUAL mode works exactly I explain in a later part still more exactly.


NAVIGATION

Vim can be controlled by cursor keys on the one hand but also by "HJKL". This Atr of the Steureung comes still from "vi" times and is back on the computer on which "vi" was developed. That was an ADM-3A terminal without cursor keys as they are common today, but with cursor arrows on said HJKL.
. The change from cursor keys to HJKL takes some time but, once it is in muscle memory, it is much more comfortable. In addition, there are various tools that are also coded with the "Vim Keys" or plugins that also makes current tools with the "Vim Keys" operable.

PRAXIS

At the end of this series will always follow a small example. So this time open Vim, activate insert mode, save and close.

  $ vim htp.md (open vim with a file named htp.md)
  I (activate insert mode)
  Hack the Planet! (simple text)
  ESC (back to normal mode)
  :w (save)
  :q (quit)






//EOF