Learning vi -- the "cheatsheet" technique
gentoo.org
gentoo.org
map <Left> <nop>
map! <left> <nop>
map <right> <nop>
map! <right> <nop>
map <up> <nop>
map! <up> <nop>
map <down> <nop>
map! <down> <nop>
Vim did not win in that its a large package and users are often forced to use a lighter wieght vi clone to admin directly a on server machine.
ps. how do you write a * followed by text?
Text surrounded by stars will become italic, though.
When I log into a server and I want an editor I type vi, not vim. Because vi has worked for twenty years, and I assume it always will work!
(That's actually why I bothered to learn a little bit about vi -- it is always there, on every Unix box, and it always works the same way -- no wacky transposition of Meta keys, etc. On my own machines I use nothing but emacs. ;)
Text of the tutorial: http://ftp.vim.org/vim/runtime/tutor/tutor
Note to self: Learn the windowing operations in vi.
Ctrl-p and Ctrl-n are the truly awesome commands for programmers.
:help window
Here are some basics:Split to a new file (create a new window)
:split [file]
:vsplit [file]
Switch windows C-w [movement-key]
C-w C-w
Resizing windows (w/o mouse) C-w [row-size] _
C-w [col-size] |
Here is a tutorial that has stuff on windows and tabs (if you want) (pdf):http://research.iiit.ac.in/~smr/data/advanced_vim_tutorial.p...
This is for Vim, though. I'm not sure if it will work for Vi.
> The simple stuff in this "cheatsheet" is stuff anyone other than a complete beginner will use absolutely all the time.
Not exactly...
Over time, as you memorize commands, you'll gradually become less and less dependent on the cheat sheet.
Even so, I doubt that this will work. I started using Vim by learning one or two commands at a time, not a whole bunch at once, and it worked for me. I believe that a beginner would use this cheat sheet as a crutch because the beginner would use it "absolutely all the time."
Dumb question, but how do we know exactly if it works or not? It didn't cite any test cases. Did anybody try this?
With regards this last point though, I don't seem to have expressed myself clearly. My point is that the material covered in this "cheatsheet" page is very, very basic stuff, and if you use vi more than an hour a day then you'll no longer need the cheatsheet within 72 hours. There's little point in having a cheatsheet on the utter basics. Much better to have a cheatsheet on the next level, covering things you only use occasionally, and hence might not remember.
In short, I think we agree.
The main navigating commands are: Ctrl-] (on a "hyperlinked" word) - and Ctrl-t to retrace your path.
I recently discovered that Ctrl-p and Ctrl-n will also work across files, if vim knows about them:
vi file1 file2 file3
BTW: I learnt all the windowing commands at one time, but never really used them (and now forgotten). Instead, I use Ctrl-6 to swap between files, and I remapped Ctrl-p and -n to flick through files quickly: :map <C-n> <Esc>:n<CR> " next file, with control-n
:map <C-p> <Esc>:N<CR> " prev file, with control-p
I also use alt-tab to switch between xterms (downside is you can't cut-n-paste with y and p between them).