Useful pythonic feature request



  • Hi !

    Is possible to code hard implement solution or plugin (if necessary), which will do following thing, when it recognize python file (.py, .pyw) ?:

    Move to new line when Enter is pressed, not from actual cursor position (will explain below), but from end of paired double symbol (parentheses, brackers, braces…).
    When user has set Auto-Insert completion of parentheses, he ends with writing python line mostly when argument of function call is done between parentheses.
    Then logically would be handy to hit Enter for next line, but when you do (as it is now), it will move to the new line also second part of parentheses, because cursor ended at that place.
    So it must work with Auto-Insert feature to ignore cursor position right before second parenthesis and make new line without it. It make sense for pythoners like languages.
    I guess it’s not like in javascript when parentheses migrate through lines away from their first half.

    function_name + first_parenthesis + argument_inside + second_parenthesis:
    print(‘hello’)

    Re-emphasize again: when user finishes his argument and therefore it’s finished whole function call, would be handy to hit just Enter.
    How it is now, it’s NOT HANDY to press so often with your pinky (pinkie, little finger) Right arrow or Down arrow or End button just to get to the end of line.
    This feature would save a lot of hits and mishits, because it’s hard to keep focused on main letters and so often hit keys on right down corner of keyboard for just getting end of line.
    Please it’s super good and effective for python-like languages.

    Please Don Ho consider it and my older proposals. They all are super good.

    Thank you



  • Ideas, opinions ?
    Ty



  • Python, as well as some other programming languages, supports multi-line expressions and strings. So, in general case, there’s no way to understand whether you mean to put Enter between parenthesis/brackets/quotes or not. Sometimes function arguments are intentionally placed on different lines, e.g.:

    my_long_func_name(
      get_param1_by_calling_other_func(x),
      get_param2_by_calling_other_func(y),
      get_param3_by_calling_other_func(a, b, c)
    )
    


  • Ok but how you do it personally ?
    You either have turned off Auto-Insert for parentheses and write them manually from upper right sector of keyboard; or you have it turned on and trying find End button with pinkie and lose base hand position for <jkl;> as for all 10 fingers writing ?
    I don’t know what is better, because I didn’t code too much, since still waiting for Don Ho.

    I have looked into random code snippets and I see these are only possible actions after one writes something between parentheses (in python):

    • colon (after function definition, conditionals, loops)
    • new line (after function call)
    • 1 whitespace (to continue write expressions in same line)

    So yes, computer won’t know what is an user’s intention. Do you have any idea, how to solve it ?

    And how you do a multi-editing(kind of) ?:
    I saw something like that in preferences, but I don’t know how to ‘activate’ it by my action.
    I just guess, that multi-highliting of same seleced word is there for some purpose.
    If in a file, user has 5 times function name for example: my_function, and if user selects one example/instance of this name, NP++ highlights all other instances of it in that file.
    So I guess, it’s possible to edit-rewrite all instances by editing just one example of it. But how ?

    Thank you !



  • or anyone who codes everyday basis may reply too to my last post please


Log in to reply