so I've been learning vim the past few weeks and am having trouble with defining functions and the such.

e.g. every time I define I function in python I write:

typing in insert mode: def foo<cursor>

open parenthesis: def foo(<cursor>) - note that a closing parenthesis will be added automatically

add arguments: def foo(arg1, arg2<cursor>)

then I would have to <ESC>, l, a to go into normal mode, move outside the closing paren, then append to add text, namely the colon and function definition.

Is there a faster way to do this? This process seems so tedious to me.

  • Looks like you're using a plug-in such as auto-pairs... Can you confirm if that's the plug-in you have enabled? Are you using a specific distribution such as SpaceVim? If you're not sure, can you share your vimrc so we can take a look?
    – filbranden
    May 18, 2020 at 0:14
  • Welcome to Vi and Vim!
    – filbranden
    May 18, 2020 at 0:14
  • 3
    Most pairing plugins permits to simply type ) to go past the closing character just after the cursor. Some even provide unique mappings to go past several closing pairs at once. May 18, 2020 at 0:16
  • @LucHermitte solved my issue! Thanks a lot May 18, 2020 at 0:41

1 Answer 1


(Trying to keep answers out of comments and in answers):

Most auto-pair-style plugins let you type the closing bracket to “skip over” the automagically-inserted bracket.

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.