Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone come up with a fix line continuation (Python-style) in Sublime Text 2?

The issue I am referring to is the indentation behavior of lists and other things in Python when on two lines. The result I am looking for is for Sublime to automatically indent like this example, making the code a little prettier:

def testmethod(argument1, argument2,
               argument3, argument4):
    pass

But in Sublime, when you press enter after line 1, and then type the remaining arguments, this happens:

def testmethod(argument1, argument2,
    argument3, argument4):
    pass

Obviously, this isn't very readable (and uncompliant with PEP 8 style conventions). I Googled around and found a few unresolved threads, no solutions. Running latest version of Sublime Text 2, on a Mac. Any help would be appreciated.

like image 751
artemisc360 Avatar asked Jun 04 '12 18:06

artemisc360


People also ask

Is Sublime Text good for Python?

Sublime Text can be used for much more than Python development and there are many useful tutorials that are not targeted at a specific programming language which are still useful. Super charge your Sublime Text 3 to increase your productivity provides many shortcuts and tricks for using the editor.

Is there Sublime Text 4?

Sublime Text 4 is the current version of Sublime Text. For bleeding-edge releases, see the dev builds. Sublime Text may be downloaded and evaluated for free, however a license must be purchased for continued use. There is currently no enforced time limit for the evaluation.

Is Sublime Text still being developed?

The first stable release of Sublime Text 4 has finally arrived! We've worked hard on providing improvements without losing focus on what makes Sublime Text great. There are some new major features that we hope will significantly improve your workflow and a countless number of minor improvements across the board.


1 Answers

This can (partially) be fixed by adding:

"indent_to_bracket": true

to your Packages/User/Preferences.sublime-settings file (linux). But unfortunetly it currently only seems to work for (), and not {}[].

like image 123
fraxel Avatar answered Oct 01 '22 00:10

fraxel