On Thu, Jul 13, 2017 at 9:55 PM, <arocker@vex.net> wrote:
>
> I hesitate to ask this question, since it appears to be so simple, but the
> answer ought to be useful to a lot of people.
>
> There are many constructs in most programming languages which involve
> paired characters - {} () [] particularly. It would be helpful for the
> first character (or the pair) to insert both ends, then skip back between
> them and start inserting. (That avoids leaving unbalances around.)
>
> Despite trying all sorts of combinations, I've been unable to achieve an
> abbreviation sequence that doesn't insert a space, either before or
> between the pair. Is there one?
>
If you want the brackets to close themselves, you can use _mappings_,
not abbreviations, as follows:
inoremap ( ()<BS>
inoremap [ []<BS>
inoremap { {}<BS>
or maybe instead of this last one,
inoremap { {<CR>}<Up><End><CR><Space><Space>
-- but if you want someday to type an unpaired bracket you will then
of course have to follow up with a <Del> to delete the just inserted
closing bracket.
Best regards,
Tony.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thursday, July 13, 2017
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment