The Vim in my eyes

Source: Internet
Author: User

A while ago, a lot of my colleagues have been harassed by me because I am trying to sell vim how useful. They feel that I do not seem to be selling, really is a waste of talent. Many things in the company are highly repetitive. It makes sense for me to be able to build an excellent channel between the brain and the compiler. Because the time saved can do a lot of things necessary, such as analyzing requirements and designing code architectures. Every time a production tool changes, the way in which it is produced and the manager's understanding of it changes. This sentence sounds as if it comes from a textbook. That's true, but it's a matter of fact, if you've ever bought a car (the battery is counted!). It's easy to understand that when you're driving instead of riding a bike, you're totally different about where you can go. This is also true of programming. Since thinking and writing are independent, I will not write how to use and how to learn it, want to know the students can go to Coolshell and learn vim script the hard way. There are very good tutorials there.

Abstraction of basic behavior

The process of encoding can be abstracted to move and manipulate two parts. That is, move the cursor to a location, and then either enter, modify, or delete something. For the normal IDE (such as Visual stdio), the things you can do are very simple, including four keys, page UP, upage, home,end and mouse. So when we move from the first parameter of a function to the second argument, we can only keep pressing the arrow keys. This is very tiring and boring, we naturally hope that the editor can provide us with a shortcut key, so that we can fly between the parameters. Similarly, many times you want to remove from the current location to the end of the line or delete to the beginning of the row, the average IDE can provide almost 0 of the help (which is why vs is called Advanced Notepad). It's not hard to see why Vim has so many shortcut keys. In fact, this is consistent with the principles of the computer's system architecture and operating system architecture. The basic operations supported by the CPU are only four you said days, load (fetch data), save (save data), jump (code jumps), OP (calculate). But if you only use these four commands to program, make sure you are exhausted. What vim and the architecture of the computer system do is to pack the most commonly used parts for use in the upper layer. For programmers, our code changes are not a letter, but a word or a block of code and a block of code or even a batch of files. By abstracting the most commonly used operations and moves in the right way, you see a fast-track table of Vim shortcuts that seems scary. When I'm used to programming with shortcut keys, the code in my Eyes is no longer a line, but a piece. The original one letter of the addition and modification of a letter, now L become a word-by-phrase, statement by line and code blocks between the addition and modification. It makes sense. Because the code in my eyes, gradually from the original scattered electronic originals, can be arbitrarily assembled and configured integrated circuits. When I read the code, I will pay more attention to the role of the module and the relationship between the modules, rather than the connection of individual electronic originals. When writing code, I also try to make my code more modular, and this is not the oo God horse has been advocated by the abstract.

Customize the Charm

What is Custom? Legend has it that a bunch of people think VI is not good enough, then they developed vim .... If VI provides you with the best system calls (and of course the VI developers think is best), VIM gives you the opportunity to design your own system library. The system is designed to meet the basic needs of most people. Then, as a user of a system, we must try our best to make the system meet its needs. With a gun to Bill's uncle (vi he wrote!) The head then asks him to make a version of it according to your habits, which is definitely not a good idea. And I don't know if you can find bill. Where the door of their house is open, they are willing to give you to do, but also to group a team analysis of your key records, thinking and code habits. When it's really done, it's estimated that your manager has fired you. And, the other person, the most understanding of your people or yourself. With your own system library, is definitely the most comfortable thing (here, in addition to their own, the most know you are your home bf/gf, so need any thoughtful advice, find them the best) after using Vim, how to make it more fit their habits is I wait for user's top priority. Most Ides also support customization, such as the ability to define tab sizes, AutoSave time, and highlight matching brackets. But in my experience, you can't let vim unload itself ... You almost define what you want to define, such as reading the latest log from a folder into a temporary file, and replacing the non-visible characters with spaces. In the case of the IDE, I need to open the folder first, then use the time and suffix to sort all the files, then copy and paste the log file and rename it to Tmp.log. Then open the file with the IDE and how to replace the unreadable code with Google (I really don't know how to use VS to 0 Replace with space .... )。 Well, the process seems to be acceptable. (Because I've been doing this for a long time), but it's going to be repeated after a few hours of coding .... That's a real dare to imagine. But if it is vim, I can spend 20 minutes in my spare time to customize the process, and then write the program with a command directly. The so-called programmer Happy Days, that is how to come. This is a relatively complex example, in the daily use process, only need to customize some basic operation can easily realize the charm.

What does automation mean?

The so-called automation, is to let the machine responsible for the machine can do things, people responsible for the machine can not do things. One of the great advantages of automation is that the rate of failure of the machine is 0. As a programmer who struggles with all kinds of mistakes, automating things automatically can be more efficient. For example, when the file is created automatically added to the SVN, such as when the CPP file created automatically create the corresponding header file, or each time you call new to create memory automatically under the current function to add the corresponding delete. Vim will help you do this (well, except to help you automatically unload yourself after you turn off vim). The key will automatically return to your pocket after you have successfully unlocked it. (I believe everyone has a rush to find the key.) Of course, we can also develop the habit of putting the key back into the pocket in time. However, since it is the time for people to make mistakes, and the programmer to make the wrong opportunity is particularly much. In particular, after going home tired of half-dead and anxious to go to the toilet and watch TV, it is normal to find the key in a few days a month. Automation and Vim customization are inseparable in the programming process, because when you can't customize the closing of a file and let the editor do something for me, you want to automate the process. So vim can be like a thoughtful servant, letting you take it off every time you go home, and then pass it to you when you leave home.


Well, I probably thought about it a little bit, but I didn't use Emacs and subline, and if there was any harm to the fans, I apologized to them because I really had the other advanced editors. What do you write next? Write about how I see the Linux system programming feel.

The Vim in my eyes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.