Torsten Andre wrote:
> Hi everyone,
>
> I just can't seem to get a hold of this. I would like VIM to break lines
> after 79 characters. So I used :set textwidth=79, which works like a
> charm. The problem I have though, is when I want to print long messages.
>
> For example in python, when I write something like this:
>
>       print "This is a very long line which is wrapped after 79 chars         
>       which may have happened just before these words and oh my, it
>       happened again."
>
> Well, two things that annoy me a little bit. First of all the statement
> is not correct, since the interpreter gets to EOL without a proper
> ending of the statement. I manually need to include "\" so it's a valid
> statement. Is there a way around this? Can I have vim add a "\"?
Here you want vim to recognize that its in a non-terminated string and to 
append a "\" before including the newline.

> When executing the script, it will print the tabs/spaces vim includes
> just before "which" and "happened" in order to keep it aligned with the
> print command. But as you can assume that's the last thing I want.
>   
[snip]

And here, again, you want vim to recognize that a non-terminated string 
exists and to indent differently based on that.

Assuming that you have syntax highlighting enabled, the information that 
a non-terminated string exists would be indicated by "pythonString" 
highlighting in effect at a newline boundary.  Not saying that it would 
be easy, but perhaps you could modify vim72/indent/python.vim to do what 
you want.  Don't modify the distribution file itself!  Instead, copy it 
to $HOME/.vim/indent and modify your copy (that way updates to vim won't 
wipe out your work).

Look into synIDattr() -- with that you can get the current syntax 
highlighting group (ie. pythonString).
Use your modification to the python indenting to get the no-indent 
effect you want.  You might be able to bend it enough to append the 
trailing backslash on the preceding line, too.

Regards,
Chip Campbell




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to