Neovim is one of the most chosen IDEs by the developers nowadays. It consumes very low resources, and it is way lighter and faster than vscode. However, because of its steep learning curve many people avoid using it. The main reason why Neovim is so famous because it lets you customize your IDE completely and do mostly everything in your code without using the mouse. It basically minimizes the use of mouse.
So, let's first discuss what's the Neovim. Neovim is a fork of Vim which is an editor which comes out of the box on the Linux system. If you are familiar with Linux, then you would definitely know about vim. Neovim supports most of the commands of vim so, if you have used vim then you're good to go and if not, then this cheat sheet will help you with the basics of neovim.
Neovim is a terminal-based editor that's why it doesn't have any GUI per say. You can tweak its config file to get a beautiful UI but we'll not focus on that. There are several configs available online which can make your editor beautiful and easy to use. Below are some famous configs with their downloading links, feel free to check them out.
I personally use Lazyvim because I find it easy.
Install any of them and start the editor.
Before we get into the keybinding let us first know about what's the Leader Key. Leader Key is like a king key. Most of the keybindings need the leader key. Backslash is the leader key by default but you can change it based on your preference. If you're using LazyVim then your default leader key will be Space.
So, let's first start with the file related combinations because we need them the most:-
File Related Combinations
When you will open neovim then you will see screen somewhat like this:-
1- Leader + f + f (To open the search bar for file search)
2- Leader + e (To open the explorer tab)
3- Use r and d (To rename or delete the file from the explorer tab)
4- ctrl + h and ctrl + l (To move right and left between explorer and buffer or tabs)
5- [ + B and ] + B (To move right and left between the tabs)
6- Leader + f + t (To open a terminal)
7- : to open the cmdline
8- :q! to exit the window
9- :w! to save the file
10- :wq! to save and exit the window
Editor Related combinations
1- i (To get into insert mode)
2- esc (To exit the insert mode)
3- d (To delete the contains of the file)
4- u (To undo the contains of the file)
5- ctrl + r (To redo the contains of the file)
6- g + g (To navigate to the start of the file)
7- G (To navigate to the end of the file)
8- e (To move fastforward in the editor)
9- j (To move down around the lines)
10- k (To move up around the lines)
11- leader + c + r (To smart replace) (Hover to the variable you want to replace, press the combinations and then write what do you want to replace it with, then it will replace all the occurrence of that variable wherever its definition is used)
12- $ (To move to the end of the line)
13- 0 (To move to the start of the line)
14- leader + s + g (To search all the occurrence of a word)
15- :%s/whattoreplace/withwhat/g (To find and replace)
16- g + d (To go to the definition)
17- K (For hover definition) (for this you have to first install the language plugins or you can just tweak the config file in /.config/nvim/lua/config)
18- leader + u + C (To change the theme)
19- leader + c + R (To remove unused imports)
20- leader + c + f (To format the code)
21- leader + c + a (To perform code actions) (Suggestions for the error) (Hover to the variable and press the combinations)
22- linenumber + j (To move to that line number downwards)
23- linenumber + k (To move to that line number upwards)
24- :Explore and then press % (To create a file) and press d (To create a folder)
25- v and move arrow keys (To select the text)
26- After selecting press d (To delete and also cut the text) (it will delete the text and it will also copy it to the clipboard)
27- After selecting press y (To copy the text)
28- p (To paste the text)
So, Here are the basics of neovim. These combinations are enough for you to work on neovim. Although it will take some time to get used to it. But eventually you will start liking it. Give it a try!!
Top comments (0)