[Sussex] The Moot Talks

Al Girling al at gcguk.demon.co.uk
Sun Feb 10 22:15:10 UTC 2008


Hi folks,

On Sun, Feb 03, 2008 at 02:30:46PM GMT, Steve Dobson wrote:
> Hi Guys
> 
> As we don't have a volunteer to give a talk this month looks like I'm
> going to have to volunteer someone.  So I pick you, you and you.
> 
> A long time ago we did a set of lighten talks and one of the presenters
> that night did "Ten Tips In Ten Minutes".  I'm going to build on that.
> 
> Everyone (yes everyone) must must give three useful tips on how to
> improve the Linux experience.  There is no limit limit on what the tip
> can be.  Tips on installation, tips on sharing data with that other OS I
> can't quite remember the name of at the moment :-).  No limit on
> subject.  Just one on time:  one minute per tip.  So there's no need to
> do a Impress presentation, you won't be given the time to set it up.
> 
> If you're thinking that you don't know anything you're wrong.  We have
> all leaned something the hard way and learnt from bitter experience how
> to do things better.  Let's pass that knowledge on.

I'm unlikely to get to the next moot or indeed attend any soon, but
would like to contribute something back to the Sussex LUG so I thought
I'd follow up on Steve's vi talk and offer a few tips on vim here
instead.  I hope you find them useful.

Firstly, especially for Steve.

To return to a buffer when editing a bunch of files use:

ctrl-^ or :prev or key :ls to see the number of the previous buffer and use
:b<n> were <n> is the buffer number.

Something else I use regularly is the word completion as read from the system
dictionary.

Say your keying anaesthesiologists, but can't remember how many vowels
and what order they go in.  Start with an, and while still in insert
mode, key ctrl-x, ctrl-k to get a drop down list from which to choose.
You can also add other dictionaries or your own word files to select
from.  The ctrl-x commands also allow you to use path and filename
completion with ctrl-x, ctrl-f.  You can repeat lines with ctrl-x,
ctrl-l also.

During the vi talk, Steve described a method of doing search and replace across
multiple files.  I've done it like this for a while.

With the files you wish to edit placed in buffers and wanting to change <foo>
with <bar> use:

:argdo %s/<foo>/<bar>/gce |w

The flags gce mean:

g == replace all occurrences on a line.
c == confirm you wish to make the change.
e == if the pattern fails, continue and don't print an error message.

The |w is required to write each file before the next can be edited.

So this command runs through all matches to your pattern in all your chosen
files, stopping at each match and asking for a 'y', 'n' response.

This is one of my favourites.

To add characters to the end of a list with different lengths as seen below
using block select ctrl-v.

one
two
three
four
five

Place the curser on the 'e' in one.  Key ctrl-v and move to the bottom of the
list in what ever way you choose.  Key '$' for end of line and then 'A' to
append at the end of the line.  Add your chosen text and hit the ESC button.
Voila!  Your chosen text added to all the lines you selected.

There you go folks, in the words of the Sirius Cybernetic Corporation
"Share and Enjoy!"

Al

-- 
Al Girling

Linux User: #290080             <http://counter.li.org>
Home-page:                      <http://al.sdf-eu.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20080210/b7894d62/attachment.pgp 


More information about the Sussex mailing list