Oops!  Didn't reply to the group...

on 1/18/00 10:22 AM, John at [EMAIL PROTECTED] wrote:

> 1. Using vim, how could I replace tabs with spaces ? Not just reduce
> or enlarge the tabsize like with 'set ts=' but phsyically replace them
> with a number of spaces. I've tried variations of the %s/ / /g command
> but can't get vim to actually recognise my tab parameter.

In command mode (i.e., not insert mode), type this:
:%s/\t/    /g
(that's four spaces, assuming you want to replace all tabs with 4 spaces)

What this does is:
 :  Tells vim you want to enter an ex command
 %  Tells vim you want to work on all lines in the file (you can also use
1,$)
 s  Tells vim you want to do a substitution.  The syntax for a substitution
is "s/findval/replaceval/options".
 \t Tells vim that you want to find tabs
 4 spaces tell vim to replace with 4 spaces
 g is an "s//" option that tells vim to replace all occurrences on the line.
(The % tells it every line, g tells it every occurence on a given line.)

> 2. Using vim (again), how could I find a matching brace or bracket '}'
> or ')'   for a brace or bracket that the cursor is on?  I'm using vim
> to brush up on some programming skills and need a quick way of finding
> a match for a brace, not just the 'next brace'.

In command mode (again), position the cursor on the brace, bracket,
parenthesis, etc.  Press "%".  Vim automatically jumps to the matching one.
(Pressing % again, of course, jumps back to the one you started on.)

Your other question regarding MC was answered elsewhere.  :)

HTH,
JFK

Reply via email to