1. vim preface
Students who have used linux know that vim is a must-have editing tool, and it can save a lot of time when used well. However, when you first started, there are many learning costs compared to other editors.
I wonder if you were worried about the gesture of forgetting when you started to contact vim. Today, I will introduce you to the new gameplay of vi in ​​different scenes.
2. shell + vim
# set -o vi
The shell command line executes the above command, and you can set the current shell terminal to vi mode. Can also be written in the Linux user login configuration, let the shell enter vi mode by default.
Here is an example:
When you knocked out a bunch of commands and wanted to connect to the mysql 3307 port to execute sql, it was unfortunate that the middle port number was mistyped and written as 3306. Then how can we modify the port number faster?
The newbie's approach is to press and hold the left shift key. When the cursor moves to 3306, change to the left shift key. If the cursor moves over, change to the right shift key. Move to the back of 6, backspace, then knock 7...
If you are troubleshooting the emergency, that anxious can be imagined!
Now we use vim mode to modify:
Split out for detailed analysis:
F6 finds the first 6 position to the left.
R7 replaces the character at the cursor position as 7.
Plus the last carriage return, a total of 6 buttons, precise modification! !
Let's review the solution at the beginning of the following:
(Note: The animation is made with the screen recording software, set up
3. chrome + vim
Vimium is a Chrome extension that simulates vim buttons to control browser operations (similar to Vimium, and some people use cvim).
You can download and install offline files in the Chrome app store or online.
After installing the plugin to open a normal page, press the question mark (?), you will see the shortcut keys familiar to the vimer.
Let's experience the charm of vimium. When you open chrome to browse the web, put your hands on the keyboard and press f. Then you can open the link of the page you want by typing one or two letters.
An article sees the end, I want to go back to the beginning and hit a gg and immediately roll to the beginning of the page. After reading the page, press x to close it. Is there a smooth feeling~
4. windows + vim
Windows is explained here as a window, not a windows system, because the tools described below are actually cross-platform.
There are more vim editing tools with windows, such as Gvim. Last year, vim finally released the 8.0 version after a lapse of ten years. Download it and play it slowly.
In addition, the famous Sublime Text, if you like, can also be configured into vim mode.
In the menu bar Preferences -> Settings - User, open the configuration file, modify the next
{"color_scheme": "Packages/Theme - Nil/Sanakan.tmTheme", "font_size": 11.0, "ignored_packages":[ // "Vintage" ],"vintage_start_in_command_mode": true, //vim cmd mode"update_check": False, "word_wrap": "auto"}
Comment "Vintage" to enable vim mode.
Add "vintage_start_in_command_mode": true, set the command mode to enter vim after opening the file.
The copy of the text on the phone is so painful, if it is not because the BlackBerry is not done, maybe on the phone, it will also make a vim-like editor.
5. IDE + vim
Syntax highlighting, indent alignment, function definitions, directory trees, automatic compilation, etc.
With vim configuration and a large number of plug-ins, you can create a development tool similar to the existing large IDE features.
The space is limited, and it is not a big deal. Attach a professional long text link on github https://github.com/yangyangwithgnu/use_vim_as_ide
6. Getting started with vim
After playing tricks, write some vim entry knowledge, leave it to new students who want to learn vim, the big god level can ignore the skip.
6.1 vim common sense
I heard that after someone used vim, the mouse hand was cured.
In fact, I just want to say that the common sense of vim is to try to put the mouse to the side and use the keyboard to edit. Of course, the advanced point can also use the mechanical keyboard. Want to bask the brand you use? Poke a message.
6.2 vimtutor
The power of vim is the "cursor movement" + "action operation" in command mode. Beginning with simplicity, vimtutor is recognized as the most basic introductory tutorial, novices have started to love and hate vim from here. Direct shell terminal knock vimtutor.
# vimtutor
6.3 vim keyboard diagram
Before learning or using vim, you can't do without a vim keyboard map that can be seen at any time. Remember to see this picture for the first time, set it to the desktop background without hesitation!
The most complete Vim shortcuts in history, all kinds of versions waiting for you to challenge
Http://cenalulu.github.io/linux/all-vim-cheatsheat/
7. Conclusion
It is enough to read this article in 30 minutes. To learn vim, you need to use it in peacetime, and continue to think and simplify the combination of buttons. If you write code often, then constantly customize and optimize your vim plugin, you can do more with less.
Solid State Relay,Relayrelay Electrical,Motor Overload Relay,Dc Coil Contactor
NanJing QUANNING electric Co.,Ltd , https://www.quanningtrading.com