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

Give users a way to know which vim mode is on currently pragmatically #4484

Open
1 task done
nikitavoloboev opened this issue Sep 13, 2023 · 3 comments
Open
1 task done
Labels
enhancement [core label] vim

Comments

@nikitavoloboev
Copy link

nikitavoloboev commented Sep 13, 2023

Check for existing issues

  • Completed

Describe the feature

I write quite a bit of Rust now as I imagine @zed-industries does too.

I want to build this use case:

When in normal mode and a line is selected like so:

image

I want to add ; to the end of the line.

If however I am in insert mode, I want to just insert ;.

To achieve this, I need to know what vim mode I am currently on. Give users a way to know it please.

Thank you.

@nikitavoloboev nikitavoloboev added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Sep 13, 2023
@ConradIrwin
Copy link
Member

Hey @nikitavoloboev – what are you using to automate this?

In the keyboard bindings file we have a notion of mode (it's not well documented yet, but see here: #5337).

We don't yet have a way to do a "remap" in the vim style (I assume you do something like :nmap ; A;<escape> in vim to make this work), so you won't yet be able to instruct Zed to insert a specific character at the end of the line from the keyboard bindings file.

@nikitavoloboev
Copy link
Author

Hey @nikitavoloboev – what are you using to automate this?

So related to this, I really need this supported by Zed:

#4474

Basically if above is supported and I can get the current line number and file path.

I can then under the hood, press that keybind and trigger a CLI that would run some transformation on the current file/line I am working on.

For example for above case, it will know that if I am at end of line and the file is a rust file, add ; to end of line. If its a rust file but I am not at end of line, then add ; to end of line instead. If neither of those cases is true, do something else.

I can't do any of that if I can't get the information of current file open and current line active from Zed.

Hope my use case is clear and it can be added. ♥️

@ConradIrwin
Copy link
Member

ConradIrwin commented Sep 15, 2023 via email

@JosephTLyons JosephTLyons added vim and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Sep 18, 2023
@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] vim
Projects
None yet
Development

No branches or pull requests

3 participants