Re: cindent weirdness

2006-12-09 Thread Tobias Pflug



Looks lika a misbehaving sript.
In the problem buffer (if and when the error reappears):

:verbose setlocal cindent? cinoptions? indentexpr?

- 'cinoptions' influences how 'cindent' works
- if 'indentexpr' is nonempty, it overrules 'cindent'.

:verbose will tell you where each of these options was last set.

It just happened again right now. So here is the result of your
suggested command:

cindent
Last set from /usr/share/vim/vim70/indent/c.vim

cinoptions=

indentexpr=GetTexIndent()
Last set from ~/shared_home/vim/plugin/indent/tex.vim


So I suppose it might be tex.vim screwing things up there ?


Re: cindent weirdness

2006-12-09 Thread A.J.Mechelynck

Tobias Pflug wrote:



Looks lika a misbehaving sript.
In the problem buffer (if and when the error reappears):

:verbose setlocal cindent? cinoptions? indentexpr?

- 'cinoptions' influences how 'cindent' works
- if 'indentexpr' is nonempty, it overrules 'cindent'.

:verbose will tell you where each of these options was last set.

It just happened again right now. So here is the result of your
suggested command:

cindent
Last set from /usr/share/vim/vim70/indent/c.vim

cinoptions=

indentexpr=GetTexIndent()
Last set from ~/shared_home/vim/plugin/indent/tex.vim


So I suppose it might be tex.vim screwing things up there ?



Probably. Check the source of that tex.vim indent plugin. I suspect that 
'indentexpr' is defined with :set (clobbering indent options for all windows 
and buffers) instead of with :setlocal (setting the option for its own 
buffer only).


If that is the case, replace set by setlocal in a line similar to

set indentexpr=GetTexIndent()

and notify the script's maintainer (whose name and email address ought to be 
mentioned in a comment near the start of the script).



Best regards,
Tony.


Does automated line unwrap exist?

2006-12-09 Thread Matt England
I frequently use automated line wrap (eg, 'wrapmargin', fmt(1) integration, 
etc) to write documents (like asciidoc sources) in vim.


I'd like to use an automated unwrap feature.  Does such a thing exist in 
vim?  Or a unix/linux command primitive I can integrate (similar to the way 
I use 'map v {!}fmt^M' to fix paragraph wrap while I'm editing them?


Even better, might vim include a programmable feature now or in the future 
to automatically make non-wrapped lines look like wrapped lines much like 
WYSIWYG editors do?


My main goal: I want to be able to use the spell-and-grammar checking of 
editors like MS Word when I'm done writing my asciidoc text, but MS Word 
doesn't handle hard-lines well when doing this.  I haven't found another 
editor that does spell-and-grammar checking as well as word (I couldn't 
figure out how to get OpenOffice Writer to do it well).


There are other goals, but this is the big one.

-Matt



Re: Does automated line unwrap exist?

2006-12-09 Thread Tim Chase

 I'd like to use an automated unwrap feature.  Does such a
 thing exist in vim?  Or a unix/linux command primitive I can
 integrate (similar to the way I use 'map v {!}fmt^M' to fix
 paragraph wrap while I'm editing them?

If I understand what you're doing, if you have your 'textwidth' 
property set to

what you want, you can use

gqip

to reformat the paragraph you're currently sitting on.  This 
should work on platforms that don't have fmt available.


 Even better, might vim include a programmable feature now or
 in the future to automatically make non-wrapped lines look
 like wrapped lines much like WYSIWYG editors do?

Well, Vim does offer the 'wrap' option

:set linebreak wrap tw=0

Your lines should then visually wrap, but not have embedded line 
breaks.



If you want to join all the lines in a paragraph, you can use

vipJ

or, if you want to do it over your entire document, you can do 
things like


:g/^\s*\n.*\S/+norm vipJ

You can tweak that expression to find (or exclude) whatever you want.

Any of those should be mappable if you want.

If this doesn't do the trick, it might help to better explain 
what you're looking for it to do.


-tim








Re: Does automated line unwrap exist?

2006-12-09 Thread A.J.Mechelynck

Matt England wrote:
I frequently use automated line wrap (eg, 'wrapmargin', fmt(1) 
integration, etc) to write documents (like asciidoc sources) in vim.


I'd like to use an automated unwrap feature.  Does such a thing exist 
in vim?  Or a unix/linux command primitive I can integrate (similar to 
the way I use 'map v {!}fmt^M' to fix paragraph wrap while I'm editing 
them?


Even better, might vim include a programmable feature now or in the 
future to automatically make non-wrapped lines look like wrapped lines 
much like WYSIWYG editors do?


My main goal: I want to be able to use the spell-and-grammar checking of 
editors like MS Word when I'm done writing my asciidoc text, but MS Word 
doesn't handle hard-lines well when doing this.  I haven't found another 
editor that does spell-and-grammar checking as well as word (I couldn't 
figure out how to get OpenOffice Writer to do it well).


There are other goals, but this is the big one.

-Matt




If you want to format all paragraphs as single lines, set textwidth to a very 
large number, then reformat:


:set wm=0 tw=99
:normal gggqG


Best regards,
Tony.


Mouse to position cursor

2006-12-09 Thread Mayur Pant

Hi,

	I may be shunned from the vim console using community for asking  
this,	but,


is there anyway to simulate the behaviour of gvim from the console, ie.

left click to position the cursor to a point within the text,
right click to select blocks of it,
middle click to paste

(it already does the second two).

	I would find this a lot faster in most circumstances (sometimes I don't  
know how many n's back a character is off the top of my head).



Thanks.


Mayur


Re: Mouse to position cursor

2006-12-09 Thread A.J.Mechelynck

Mayur Pant wrote:

Hi,

I may be shunned from the vim console using community for asking 
this,but,


is there anyway to simulate the behaviour of gvim from the console, ie.

left click to position the cursor to a point within the text,
right click to select blocks of it,
middle click to paste

(it already does the second two).

I would find this a lot faster in most circumstances (sometimes I 
don't know how many n's back a character is off the top of my head).



Thanks.


Mayur



Left-clicking should already position the cursor, but you can do

:verbose set mouse? mousemodel?
followed by
:set mouse=ar mousemodel=extend

which makes the mouse act as folows:

left-click:set cursor
left-drag: start selection
shift-left:search word
right-click:   extend selection
right-drag:extend selection
middle-click:  paste

see
:help 'mouse'
:help 'mousemodel'

In addition,
- don't source mswin.vim
- either don't use :behave, or use :behave xterm which (among others) sets 
'mousemodel' to extend.



Best regards,
Tony.


Re: Mouse to position cursor

2006-12-09 Thread Mayur Pant

Hi,

   thanks for that: I checked, and it's set to mouse =ar mousemodel =  
extend,


   but click at a position still doesn't not move the block cursor  
position; although triple clicking selects the word...


   any idea what the issue could be?

thanks,

I'll keep checking the help file too...

 Mayur

On Sat, 09 Dec 2006 21:39:59 -, A.J.Mechelynck  
[EMAIL PROTECTED] wrote:



Mayur Pant wrote:

Hi,
 I may be shunned from the vim console using community for asking  
this,but,
 is there anyway to simulate the behaviour of gvim from the  
console, ie.

 left click to position the cursor to a point within the text,
right click to select blocks of it,
middle click to paste
 (it already does the second two).
 I would find this a lot faster in most circumstances (sometimes I  
don't know how many n's back a character is off the top of my head).

  Thanks.
  Mayur



Left-clicking should already position the cursor, but you can do

:verbose set mouse? mousemodel?
followed by
:set mouse=ar mousemodel=extend

which makes the mouse act as folows:

left-click:set cursor
left-drag: start selection
shift-left:search word
right-click:   extend selection
right-drag:extend selection
middle-click:  paste

see
:help 'mouse'
:help 'mousemodel'

In addition,
- don't source mswin.vim
- either don't use :behave, or use :behave xterm which (among  
others) sets 'mousemodel' to extend.



Best regards,
Tony.





Re: Mouse to position cursor

2006-12-09 Thread A.J.Mechelynck

Mayur Pant wrote:

Hi,

   thanks for that: I checked, and it's set to mouse =ar mousemodel = 
extend,


   but click at a position still doesn't not move the block cursor 
position; although triple clicking selects the word...


   any idea what the issue could be?

thanks,

I'll keep checking the help file too...

 Mayur



Which version/patchlevel are you using? (See the first 4 lines of the output 
of :version; and see :help :redir about how to capture that output.) I have


VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec  5 2006 22:18:11)
Included patches: 1-178
Compiled by [EMAIL PROTECTED]
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
(etc.)

and here I see the following:

single left click positions cursor
double left click selects word (except in help, where it jumps to help for 
clicked word)

triple left click selects line
quadruple left click selects block

You say a triple left click selects word...
- What happens on double click?
- Do you have mappings with left-hand sides like
LeftMouse, 2-LeftMouse, 3-LeftMouse etc.?


Best regards,
Tony.


Regexp pattern confusion...

2006-12-09 Thread Meino Christian Cramer
Hi,

 in a previous mail I asked for a way to replace $variable with
 ${variable} in shell scripts.

 One suggested solution was to apply the following to the script

 :%s/\$\zs\(\w\+\)/{\1}/gc

 which works nicely.

 Now I wanted to extend the above expression to also change
 $-expressions in my shell scripts like

 $#arrayvar
 $?
 $*
 $@

 ...and so on. So I changed (just for a test first) the above
 expression with

 :%s/\$\zs\([\w]\+\)/{\1}/gc

 (added [] around \w) which -- as far as I know (and it seems, that
 this isn't enough in this case... ;) -- does not change anything,
 since it simply says: one or more of the itenms in the []s -- and the
 only item is a word-character.

 But suddenly nothing was matched anymore

 My final approach was this one:

 :%s/\$\zs\([\w\#\$\*\?]\+\)/{\1}/gc

 but 

 What did I wrong here ?

 Thank you very much for any help in advance !
 Have a nice weekend!
 mcc