Re: Good vim configuration?

2001-12-31 Thread Gregor Zattler

Hi Thomas,
* Thomas Hurst [EMAIL PROTECTED] [Die 25 Dez 2001 12:14:19 GMT]:

[ ... reformating paragraphs in replys ... ]
 I use par(1), http://www.cs.berkeley.edu/~amc/Par/

How (with which parameters) do you use it? I saw it a few months ago
but got confused with parameters...

Ciao, Gregor



Re: Good vim configuration?

2001-12-31 Thread Thomas Hurst

* Gregor Zattler ([EMAIL PROTECTED]) wrote:

 * Thomas Hurst [EMAIL PROTECTED] [Die 25 Dez 2001 12:14:19 GMT]:

 [ ... reformating paragraphs in replys ... ]
  I use par(1), http://www.cs.berkeley.edu/~amc/Par/

 How (with which parameters) do you use it? I saw it a few months ago
 but got confused with parameters...

I stole PARINIT=grTbiqR B=.?_A_a Q=_s:| from someone and call it with
the number of the column to wrap at as an argument, i.e. 'par 72'.

-- 
Thomas 'Freaky' Hurst  -  [EMAIL PROTECTED]  -  http://www.aagh.net/
-
FORTRAN is not a flower but a weed -- it is hardy,
occasionally blooms, and grows in every computer.
-- A.J. Perlis



Re: Good vim configuration?

2001-12-31 Thread Rob 'Feztaa' Park

Alas! Thomas Hurst spake thus:
  How (with which parameters) do you use it? I saw it a few months ago
  but got confused with parameters...
 
 I stole PARINIT=grTbiqR B=.?_A_a Q=_s:| from someone and call it with

If I'm not mistaken, that looks _exactly_ like what the man page tells
you to use if you want to use par now, but understand it later. Then
again, maybe it just looks vaguely similar and I don't know enough about
par to recognize this :)

 the number of the column to wrap at as an argument, i.e. 'par 72'.

I just call 'par', the default wrap column seems reasonable to me :)

-- 
Rob 'Feztaa' Park
[EMAIL PROTECTED]
--
It's clearly a budget. It's got a lot of numbers in it.
-- George W. Bush



msg22054/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-31 Thread Thomas Hurst

* Rob 'Feztaa' Park ([EMAIL PROTECTED]) wrote:

 Alas! Thomas Hurst spake thus:

  I stole PARINIT=grTbiqR B=.?_A_a Q=_s:| from someone and call it
  with

 If I'm not mistaken, that looks _exactly_ like what the man page tells
 you to use if you want to use par now, but understand it later. Then
 again, maybe it just looks vaguely similar and I don't know enough
 about par to recognize this :)

The man page states: 'rTbgqR B=.,?_A_a Q=_s|', there's an extra 'i' in
mine which I'm sure does something l337 and magical I can't live
without.

A quick look through the mutt-* and vim* lists I'm likely to have
grabbed it from doesn't show anything, so who knows :)

Q= is presumably 'Quote', with _s being a space and | being the
character classes it matches.

B= is 'Body', mathing all upper and lowercase chacters, '.', ',' and
'?'.

'i' is apparantly invis, which seems to remove empty lines added by a
quote string. 'e' is a more powerful variant removing all superfluous
lines.

Other interesting looking entries are 'j' to justify (and a similar 'f'
option), 'l' to try to keep the last line from being too short, 'q'
which adds blank lines between quote levels, 'T4', which converts tabs
to the One True Tabstop using spaces (something I normally hate :).

Wow, that PARINIT's actually starting to make sense now.  Damn those
manpages.

And yes, the default wrap is 72 anyway, but I like being explicit,
usually :)

-- 
Thomas 'Freaky' Hurst  -  [EMAIL PROTECTED]  -  http://www.aagh.net/
-
Money is the root of all evil, and man needs roots



Re: Good vim configuration?

2001-12-31 Thread Rob 'Feztaa' Park

Alas! Thomas Hurst spake thus:
   I stole PARINIT=grTbiqR B=.?_A_a Q=_s:| from someone and call
   it with
 
  If I'm not mistaken, that looks _exactly_ like what the man page
  tells you to use if you want to use par now, but understand it
  later. Then again, maybe it just looks vaguely similar and I don't
  know enough about par to recognize this :)

 The man page states: 'rTbgqR B=.,?_A_a Q=_s|', there's an extra 'i'
 in mine which I'm sure does something l337 and magical I can't live
 without.

 A quick look through the mutt-* and vim* lists I'm likely to have
 grabbed it from doesn't show anything, so who knows :)

 Q= is presumably 'Quote', with _s being a space and | being the
 character classes it matches.

I don't believe that is true. IIRC, par handles David's '%' quote char
just fine. I thought it just looked for any string of characters that
appeared in more than one consecutive line, and then appended that to
the beginning of anything it wrapped (which is why it seems to fail on
me whenever I wrap one very long line, but works with any quotes when I
wrap several slightly long lines).

I'll read the man page though, it'll give me something to do to take my
mind off the Evils of Windows (Just spent ~5 hours trying to install
windows on Dad's computer. Lets just say that if I had a time machine
and a shotgun, nobody would have ever heard of Bill Gates or Microsoft).

 B= is 'Body', mathing all upper and lowercase chacters, '.', ',' and
 '?'.

Body? of what, the line?

 'i' is apparantly invis, which seems to remove empty lines added
 by a quote string. 'e' is a more powerful variant removing all
 superfluous lines.

 Other interesting looking entries are 'j' to justify (and a similar
 'f' option), 'l' to try to keep the last line from being too short,
 'q' which adds blank lines between quote levels, 'T4', which converts
 tabs to the One True Tabstop using spaces (something I normally hate
 :).

That's some interesting stuff. I'll be certain to read that man page
right away :)

-- 
Rob 'Feztaa' Park
[EMAIL PROTECTED]
--
When you are courting a nice girl an hour seems like a second. When
you sit on a red-hot cinder a second seems like an hour. That's
relativity.
-- Albert Einstein



msg22066/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-26 Thread David T-G

Philip, et al --

...and then Philip Mak said...
% 
% I tinkered around a bit more and came up with this code for making Ctrl+J
% (justify paragraph) work, even with quoted text.

Cool -- I like it a lot (or at least the *Para functions).


% 
% It assumes that ^[ ]*$ is the paragraph separator, meaning that any line
% which is blank or only contains '' and ' ' separates a paragraph. Here is
% the full code for making Ctrl+J work:

I'm sure I can figure out how to change that to '% ' so that it works for
me ;-)


...
% I'll keep refining this as I use it more and find any quirks. (If anyone
% here actually uses my code and has comments please let me know. :)

While I won't rebind to ctrl-j, I'll definitely use it for paragraph
hopping, which means it will get used in my f and F bindings.


% 
% BTW, regarding those other suggestions involving binding fmt or par
% to a key, isn't it slow to fork a process every time you press the
% rejustify key, or is that overhead negligible?

I've thought of that, but I haven't ever been able to see any problems
with it, so I think the latter is the answer.  I shell out to do
spell checking and sorting, too, and so perhaps I'm just used to it.
More importantly, though, I've tried to stick with a configuration that
works under stock vi on any system because I get dropped into so many
in my work.  [I think I might be able to get away with this because {}
will still behave normally in a non-mail-reply environment, and if I am
replying to mail I can ensure that vim is loaded :-]


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg21894/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-26 Thread Thomas Dickey

 BTW, regarding those other suggestions involving binding fmt or par
 to a key, isn't it slow to fork a process every time you press the
 rejustify key, or is that overhead negligible?

it really depends on how often you do it (I don't do this one, but have
equivalent cases in mind).

-- 
Thomas E. Dickey [EMAIL PROTECTED]
http://invisible-island.net
ftp://invisible-island.net



Re: Good vim configuration?

2001-12-26 Thread Bruno Postle

On Tue 25-Dec-2001 at 06:33:15AM -0500, Philip Mak wrote:
 I'm used to using pine's editor, which handles filling of paragraphs
 (even if they start with   due to quoting) fairly nicely.
 
 I'm wondering what configurations for .vimrc do you guys use for use
 with mutt?

I don't know where it came from originally, but this $editor setting in
my muttrc seems to do it all:

# F10 reflows the current paragraph and F11 toggles indenting so
# paste works properly.
set editor=vim \
-c 'set tw=72 et' \
-c 'set autoindent' \
-c 'set formatoptions=tcq2' \
-c 'set syntax=mail' \
-c 'map F10 gqap' \
-c 'set pastetoggle=F11'

In a similar vein, this $ispell works quite well for me too:

# spell colour properly and ignore quoted text
set ispell='aspell \
--language-tag=en_GB \
--mode=email \
--add-email-quote=%,#,:,} \
--check'

-- 
Bruno



Good vim configuration?

2001-12-25 Thread Philip Mak

I'm used to using pine's editor, which handles filling of paragraphs (even
if they start with   due to quoting) fairly nicely.

How can I achieve the same thing in vi? I'd like to be able to bind a key
such that when I press it, it automatically refills the current paragraph
smartly. Some automatic line wrapping would be nice, too... I'm wondering
what configurations for .vimrc do you guys use for use with mutt?




Re: Good vim configuration?

2001-12-25 Thread Gerhard Häring

Le 25/12/01 à 06:33, Philip Mak écrivit:
 I'm used to using pine's editor, which handles filling of paragraphs (even
 if they start with   due to quoting) fairly nicely.
 
 How can I achieve the same thing in vi? I'd like to be able to bind a key
 such that when I press it, it automatically refills the current paragraph
 smartly. Some automatic line wrapping would be nice, too... I'm wondering
 what configurations for .vimrc do you guys use for use with mutt?

I don't have anything mutt-specific in my .vimrc. Butt gqap works quite
well for me. More info (in vim): :h gq.

Gerhard
-- 
mail:   gerhard at bigfoot dot de   registered Linux user #64239
web:http://www.cs.fhm.edu/~ifw00065/OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



Re: Good vim configuration?

2001-12-25 Thread Rob 'Feztaa' Park

On Tue, Dec 25, 2001 at 06:33:15AM -0500, Philip Mak (dis)graced my inbox with:
 I'm used to using pine's editor, which handles filling of paragraphs (even
 if they start with   due to quoting) fairly nicely.
 
 How can I achieve the same thing in vi? I'd like to be able to bind a key
 such that when I press it, it automatically refills the current paragraph
 smartly. Some automatic line wrapping would be nice, too... I'm wondering
 what configurations for .vimrc do you guys use for use with mutt?

I've been meaning to write a script that will reformat text properly,
handling quoting properly, but I haven't had time yet (and probably
won't until at least January). I'm pretty sure somebody else here has
done it already, though... perhaps he is willing to share?

-- 
Rob 'Feztaa' Park
[EMAIL PROTECTED]
--
People who think MS-DOS and Windows are the slickest thing since
sliced butter should be forced to wear a sign stating This mind
intentionally left blank.



msg21875/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-25 Thread Thomas Hurst

* Philip Mak ([EMAIL PROTECTED]) wrote:

 How can I achieve the same thing in vi? I'd like to be able to bind a
 key such that when I press it, it automatically refills the current
 paragraph smartly. Some automatic line wrapping would be nice,
 too... I'm wondering what configurations for .vimrc do you guys use
 for use with mutt?

I use par(1), http://www.cs.berkeley.edu/~amc/Par/

-- 
Thomas 'Freaky' Hurst  -  [EMAIL PROTECTED]  -  http://www.aagh.net/
-
When confronted by a difficult problem, you can solve it more easily by
reducing it to the question, How would the Lone Ranger handle this?



Re: Good vim configuration?

2001-12-25 Thread Philip Mak

I did some digging around Google and came up with this:

[pmak@lina pmak]$ cat .muttvimrc
map C-J {gq}  # Ctrl+J rejustifies current paragraph
set formatoptions=tcroqv# see :help formatoptions
set comments=nb:   # rejustify quoted text correctly
set tw=75   # wrap lines to 75 chars
[pmak@lina pmak]$ egrep editor .muttrc
# load a special vimrc when starting vim from mutt
# and start the cursor at the end of the headers
set editor=vim -u ~/.muttvimrc +/^$

It doesn't seem to work with all recent versions of VIM, though. It's very
weird---version 6.0z Beta (2001 Mar 24) seems to ignore whatever I put in
set comments. On version 6.0 (2001 Sep 26), the set comments thing
works but I can't map any control keys for some reason (!). I'm still
trying to figure that out.

But the reformatting of lines, even ones with multiple levels of quoted
text, seems to work.




Re: Good vim configuration?

2001-12-25 Thread Thomas Dickey

On Tue, Dec 25, 2001 at 12:14:19PM +, Thomas Hurst wrote:
 * Philip Mak ([EMAIL PROTECTED]) wrote:
 
  How can I achieve the same thing in vi? I'd like to be able to bind a
  key such that when I press it, it automatically refills the current
  paragraph smartly. Some automatic line wrapping would be nice,
  too... I'm wondering what configurations for .vimrc do you guys use
  for use with mutt?
 
 I use par(1), http://www.cs.berkeley.edu/~amc/Par/

It (flowing with mail-quotes) is a builtin in vim and vile.

-- 
Thomas E. Dickey [EMAIL PROTECTED]
http://invisible-island.net
ftp://invisible-island.net



Re: Good vim configuration?

2001-12-25 Thread David T-G

Philip --

...and then Philip Mak said...
% 
% I'm used to using pine's editor, which handles filling of paragraphs (even
% if they start with   due to quoting) fairly nicely.
% 
% How can I achieve the same thing in vi? I'd like to be able to bind a key
% such that when I press it, it automatically refills the current paragraph
% smartly. Some automatic line wrapping would be nice, too... I'm wondering
% what configurations for .vimrc do you guys use for use with mutt?

fmt won't work for quoted text, but a command like

  map f !} fmt -c
  map F !} fmt -c -w 78

in your .exrc will bind the f and F keys to pump your current paragraph
through fmt -- which is particularly handy if you are using just vi and
don't have the additional features of vim (you mentioned vim in the
subject but vi in the body so perhaps, as I, you use both).

HTH  HAND


Merry Christmas to all!

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg21879/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-25 Thread David T-G

Rob --

...and then Feztaa said...
% 
% On Tue, Dec 25, 2001 at 06:33:15AM -0500, Philip Mak (dis)graced my inbox with:
%  I'm used to using pine's editor, which handles filling of paragraphs (even
%  if they start with   due to quoting) fairly nicely.
%  
%  How can I achieve the same thing in vi? I'd like to be able to bind a key
%  such that when I press it, it automatically refills the current paragraph
%  smartly. Some automatic line wrapping would be nice, too... I'm wondering
%  what configurations for .vimrc do you guys use for use with mutt?
% 
% I've been meaning to write a script that will reformat text properly,
% handling quoting properly, but I haven't had time yet (and probably
% won't until at least January). I'm pretty sure somebody else here has
% done it already, though... perhaps he is willing to share?

It's called par, and it's much more than a script :-)  If fmt isn't good
enough for you, then par will certainly leave you happy.


% 
% -- 
% Rob 'Feztaa' Park
% [EMAIL PROTECTED]
% --
% People who think MS-DOS and Windows are the slickest thing since
% sliced butter should be forced to wear a sign stating This mind
% intentionally left blank.

HTH  HAND


Merry Christmas to all!

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg21880/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-25 Thread David T-G

Philip --

...and then David T-G said...
% 
% ...and then Philip Mak said...
% % 
% % smartly. Some automatic line wrapping would be nice, too... I'm wondering

Oh, yeah.  There're both tw (text width) and wm (wrap margin); both have
their advantages.


% HTH  HAND
% 
% 
% Merry Christmas to all!

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg21881/pgp0.pgp
Description: PGP signature


Re: Good vim configuration?

2001-12-25 Thread Joel Hammer

You can do anything you want to your docment with shell commands. 
eg.
:1,5 !fmt
will close up lines 1 to 5.
or:
!}fmt
will do the same to the next paragraph break (blank line).
info fmt will show you some options.
You could write a very short script to do just want you want and bind it to
a key.
Joel
On Tue, Dec 25, 2001 at 06:33:15AM -0500, Philip Mak wrote:
 I'm used to using pine's editor, which handles filling of paragraphs (even
 if they start with   due to quoting) fairly nicely.
 
 How can I achieve the same thing in vi? I'd like to be able to bind a key
 such that when I press it, it automatically refills the current paragraph
 smartly. Some automatic line wrapping would be nice, too... I'm wondering
 what configurations for .vimrc do you guys use for use with mutt?



Re: Good vim configuration?

2001-12-25 Thread Philip Mak

I tinkered around a bit more and came up with this code for making Ctrl+J
(justify paragraph) work, even with quoted text.

It assumes that ^[ ]*$ is the paragraph separator, meaning that any line
which is blank or only contains '' and ' ' separates a paragraph. Here is
the full code for making Ctrl+J work:

[pmak@lina pmak]$ cat .muttvimrc
function! PrevPara()
  if !search(^[ ]*$, 'bW')
1
  endif
endfunction

function! NextPara()
  if !search(^[ ]*$, 'W')
$
  endif
endfunction

set formatoptions=tcqv
set comments=nb:
set tw=75
set cpo-=
map { :call PrevPara()ENTER
map } :call NextPara()ENTER
map C-J {gq}j
[pmak@lina pmak]$ egrep editor .muttrc
set editor=vim -u ~/.muttvimrc +/^$

I'll keep refining this as I use it more and find any quirks. (If anyone
here actually uses my code and has comments please let me know. :)

BTW, regarding those other suggestions involving binding fmt or par
to a key, isn't it slow to fork a process every time you press the
rejustify key, or is that overhead negligible?