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

Add a bunch of aliases #797

Merged
merged 2 commits into from
Oct 3, 2021
Merged

Add a bunch of aliases #797

merged 2 commits into from
Oct 3, 2021

Conversation

irevoire
Copy link
Contributor

@irevoire irevoire commented Oct 1, 2021

Now we can have multiple aliases to the same command.
I also added the alias x for wq and all the associated variants.

doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
fun: later,
completer: None,
},
TypableCommand {
name: "write-quit",
alias: Some("wq"),
aliases: &["wq", "x"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this also available in vim/kakoune? I was thinking :x could close the underlying buffer instead of the view

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to tell you yes, but it looks like it's not strictly the same in vim.
wq always write the file to disk while x write it only if it has changed.
And in kakoune they are the same I think? I don't find anything talking about it and I don't know where to find it in the code.

Personally, I think these aliases are enough for most people.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seemed to find :x in kakoune.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes you're right I forgot I had added it to my kakrc!

define-command x write-quit

There is even an issue about it:
mawww/kakoune#3503

@pickfire
Copy link
Contributor

pickfire commented Oct 2, 2021

I wonder if we really want a duplicate :x which do the same thing as :wq, do you use :x?

@irevoire
Copy link
Contributor Author

irevoire commented Oct 2, 2021

Personally, yes I use it every time; even after 3 weeks of using helix I'm always trying to :x.
Then I decided to modify helix on my side and after a week I thought I could create a PR so everyone can use it.

@raygervais
Copy link
Contributor

As an individual coming from neovim, I cannot overstate how many times a day I'm using :x out of habit / efficiency just to remember it doesn't work. I'd be so happy if this gets added!

std::iter::once((cmd.name, cmd))
.chain(cmd.aliases.into_iter().map(move |&alias| (alias, cmd)))
})
.flatten()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just use flat_map here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@irevoire irevoire requested a review from archseer October 3, 2021 02:11
@archseer archseer merged commit 7e958e1 into helix-editor:master Oct 3, 2021
@irevoire irevoire mentioned this pull request Oct 3, 2021
@irevoire
Copy link
Contributor Author

irevoire commented Oct 3, 2021

Is the hacktoberfest thing working with this repo?
I see there is the tag but my contribution was not counted 👀

@archseer
Copy link
Member

archseer commented Oct 3, 2021

I see there is the tag

Is there? I'm on my phone so I can't see it right now but I was against enabling hacktoberfest.

@irevoire
Copy link
Contributor Author

irevoire commented Oct 3, 2021

Yes it's there in the label of the project:
image

@sudormrfbin
Copy link
Member

Hacktoberfest was requested in #795 a while ago.

@pickfire
Copy link
Contributor

pickfire commented Oct 3, 2021

@irevoire is it still being counted? Or otherwise maybe I will try adding hacktoberfest-accepted to this PR.

doc: "Open the file in a vertical split.",
fun: vsplit,
completer: Some(completers::filename),
},
TypableCommand {
name: "hsplit",
alias: Some("sp"),
aliases: &["hs", "sp"],
Copy link
Contributor

@pickfire pickfire Oct 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this hs come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For horizontal-split, it's not used by others editor I think but it looked quite logical to me if we have the vs

@irevoire
Copy link
Contributor Author

irevoire commented Oct 4, 2021

I don't really know, it's the first time I contribute to a repo with the hacktoberfest enabled.
My pr is marked as "maturing"

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

Successfully merging this pull request may close these issues.

None yet

5 participants