[TxMt] Re: Small Python annoyances

Hans-Joerg Bibiko bibiko at eva.mpg.de
Thu Jun 19 10:37:06 UTC 2008


On 19 Jun 2008, at 11:48, Julio Biason wrote:

> First, I disabled the Auto-pair characters option, but I still get the
> closing parenthesis and colon when I create a function ("def"). It
> ignores when I type the closing parenthesis, but it doesn't ignore the
> colon.

Auto-pair characters works only on (), {}, "", ``, <>, etc. not on  
colons :.

What do you mean with "but I still get the closing parenthesis and  
colon when I create a function ("def")" ?

If you type "def" and press TAB it inserts:

def fname():
     """docstring for fname"""
     pass

and with TAB you can jump through the code to modifiy it easily. This  
has nothing to do with auto-pairing.


I agree that if you are using a template to open a python script it  
uses TABs instead of SPACEs but this can be changed easily while  
editing these templates.


> Second, it seems TextMate get really confused when you follow PEP8: If
> you use spaces instead of tabs, it doesn't do auto-indentation in the
> next line. In the same issue, it seems TextMate uses tabs instead of
> spaces (against the PEP8.)

Did you set up the doc to use "Soft Tabs"? (status bar > click on Tab  
size).
Then TM does the job.

> Third, still in the PEP8-issues, I'm trying to find a way to make
> hard-breaks when going beyond column 78. TextMate have soft-breaks,
> but I'd really like to have it to automagically insert the break for
> me (and add an indentation to the next line.)

To do this automatically while writing could be a bit tricky. But I  
think of having either a tidy function which will do this or a command  
like APPLE + \ which will do this for the current line.
Up to now you can preset TM to "show the right margin indicator", set  
the Wrap Column to 79. If you are at the end, press \ and RETURN. TM  
will indent the next line automatically.


> Fourth, PyCheckMate doesn't understand when you do an indentation when
> you do a hard-break and add the indentation (it complains about
> "unexpected indent".)

Not for me. Could you please give an example.

--Hans





More information about the textmate mailing list