Ever been stuck in the terminal for not including a message when committing? Can't get out by pressing
q. Seriously had to google how to exit vim or nano every time.
Madness? This is a top-of-the-line text editor!
The most confusing part of vim to me was the modes. What's the point of all these modes? Well, after a lot of research, I found my answer. Now bear with me here, I'm still new to coding, so every time I hear of a keyboard shortcut I get excited. It's like finding hidden treasure. And you know those coders that are so good their hands never leave the keyboard to touch the mouse? They are like grand master coders to me. Well, with these text editors, the mouse doesn't exist. There is no scrolling up and down and clicking on a word with the mouse. So how does one move around? With the keyboard. For example, the letters
l are used to move left, down, up & right. What if I need to type using those letters? Switch modes, normal mode is the movement mode, and insert mode is for typing. This is how one keeps their hands off the mouse or the arrow keys, for the most part. Now when first starting, like I am, being restricted to only these few commands along with a few others I learned on
:Tutor from nvim keeps me pretty slow. Kind've like how I started learning to code with var. Now, I can't even remember the last time I actually used var. Whenever I come across var, I'm like, 'what's this?'.
List of basic moment commands
move around =
hope forward by word =
hope backwards by a word =
jump to the beginning of line =
jump to the end of line =
search for word =
- jump through results =
- jump through results =
List of basic editing commands
insert before the cursor =
insert after the cursor =
add line below and enter insert mode =
add line above and enter insert mode =
copy/yank a word =
copy/yank line =
paste line one line below =
delete character =
delete line =
dd(goes to same register as yank command)
undo last command =
exit to normal mode =
Enter Visual Mode =
highlight a word =
highlight line below =
delete current word and forward =
delete current line plus one down =
yank word =
yank current line plus one down =
help with specific word =
Now my first interaction with vim, back when I forgot to commit a message, I saw a plain, boring editor. No colors or special fonts. Well, vim is the most powerful when it's stripped of all those things that make it pretty. But vim is very customizable, just not easy to do. So here's where neovim comes to the rescue.
Not only are there so many configurations for neovim, but it's easier to configure.
Just like with learning any new language, it's best to start with the basics. I started with
:Tutor with neovim. There's also
vimtutor from vim, which says it's only 20 minutes. Neovim's tutor took me longer than 20 minutes, but it doesn't have colors. Vim's tutor
vimtutor looks like it might be shorter.