一. Emacs or vim?
We won't say more about the two major editors, vim and emacs. Each has its own merits and is worth learning. Maybe by integrating into them, we can experience their uniqueness. It is easy to integrate them, but why do we rarely use them? This may be the learning curve of the two of them, which is really hard to peck. Most people have the heart to learn, but it is difficult to stick to them. Let's take a look at their learning curve. (please allow me to steal a picture)
In addition, for more introduction to the learning curve of these two editors, please pay attention to this article
Between the subject of our article, let's learn to understand vim.
二. why vim?
Because vim has a wide range of applications among our beginners, including the default editor in some Unix-like systems, it is vim, so I will learn vim first. For some benefits and features of other vim, and why to use vim more, please pay attention to the why vim portal of this post , thank the author, through his blog, learn a lot and support originality. :D
To summarize, the benefits of vim:
- Extensibility
- Versatility
- Customizable
三. How to do?
For some plugins or personalized configuration of vim, please also move to this article. Portal
Four. vim related operations
For some related operations of vim, you can refer to:
transfer 1
transfer 2
五. mac of vim
In mac, we choose to install macVim, do not use the original vim of mac, install macVim, refer to the article .
⚠️Note
1. After installing macVim with homebrew, it may be automatically added to the environment variables. Refer to the establishment of soft connections mentioned in the article. I think the author's intention is to vim
directly call macvim.app when using commands in the terminal , You can still use the original vim without configuration, and the two do not interfere with each other, that is, the vim
command still calls the original vim, and the mvim
command calls macvim.
2. After the installation is complete, you may need to configure various plugins or theme styles for macvim. Here we use a relatively complete and open source configuration repository on github for convenience. For .vim_runtime
installation configuration, refer to the api of .vim_runtime
3. .vim_runtime
After installation, install After it takes effect, it will return to the original vim theme style (solarized color matching, the original configuration can refer to my personal customization – mac configuration chapter ) has changed, not the color we like, because the installation .vim_runtime
will rewrite .vimrc
the file, the original The configuration is overwritten, so the style vim theme style will change. .vimrc
So rewrite the style that was originally configured in to your own configuration file. If ~/.vim_runtime/my_configs.vim
there is no such file, create one. .vim_runtime
By .vimrc
reading the my_configs.vim
configuration file, it will take effect again.
4. Since then, macvim has been installed, and we can enjoy it to the fullest.
6. ideaVim application
Maybe we idea
develop code more in practice, then we can continue to practice the common operations of vim, install the plug-in ideaVim, and about the application skills of ideaVim, we will not repeat the creation of wheels, please refer to this article for details Portal .
Special attention: It is the copy and paste operation between the vim clipboard and the system clipboard. The contents of the system clipboard can be ctrl+v
pasted in any program.
"+yy
Copy the current line to the system clipboard
"+p
Paste the content of the system clipboard to vim
"ayy
Copy the current line to register a
"ap
Paste the contents of register a behind the cursor
7. Suggestions for vim to new students
There may be new students who are determined to learn vim and start the initial stage, but they are confused when they learn to learn, like me, how can I continue, then also give new students some suggestions for learning and the formation of study habits Portal Thank you again to this great god.
Eight. vim command brain map memory
Brain maps do not mean rote memorization, the key is to practice more. Source file download address
vim keyboard map: