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

Get selection from an internal command such as "commandline get-selection" #829

Open
blindFS opened this issue Sep 17, 2024 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@blindFS
Copy link
Contributor

blindFS commented Sep 17, 2024

I'd like to add keybinding features like vim-surround to vi normal mode.
As far as I know, I can't get selected text or copied text (not the system copy/cut) in pure nushell script.
It would be even better if commandline edit support more actions such as those already existed in keybindings list --edits.

References

https://github.com/tpope/vim-surround

@blindFS blindFS added the enhancement New feature or request label Sep 17, 2024
@fdncred
Copy link
Collaborator

fdncred commented Sep 17, 2024

I'm guessing that we'd support such a functionality. You can see all the commandline commands now with help commandline in nushell. maybe a commandline set-selection and commandline get-selection to follow the current commands?

@blindFS
Copy link
Contributor Author

blindFS commented Sep 17, 2024

Just checked the source code on the main branch. Only get-cursor and set-cursor are implemented. I'd like to have 2-int (start, end) version of them.

@fdncred
Copy link
Collaborator

fdncred commented Sep 17, 2024

Right, I was suggesting that you write some new commands to support the functionality you're describing.

@blindFS
Copy link
Contributor Author

blindFS commented Sep 18, 2024

Hi @fdncred , I'd like to discuss the design choice here. Why we use a ReplState instead of just a Reedline editor in struct EngineState? Seems that the set-selection function (or any other feature that requires reedline editor involved) is impossible to implement in trait Command?

@fdncred
Copy link
Collaborator

fdncred commented Sep 18, 2024

I'm not sure. I don't understand reedline's internals enough to help answer.

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

No branches or pull requests

2 participants