Sublime Text Auto-Indent Python Keyword Arguments

I'm having a problem where Sublime acts the way I like with keyword arguments. PEP-8 allows two conventions for function calls:

function_name( arg=1, arg2=blah) 

and

 function_name(arg=1, arg2=blah) 

I prefer the latter for lines of less than 80 characters. but Sublime Text 3 is not suitable for this. When I press Enter after the first comma of the line, the indentation continues in four places:

 function_name(arg=1, arg2=blah) 

Is there a way to make the editor align the cursor to the position to the right of the open bracket?

Thanks!

+5
source share
1 answer

You need to change Sublime Text Preferences.

  • Open Settings
  • Settings โ†’ User
  • Add this line there:
 {"indent_to_bracket": true} 
  1. Restart sublime

After that, you will create the code as follows:

 def function(*arg, **kwargs): #body 
+13
source

Source: https://habr.com/ru/post/1207241/


All Articles