What is the best way to force yourself to master v

2019-01-15 23:17发布

A good while ago, I read an article by the creator of viemu, clearing up a lot of the misconceptions about vi, as well as explaining why it's a good idea (and why it's been very popular for the last 30 years+). The same guy also has a great set of graphical cheat sheets that teach the basics a few bits at a time.

I'm convinced.

I've been convinced for the past 2 years in fact. But I still really haven't gotten around to force myself to learn vi as my primary editor, the learning curve is just too high. When I get down to work, acceptable but immediate productivity (using my current editor) has so far won over tremendous productivity farther down the line (using vi).

Does anybody have any good tips to help get past the learning curve? It can be straight out tips, some other tutorial or article, whatever.

Edit: Note that I'm aware of the vim/gVim, Cream and MacVim (etc.) variants of vi. I kept my question about vi to refer to the vi family as a whole. Thanks for all the great answers.

Update (April 2009)

I've been using Vim (more precisely, MacVim) in my day to day professional life since last December. I'm not going back :-)

Good luck to everyone in their Vim mastery.

30条回答
虎瘦雄心在
2楼-- · 2019-01-16 00:04

Face the fact that it will create an immediate performance hit. When learning a new tool you need to be able to do something that you know how to do with other tools so the problem isn't your problem. After using the new tool a while it will disappear and you will be only focusing on the underlying problem.

With something like vim (as others have said, vim is vastly superior to vi) it is important to reread and browse the documentation periodically. The interface is completely undiscoverable without it. With each new reading you will see a feature and say, "ah ha, that would have solved this issue I was trying to figure out last week", and will file it away in your brain. Solutions connected to real-world problems that you've had are much easier for you to remember than random shortcuts.

In the end you can use vim with a fairly small subset of it's features, so don't be overwhelmed with all the bells and whistles. Think of all the features in Word, do 99% of the people use them?

查看更多
迷人小祖宗
3楼-- · 2019-01-16 00:06

The simplest way to force yourself might be just to remove all the other editors from your machine. Get rid of temptation :)

查看更多
可以哭但决不认输i
4楼-- · 2019-01-16 00:08

You could get your hands on one of the original Happy Hacker keyboards (no arrow keys) and place your (wireless) mouse out of reach each time you start editing.

查看更多
等我变得足够好
5楼-- · 2019-01-16 00:11

The first thing I'd do is lay a piece of paper or a book over your arrow keys and your ins/home/end/pgup/down keys. Those aren't needed in Vi.

Next I'd get used to hitting ctrl+[ whenever you're told to hit escape. It's much faster and you won't need to take your hands off the keyboard.

Then I'd watch my screencasts:

http://www.youtube.com/watch?v=FcpQ7koECgk

http://www.youtube.com/watch?v=c6WCm6z5msk

http://www.youtube.com/watch?v=BPDoI7gflxM

http://www.youtube.com/watch?v=J1_CfIb-3X4

Then, just practice practice practice.

edit The reason for avoiding the arrow keys is that they slow you down. One of the largest benefits of Vim is the speed it allows you. The arrow keys also prevent you from really embracing the modal nature, which is very powerful when mastered.

查看更多
Summer. ? 凉城
6楼-- · 2019-01-16 00:11

For me VI is a good emergency editor, but not something I want to use if there is any other alternative available. I realize this is not for everyone though, I'm not saying it's horrid or anything, I just personally prefer a discoverable UI.

But you really have to know VI if you do anything significant in Linux!

So just learn the basics: i=insert mode esc=leave insert mode :wq=save and quit :q!=don't save and quit x=when not in insert mode, delete the character. /=search

That will get you through any editing emergency. There is nothing you can't do with those few commands (and navigation of course). The rest you can "Tack on" as you need them.

Keep a reference or book available though--when you NEED to use VI, you probably won't be able to browse the web--but the man page may be somewhat useful.

查看更多
Viruses.
7楼-- · 2019-01-16 00:11

The main reason for me to use vi is ssh (or Putty on Windows): When you're logged into a Unix server remotely, then vi is always available. And it works with VT100 when neither the cursor keys nor backspace/delete are mapped.

Also having a book like VI Editor Pocket Reference helps greatly.

查看更多
登录 后发表回答