JP Vossen on 15 Jun 2015 22:00:42 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
[PLUG] Vim |
At PLUG W we had some Vim confusion and discussion, so without kicking off a religious war, I though I'd throw some resources out there. This would also be great fodder for a preso and demo. The most critical thing is probably ESC:q! That is hit the ESC key then literally type ':', then 'q' then '!' and that will exit without saving any of the changes you just made by accident while trying to exit. Then `apt-get install nano` or `yum install nano` and get your work done until you have time to study up on Vim a bit. :-) The next most critical things are a toss-up between: vimtutor :help <thing> i ESC :x `vimtutor` is what it says it is. ":help" is the Vim help command (literally type ":help" or ":help motion.txt" or something). "i" puts you into "insert" mode where you can type and move around in a very limited way. The ESC key exits back to command mode, where you can ":x" to save (if needed) and exit. ":x" is similar to the perhaps more common ":wq" but that forces a write then quits, while ":x" only writes if needed and is one fewer keystroke. Why use/learn Vim? Because it is *always* there on any Unix/Linux/BSD/Mac (OS X+) and it's available in command line and/or GUI for anything and everything else. There are many other answers but they are a slippery slope into religious war. For some other pretty neutral thoughts, see http://www.viemu.com/a-why-vi-vim.html. Note that gVim is a GUI version, which can be really handy because it allows use of menus and mice to ease into Vim. See also "Cream" [1] and `vim -y` [2]. By the way, Vim is "vi, iMproved." vi was written just about 40 years ago as a VIsual layer on top of `ex` [3], and the details are fascinating. (Well *I* think they are! [4,5]) Take a look at the ADM-3A terminal keyboard layout in [4] to see why the modal nature and all the crazy keys, including ESC, actually make sense. (Bonus re: ESC [6].) There are a ton of free resources on the 'Net, and I'll mention some, but if you like books get: _Learning the vi and Vim Editors_ and _Practical Vim_ in that order _Practical Vim's_ subtitle is "Edit Text at the Speed of Thought" and if you are a good touch-typist and you read this book and practice...well, see for yourself. Otherwise: * http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/ * Run 'vimtutor' on the command line * http://vimdoc.sourceforge.net/htmldoc/ * http://vimdoc.sourceforge.net/htmldoc/vimfaq.html * 572 page http://www.truth.sk/vim/vimbook-OPL.pdf * 20 page(!) Quick Reference Guide * http://vimdoc.sourceforge.net/htmldoc/quickref.html * http://alexquinn.org/techref/Vim_Quick_Reference_Guide.pdf * 2 page http://michaelgoerz.net/refcards/vimqrc.pdf ---------------------------------------------------- [1] http://cream.sourceforge.net/featurelist.html [2] http://vimdoc.sourceforge.net/htmldoc/starting.html#-y [3] `ex` lives on in "ex" mode in vi and Vim. Among other things this make Vim scriptable! [4] https://en.wikipedia.org/wiki/Vi [5] https://en.wikipedia.org/wiki/Vim_%28text_editor%29 [6] Remapping Caps Lock to ESC can be a giant PITA because how you do it (if it's even possible) varies widely per OS and distro. There is a long discussion at http://vim.wikia.com/wiki/Avoid_the_escape_key with some great ideas. But I don't think you can beat the "jk"/"kj" "smash" mapping at http://www.kevinberridge.com/2010/10/vim-escape.html. Enjoy, JP ----------------------------|:::======|------------------------------- JP Vossen, CISSP |:::======| http://bashcookbook.com/ My Account, My Opinions |=========| http://www.jpsdomain.org/ ----------------------------|=========|------------------------------- "Microsoft Tax" = the additional hardware & yearly fees for the add-on software required to protect Windows from its own poorly designed and implemented self, while the overhead incidentally flattens Moore's Law. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug