0

def counter(num):

I always get stuck inside of the parenthesis and find myself pressing ESC, going back to Normal mode, then pressing A to append the colon to the end of the line. Is there a faster way?

2
  • Welcome to Vi and Vim! I assume that you're using a plug-in such as auto-pairs, perhaps you got that as part of a Vim distribution such as SpaceVim? You might want to let us know more about your specific setup, since completing pairs is not really standard Vim behavior... If you find it's slowing you down, you might want to consider disabling that behavior by dropping the plug-in. You might feel that it's quicker for you to just type the closing parens and brackets than jumping through them... YMMV. – filbranden Aug 21 '20 at 21:03
  • Thank you! I'm using Vim as a plugin in VSCode. I'm assuming my Python syntax completion plugins are inserting the completing pair. Perhaps there's a way I can configure VSCode not to insert the closing pair when I'm in Vim mode? – kiabbo Aug 21 '20 at 21:44
1

Yes there is. Yesterday I gave this answer on the mother site: SO.

TL;DR:

  • Bracketing plugins usually provide the right mapping to jump over the closing bracket character that is just after the cursor, and moreover what these plugins provide can be redone -- unlike the usual 90's mapping-snippets that many copy and share around.

  • Snippet engines usually provide a placeholder to jump to the next line (in Python-def case) once the function name as been typed.

  • Some snippet plugins and bracketing plugins offer a common generic mapping that permits to jump to the next unresolved placeholder -- this is at least the case of my plugins, I'm not sure about the others.

2
  • I'm using the Vim extension on VSCode. I'm not sure how configurable it is – kiabbo Aug 21 '20 at 21:45
  • 1
    I guess VSCode has snippets. You should use Python snippets. At least it will solve this particular case. Also, I'm surprised that its auto-pairing feature doesn't permit you to simply type ) to jump over the ) character after the cursor. – Luc Hermitte Aug 21 '20 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.