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 command to read file contents into current buffer (vim's :r) #3796

Closed
pinpox opened this issue Sep 11, 2022 · 2 comments · Fixed by #10447
Closed

Add command to read file contents into current buffer (vim's :r) #3796

pinpox opened this issue Sep 11, 2022 · 2 comments · Fixed by #10447
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-good-first-issue Call for participation: Issues suitable for new contributors

Comments

@pinpox
Copy link
Contributor

pinpox commented Sep 11, 2022

I often use :r filename.txt to read a file into the current buffer on vim, but I could't find this feature in helix. There is shell_insert_output and shell_append_output which can be used together with cat to simulate this, but that has the drawback of not supporting things like tab-completion for paths and seems too complicated for such a basic feature.

My suggestion would be to either add a file_insert/append_contents or even better to use the existing file-picker dialog (<space>-f) and expand it's functionality with a shortcut to paste in the contents of the selected file, e.g.:

  1. Open picker <space>-f
  2. Type part of filename until it's selected
  3. Press <Ctrl>-o or <Ctrl>-O> to paste contents of selected file at end/beginning of current buffer (or any other choosen key)

Furthermore, the :r (or :read) commands don't exist yet and would therefore not interfere with anything existing, I think it would be good idea to add those.

@pinpox pinpox added the C-enhancement Category: Improvements label Sep 11, 2022
@kirawi kirawi added A-helix-term Area: Helix term improvements E-good-first-issue Call for participation: Issues suitable for new contributors labels Sep 11, 2022
@gdamore
Copy link
Contributor

gdamore commented Sep 30, 2022

Yes please!

@zephaniahong
Copy link

zephaniahong commented Oct 15, 2022

I will give this issue a shot 👍 Could I just clarify the requirements?
@pinpox Based on my understanding, you seem to have 2 different ideas of solving this issue.

  1. opening the picker and then using ctrl-o
  2. using the vim style of :read

Are you proposing to do both?

Thank you!

edit: Only realised after submitting a PR that there are already 2 ongoing PRs for this issue. But I'll leave this here nonetheless(: Happy to receive any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-good-first-issue Call for participation: Issues suitable for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants