i love vi.
i say that because i seriously lust after vim (and have dirty, potentially illegal joy with it on a daily basis) and tend to use it as my principal editor, but i still love vi.
That said there's an internal group at work that shares in my near carnal fascination with this editor, and pass around various tidbits of information that are tintilatingly useful. Two of these insanely useful bits i'm going to put here because i'll never be able to find them otherwise.
If you don't use vi, any form of unix, or understand why anyone would have that sort of reaction to an editor, you're excused. (If you use emacs, well, you've already got an operating system, you should really consider getting an editor for it.)
On to the joy:
tab completion in vim
This is specific to vim, so stick this in your ~/.vimrc file:
function! TabOrCompletion()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\\k'
return "\\<TAB>"
else
return "\\<C-N>"
endif
endfunction
:inoremap <silent> <TAB> <C-R>=TabOrCompletion()<CR>
Keyword completion uses "man -s" to work. See :help keyword if you want to change this default list.
command line vi
first off, you can put your previous command line statement into an editor buffer by using the command "fc". The command is executed when you quit the buffer. That's good for lengthy edits and one offs, but what about when you want to edit a command from several steps ago?
use "set -o vi" to put your command shell into vi editor mode. You'll be in "insert" mode by default. Hit escape and all of your lovely visual mode keystrokes will be there. (Sorry, no command mode stuff.)
Still, nothing like hitting '<esc>cw' to change a word inline.
Now, if you'll pardon me, i'm off to update my .files…

