K
K
Kyberman2014-01-20 17:05:35
vim
Kyberman, 2014-01-20 17:05:35

How to effectively put parentheses in vim?

When I write code in an editor like gedit or notepad, I put both opening and closing brackets at the same time, then press the left arrow and type. I think it's a good habit to get in the habit of not getting confused by nested parentheses, and it's just more convenient to think "I'm parenthesizing this text" rather than "I'm putting an open parenthesis, I'm writing text, yes, I need to close the parenthesis." With an IDE with autocompletion, everything becomes very convenient. But in vim, for this you have to press the following key sequence: ( ) <esc> <i> text <esc> <a> and type further. How can it be shortened?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mitry, 2014-01-20
@Kyberman

You can map it like this:
imap ( ()<ESC>i

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question