I’ve thought of a solution for people like me, who want to learn new commands for the UNIX text editor, “vim,” but have a hard time digesting the pages and pages of cheat sheets all at once.
Why not get a random vim tip when I open a terminal? After all, half the time I’m specifically opening up a term to use vim. So instead of trying to learn all those vim commands all at one time, I can just learn a new command every once in a while, try it out, and it will be much easier to remember.
This is accomplished using the application “fortune.” So first you’re going to need to get fortune:
$ sudo apt-get install fortune
Now edit your .bashrc file (using vim of course)
$ vi .bashrc
and add
fortune;
to the bottom of the file. Save and quit. To test it, just open up a new terminal, and it should spit out a fortune at the top.
To add vim cheats to fortune, you can either make your own .dat file (directions here), fill it with vim commands, and add it to your fortunes directory, or you can download mine. Mine has a couple hundred commands, and I’ve combined several of them so you get similar commands in one “quote.”
Of course, you’re not ALWAYS going to get a vim tip with fortune, because there are tons of other fortune files, and it is completely random. If you DO want to get only vim tips, just delete all of the other .dat files (besides your vim fortunes) in your fortunes directory.