2

I've disabled pair completion because it doesn't really save any key presses. I have to press right arrow to get out of a quote after completing the string. Am I missing something here?

For example:

If I have to enter func("hello"), after some typing I will get func("hello|") with cursor at |, and I will have to press at least two more keys(esc-o/A) to get out of declaration and continue editing, which could very well be used to enters " and a ).

4
  • 2
    I personally didn't understand the question. If you disabled the completion, why do you need to press the arrow key to move over the quote? The quote should not be there, if I'm getting you correctly. The second point why do you use the arrow, instead of the l key to move one char to the right?
    – d.k
    Jan 23, 2017 at 8:44
  • @user907860 Aren't they saying that they disabled completion because they had to press the arrow key?
    – user859
    Jan 23, 2017 at 11:22
  • @Alex, yes, it might be. Then the question must have been this: What is the easiest way to skip over the chars inserted by the pair completion
    – d.k
    Jan 23, 2017 at 12:10
  • Sorry for late reply, added an example.
    – saga
    Jan 23, 2017 at 12:11

2 Answers 2

2

If you're using a plugin such as delimitMate or auto-pairs, they have options that allow you to skip over the closed pair by pressing the closing key. If you press [, then you press ]. ( then ). " then ", etc.

Yes, you're still typing the closing character. The point of using these plugins is that the closing character will be in the right place when you're done editing. They also remove the closing pair if you press <bs> to delete the opening pair. Whether or not these features are advantages is up to you.

IMO, typing speed isn't always improved with less keystrokes. There's times where it's improved by predictable reactions to keystrokes. These plugins allow you to forego the need to balance delimiters yourself in most cases.

2
  • I've never liked auto pairing in any editor for this reason. It usually gets in the way more than it helps.
    – Tumbler41
    Jan 23, 2017 at 15:47
  • @Tumbler41 To each their own. This feature does more good than harm for me since I almost always go back to normal mode and use motions after closing braces. For arguments, I have a habit of using <esc>A, so I can undo arguments individually. It's kinda nice that the closing paren/brace stays when pressing u.
    – Tommy A
    Jan 24, 2017 at 22:55
0

As it has been pointed out, this feature doesn't really save any keystrokes, however it helps keeping these pairs balanced.

Note however that lh-brackets has two ways to close all current bracket pairs. The first is bound to the semi colon in C and C++. The second is bound to an tunable keybindind. This is (one of the?) the only case where keystrokes can be saved. I can't tell whether the more popular alternative have (yet?) implemented this feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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