[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vi as a text editor



On Sat, Nov 16, 2002 at 12:18:11PM +0530, Sandip P Deshmukh wrote:
> hello all
> 
> i have recently started using vi and i like it for its simplicity -
> 'clean-ness'. somethings are missing though.

Try vim: VI iMproved.  It has all sorts of nifty extras.

> one is managing words towards end of line. as i type, towards the end
> of the line, it juts cuts the word. it neither hyphanates nor pushes
> it to the next line.  is there way i could make vi do this?

See below.

> moreover, can i have macros? doing the same repetitive thing? i will
> also like to bind them to key strokes.

You want the 'map' command.  Be aware that it actually maps key codes
from your .vimrc to commands, you'll need to actually enter the '^V'
character to bind anything to it.

> moreover, i have spell, ispell and aspell installed. is there a way i
> can use them while in vi?

Like a lot of people, I use mutt+vim.  Here's some neat stuff I've collected
from various places and now lives in my ~/.vimrc:

<snip>

set nocompatible        " Use Vim defaults (much better!)
set backspace=indent,eol,start

augroup Mail
    au!
    " Wrap at 72 characters.
    au FileType mail set textwidth=72
    au FileType mail set autoindent
    au FileType mail set formatoptions=tcrq2n
    au FileType mail set comments+=n:\|
    au FileType mail set nomodeline
    "remove .sig from messages I am replying to
    au BufRead /tmp/mutt* normal :g/^| -- $/,/^$/-1dgg
augroup END

nmap J gqap
map <F11> :set paste<CR>I
" Use newsbody to spell check mail and such
map ^T \1\2<CR>:e! %<CR>
map \1 :w!<CR>
map \2 :!newsbody -qs -n % -p aspell check \%f<CR>

</snip>

Using these settings, vim should automatically wrap at 72 columns
(leaving room for a few levels of quoting).  I got that line about
removing the .sig from someone on here, but it doesn't actually seem to
work...

Hit 'J' in command mode to reformat the current paragraph; F11 to go to
paste mode (useful for pasting things in X, so vim won't mess up the
indentation) and ctrl-t to spell check your message.  You'll need to
install spellutils for that to work tho.

Even if you don't use the rest, please, please, please set your editor
to wrap your lines at some sane length.  Long lines make your mail much,
much harder to read.

-rob

Attachment: pgprnsJz7KGwo.pgp
Description: PGP signature


Reply to: