# Text editor improvements

**URL:** <https://blenderartists.org/t/text-editor-improvements/480723>\
**Category:** Python Support\
**Created:** [June 25, 2010, 1:48pm UTC](https://blenderartists.org/t/text-editor-improvements/480723 "2010-06-25T13:48:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreampainter](https://blenderartists.org/letter_avatar_proxy/v4/letter/d/59ef9b/32.png) [@dreampainter](https://blenderartists.org/u/dreampainter)\
**Post date:** [June 25, 2010, 1:48pm UTC](https://blenderartists.org/t/text-editor-improvements/480723/1 "2010-06-25T13:48:25Z")

</div>

Hi all,

while scripting in blender i found that some things could be automated, and so i started scripting. the script can be downloaded [here](http://sites.google.com/site/dreampainterprod/depo/text_smart_operators.py?attredirects=0&d=1).

so far i have:

```
* smart line break
* smart delete
* smart backspace

```

smart line break handles auto (un)indent and aligns lists.

```auto

# Example:
def function (): # pressing return with the cursor after the ':'
    a = 1 # will automagically put the cursor before where you can type (auto indent)
    return a # pressing return with the cursor after 'a' will put the cursor
        # at the beginning of this line (auto unindent)

function(arg1 = 1,
         arg2 = [1,
                 2,
                 3],
         arg3 = False) #each new line is automagically aligned to the previous

```

smart delete deletes all whitespace after the cursor.

```auto

# Example
def function():
    String = "Text" # Pressing Delete with the cursor at the end of this line
    "Text2" # will turn the line to the following

def funtion():
    String = "Text""Text2"

```

smart backspace handles whitespaces in groups of length of tab\_width.  
if for example tab\_width is 4, then pressing backspace will backspace to the last multiple  
of 4 spaces. it will act as if 4 spaces are one tab.

one thing however that i havent been able to make work, is to have this as an addon.  
this because of the changing of older keys, which dont seem to exist before the splash-screen is clicked away.  
so you have to open the script in blender in the text editor and run it. i myself have it open in my default blendfile, so i only have to click run. if someone knows a way around this, anyway, please tell me.

any C&C, requests and bug reports are welcome

have fun, DreamPainter

---

<div class="post-metadata">

**Author:** ![namekuseijin](https://blenderartists.org/user_avatar/blenderartists.org/namekuseijin/32/7122_2.png) [@namekuseijin](https://blenderartists.org/u/namekuseijin)\
**Post date:** [June 25, 2010, 1:58pm UTC](https://blenderartists.org/t/text-editor-improvements/480723/2 "2010-06-25T13:58:00Z")

</div>

hey, how about text completion, templates or macros? None? meh, I’ll stick with vim or emacs… 😛

---

<div class="post-metadata">

**Author:** ![Maurice\_Raybaud](https://blenderartists.org/user_avatar/blenderartists.org/maurice_raybaud/32/8332_2.png) [@Maurice\_Raybaud](https://blenderartists.org/u/Maurice_Raybaud)\
**Post date:** [June 25, 2010, 2:08pm UTC](https://blenderartists.org/t/text-editor-improvements/480723/3 "2010-06-25T14:08:19Z")

</div>

Is there a way to make a custom syntax highlight scheme? Sorry that’s a little offtopic.

Your script looks nice and such goodies would motivate to do something else with the text editor like RIB, POV, whatever…

Thanks.

---

<div class="post-metadata">

**Author:** ![demohero](https://blenderartists.org/letter_avatar_proxy/v4/letter/d/858c86/32.png) [@demohero](https://blenderartists.org/u/demohero)\
**Post date:** [June 26, 2010, 11:25am UTC](https://blenderartists.org/t/text-editor-improvements/480723/4 "2010-06-26T11:25:12Z")

</div>

Useful improvements. Thanks DreamPainter. I hope you’ll improve the text editor further. :yes:

---

<div class="post-metadata">

**Author:** ![RickyBlender](https://blenderartists.org/user_avatar/blenderartists.org/rickyblender/32/7134_2.png) [@RickyBlender](https://blenderartists.org/u/RickyBlender)\
**Post date:** [June 26, 2010, 1:23pm UTC](https://blenderartists.org/t/text-editor-improvements/480723/5 "2010-06-26T13:23:21Z")

</div>

well don’t know if not too complicated whish this was included in standard edit functions

how about having each function or class into an independant window to edit!

always looking where functions or class are located in a big file!

or may be have a list of class or functions where you can go very fast to edit

keep up the good work

happy 2.5
