Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: other block form toggles #290

Open
ExpandingMan opened this issue Apr 21, 2022 · 0 comments
Open

feature request: other block form toggles #290

ExpandingMan opened this issue Apr 21, 2022 · 0 comments

Comments

@ExpandingMan
Copy link
Contributor

This is a bit of an ambitious feature request, but I wanted to at least get it documented.

A while ago I asked for a feature in which I could simply push a button and functions would transform back and forth between block form and one line form. Amazingly, the prolific @carlobaldassi added this right away. This feature is wonderful and ever since I use it many times a day. It gets to a problem that writing code always has but very few text editors bother to solve: you never really know how long a line is going to be until you're done writing it.

It would be really great to have this for more block types. For example

if a
    expr
end

# toggles to

a && expr
if !a
    expr
end

# toggles to

a || expr
if a
    expr1
else
    expr2
end

# toggles to

a ? expr1 : expr2
for x in v
    expr
end

# toggles to

foreach(x -> expr, v)
f(y) do x
    expr
end

# toggles to

f(x -> expr, y)

Again, that's a lot and I know this is ambitious to ask for (there's basically no chance I'll ever implement this myself in vimscript, though there's a chance I'll make a separate lua plugin for it one day); but I love the function block feature that already exists so much I thought this deserved an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant