Before I try to write my own, I'm wondering if there is a simple snippet for {
and (
?
For example If I'm writing this (my cursor is the |
):
abc abc (|
and then press tab, I want this:
abc abc (
|
)
The exact same with { }
....
Before I try to write my own, I'm wondering if there is a simple snippet for {
and (
?
For example If I'm writing this (my cursor is the |
):
abc abc (|
and then press tab, I want this:
abc abc (
|
)
The exact same with { }
....
Copyright © 2021 Jogjafile Inc.
I don't thing such snippet already exists as people tend to use brackets/auto-pairing plugins instead which insert balanced pairs more simply (just
(
, or maybe(
+<cr>
, instead of(<tab>
). It wouldn't be very difficult to write a snippet though.The newline is then usually inserted with
<cr>
that analyses its context. In lh-brackets case, if it sees the cursor within{}
, it add the 2 newlines, move the cursor in between and properly indent. It wouldn't be complex to extend this to()
as well. It has the advantage that an empty pair will quickly be opened with the cursor indented in the middle of the newlines.