Learn Vim
Why learning Vim if you want to use Neovim ?? Because Neovim is a fork of Vim and is keeping the same basic movements, actions and modes. Those movements like j, k, h, l have inspired a tons of software in their keyboard shortcuts choice. You don't believe me ? All modern IDE (even GUI) have some way to emulate Vim movements
La première chose à faire pour se frotter un peu à vim et de l'installer
(paquet nommé vim-enhanced souvent)
# Fedora
sudo dnf install -y vim-enhanced
# Ubuntu
sudo apt update && sudo apt install -y vim
# Arch
sudo pacman -S vim
Launch vim
Just type vim anywhere in your terminal. You should see this kind of interface.
~
~ VIM - Vi IMproved
~
~ version 9.1.697
~ by Bram Moolenaar et al.
~ Modified by team+vim@tracker.debian.org
~ Vim is open source and freely distributable
~
~ Sponsor Vim development!
~ type :help sponsor<Enter> for information
~
~ type :q<Enter> to exit
~ type :help<Enter> or <F1> for on-line help
~ type :help version9<Enter> for version info
~
At this point, you cannot type normal characters because of the way modes are working. To quickly try it out, follow these steps:
- Type
10. You will not see any effect for now. - Type
i, to enter the Insert mode, this is where the "normal behavior" of text editors. Just type a nice quote with a line break. - Now type
Escapeand you should see your quote to be repeated 10 times ! - To save the file, you can hit
:to open the Command mode. You'll have your cursor at the very bottom. - Type
write quotes.txtand hit Enter. - At this point you have successfully saved the buffer (the text you see) into a file named
quotes.txt. This is equivalent of hittingCtrl+Sin other IDE.
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
Vim is so cool!
~
~
~
"quotes.txt" 11L, 161B written 11,0-1 All
You can see a confirmation message at the bottom (here 11 lines including a total 161 characters were saved).
If you want to change a given file, like result.txt, you can type vim result.txt.
Exit vim
This is NORMAL if you are stucked inside Vim and don't know how to quit. Just look at this famous (3 millions views) StackOverflow article How do I exit Vim?. This document the various ways to quit.
vimtutor
If you want a high level overview, you can quickly scan existing cheatsheets such as Moving Blazingly Fast With The Core Vim Motions or Vim Motions in a Nutshell. But there is a more detailed and practice oriented tutorial accessible via the command vimtutor. If you prefer a French version, you can type vimtutor fr.
This tutorial is just a temporary text file opened directly in Vim. The tutorial walks you into the very basics that are so important to know and start learning to continue without huge frustration. It is a very nice mix of very well-written theory content, including regular practice opportunities.
Here is an overview of the format, with the lesson on how to delete a word.
Lesson 1.2.1: DELETION COMMANDS
** Type dw to delete a word. **
1. Press <ESC> to make sure you are in Normal mode.
2. Move the cursor to the line below marked --->.
3. Move the cursor to the beginning of a word that needs to be deleted.
4. Type dw to make the word disappear.
NOTE: The letter d will appear on the last line of the screen as you type
it. Vim is waiting for you to type w . If you see another character
than d you typed something wrong; press <ESC> and start over.
---> There are a some words fun that don't belong paper in this sentence.
5. Repeat steps 3 and 4 until the sentence is correct and go to lesson 1.2.2.
There are 7 lessons, they can take more than one hour to read and start learning them. Même si tu n'utilises pas Vim après ça, tu auras eu un aperçu de la puissance, et soit tu y reviendras plus tard, soit cela sera peut-être utile dans d'autres éditeurs ou logiciels qui s'inspirent largement de Vim !
Vim-be-good
The hjkl movements are rather confusing at start. You try to go at left and hit j instead of h because you are used to the arrows keys layout. To drill these shortcuts, there is a very neat game in Neovim to learn the Vim shortcuts. This was developed by the youtuber ThePrimeagen in this GitHub repository.
To avoid learning plugin installation for now, just use this Docker image.
docker run -it --rm brandoncc/vim-be-good:stable
Here is an overview of the 4 mini games, including 6 different levels.
~ 0
~ 1 VimBeGood is a collection of small games for neovim which are
~ 2 intended to help you improve your vim proficiency.
~ 3 delete a line to select the line. If you delete a difficulty,
~ 4 it will select that difficulty, but if you delete a game it
~ 5 will start the game.
~ 6
~ 7 Select a Game (delete from the list to select)
~ 8 ----------------------------------------------
~ 9 [x] ci{
~ 10 [ ] relative
~ 11 [ ] hjkl
~ 12 [ ] whackamole
~ 13 [ ] random
~ 14
~ 15 Select a Difficulty (delete from the list to select)
~ 16 Noob difficulty is endless so it must be quit with :q
~ 17 ----------------------------------------------------
~ 18 [ ] noob
~ 19 [x] easy
~ 20 [ ] medium
~ 21 [ ] hard
~ 22 [ ] nightmare
~ 23 [ ] tpope
Online book - LazyVim for Ambitious Developers
LazyVim for Ambitious Developers - Maximum Efficiency with Minimum Learning Curve
This online book by Dusty Phillips is available here. I didn't take the time to read it for now, but this seems like a very useful resource.
To explore
TODO: those are random links to explore and document if useful.